diff options
author | kib <kib@FreeBSD.org> | 2010-11-11 11:35:42 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2010-11-11 11:35:42 +0000 |
commit | a16cecf311abf4d7a478af04ffe04c1c2685112f (patch) | |
tree | 3a9831b577465cb6f2b463dd7bbc6bd12e1e4f0c /sys/ufs/ffs/fs.h | |
parent | 57488f7bec4f78caa44c6ca4996fadd288d89bfb (diff) | |
download | FreeBSD-src-a16cecf311abf4d7a478af04ffe04c1c2685112f.zip FreeBSD-src-a16cecf311abf4d7a478af04ffe04c1c2685112f.tar.gz |
Add function lbn_offset to calculate offset of the indirect block of
given level.
Reviewed by: jeff
Tested by: pho
Diffstat (limited to 'sys/ufs/ffs/fs.h')
-rw-r--r-- | sys/ufs/ffs/fs.h | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/sys/ufs/ffs/fs.h b/sys/ufs/ffs/fs.h index 42c4cfe..ba98ed3 100644 --- a/sys/ufs/ffs/fs.h +++ b/sys/ufs/ffs/fs.h @@ -607,6 +607,11 @@ struct cg { : (fragroundup(fs, blkoff(fs, (size))))) /* + * Number of indirects in a filesystem block. + */ +#define NINDIR(fs) ((fs)->fs_nindir) + +/* * Indirect lbns are aligned on NDADDR addresses where single indirects * are the negated address of the lowest lbn reachable, double indirects * are this lbn - 1 and triple indirects are this lbn - 2. This yields @@ -631,6 +636,17 @@ lbn_level(ufs_lbn_t lbn) } return (-1); } + +static inline ufs_lbn_t +lbn_offset(struct fs *fs, int level) +{ + ufs_lbn_t res; + + for (res = 1; level > 0; level--) + res *= NINDIR(fs); + return (res); +} + /* * Number of inodes in a secondary storage block/fragment. */ @@ -638,11 +654,6 @@ lbn_level(ufs_lbn_t lbn) #define INOPF(fs) ((fs)->fs_inopb >> (fs)->fs_fragshift) /* - * Number of indirects in a filesystem block. - */ -#define NINDIR(fs) ((fs)->fs_nindir) - -/* * Softdep journal record format. */ |