Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 199174
b: refs/heads/master
c: 0ab7620
h: refs/heads/master
v: v3
  • Loading branch information
Erik van der Kouwe authored and Al Viro committed May 28, 2010
1 parent b7969d0 commit 127b5cc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1b061d9247f71cd15edc4c4c4600191a903642c0
refs/heads/master: 0ab7620a0cefe6982b914a830a41f65ecccd74bd
27 changes: 15 additions & 12 deletions trunk/fs/minix/itree_v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ static inline block_t *i_data(struct inode *inode)
return (block_t *)minix_i(inode)->u.i2_data;
}

#define DIRCOUNT 7
#define INDIRCOUNT(sb) (1 << ((sb)->s_blocksize_bits - 2))

static int block_to_path(struct inode * inode, long block, int offsets[DEPTH])
{
int n = 0;
Expand All @@ -34,21 +37,21 @@ static int block_to_path(struct inode * inode, long block, int offsets[DEPTH])
printk("MINIX-fs: block_to_path: "
"block %ld too big on dev %s\n",
block, bdevname(sb->s_bdev, b));
} else if (block < 7) {
} else if (block < DIRCOUNT) {
offsets[n++] = block;
} else if ((block -= 7) < 256) {
offsets[n++] = 7;
} else if ((block -= DIRCOUNT) < INDIRCOUNT(sb)) {
offsets[n++] = DIRCOUNT;
offsets[n++] = block;
} else if ((block -= 256) < 256*256) {
offsets[n++] = 8;
offsets[n++] = block>>8;
offsets[n++] = block & 255;
} else if ((block -= INDIRCOUNT(sb)) < INDIRCOUNT(sb) * INDIRCOUNT(sb)) {
offsets[n++] = DIRCOUNT + 1;
offsets[n++] = block / INDIRCOUNT(sb);
offsets[n++] = block % INDIRCOUNT(sb);
} else {
block -= 256*256;
offsets[n++] = 9;
offsets[n++] = block>>16;
offsets[n++] = (block>>8) & 255;
offsets[n++] = block & 255;
block -= INDIRCOUNT(sb) * INDIRCOUNT(sb);
offsets[n++] = DIRCOUNT + 2;
offsets[n++] = (block / INDIRCOUNT(sb)) / INDIRCOUNT(sb);
offsets[n++] = (block / INDIRCOUNT(sb)) % INDIRCOUNT(sb);
offsets[n++] = block % INDIRCOUNT(sb);
}
return n;
}
Expand Down

0 comments on commit 127b5cc

Please sign in to comment.