regression: bfs endianness bug
authorAl Viro <viro@ftp.linux.org.uk>
Wed, 5 Dec 2007 08:32:52 +0000 (08:32 +0000)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Wed, 5 Dec 2007 17:25:20 +0000 (09:25 -0800)
BFS_FILEBLOCKS() expects struct bfs_inode * (on-disk data, with little-
endian fields), not struct bfs_inode_info * (in-core stuff, with host-
endian ones).

It's a macro and fields with the right names are present in
bfs_inode_info, so it compiles, but on big-endian host it gives bogus
results.

Introduced in commit f433dc56344cb72cc3de5ba0819021cec3aef807 ("Fixes to
the BFS filesystem driver").

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/bfs/inode.c

index 294c41baef6ed35cb65118867f965ebf522b36ec..a64a71d444f50f5d2e0731f375c9994551780743 100644 (file)
@@ -178,7 +178,8 @@ static void bfs_delete_inode(struct inode *inode)
        brelse(bh);
 
         if (bi->i_dsk_ino) {
-               info->si_freeb += BFS_FILEBLOCKS(bi);
+               if (bi->i_sblock)
+                       info->si_freeb += bi->i_eblock + 1 - bi->i_sblock;
                info->si_freei++;
                clear_bit(ino, info->si_imap);
                dump_imap("delete_inode", s);