summaryrefslogtreecommitdiffstats
path: root/sys/ufs/ffs/fs.h
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2010-11-11 11:35:42 +0000
committerkib <kib@FreeBSD.org>2010-11-11 11:35:42 +0000
commita16cecf311abf4d7a478af04ffe04c1c2685112f (patch)
tree3a9831b577465cb6f2b463dd7bbc6bd12e1e4f0c /sys/ufs/ffs/fs.h
parent57488f7bec4f78caa44c6ca4996fadd288d89bfb (diff)
downloadFreeBSD-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.h21
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.
*/
OpenPOWER on IntegriCloud