]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/linux/reiserfs_fs.h
reiserfs: ignore on disk s_bmap_nr value
[linux-2.6-omap-h63xx.git] / include / linux / reiserfs_fs.h
index 69a3e12cb8c8bee07b03737fc757ee311ef595f9..d8653bf232e3c807f3466bf4049d6e35e1ab44ec 100644 (file)
@@ -283,6 +283,18 @@ static inline struct reiserfs_sb_info *REISERFS_SB(const struct super_block *sb)
        return sb->s_fs_info;
 }
 
+/* Don't trust REISERFS_SB(sb)->s_bmap_nr, it's a u16
+ * which overflows on large file systems. */
+static inline u32 reiserfs_bmap_count(struct super_block *sb)
+{
+       return (SB_BLOCK_COUNT(sb) - 1) / (sb->s_blocksize * 8) + 1;
+}
+
+static inline int bmap_would_wrap(unsigned bmap_nr)
+{
+       return bmap_nr > ((1LL << 16) - 1);
+}
+
 /** this says about version of key of all items (but stat data) the
     object consists of */
 #define get_inode_item_key_version( inode )                                    \