diff options
author | Andrew Stribblehill <a.d.stribblehill@durham.ac.uk> | 2005-09-09 16:02:04 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-09 16:57:32 -0400 |
commit | fac92becdaecff64dd91daab0292c5131de92f0d (patch) | |
tree | 6c91bdbbe527682813d7c27ed13bdb0531298146 /include/linux/bfs_fs.h | |
parent | 383f2835eb9afb723af71850037b2f074ac9db60 (diff) |
[PATCH] bfs: fix endianness, signedness; add trivial bugfix
* Makes BFS code endianness-clean.
* Fixes some signedness warnings.
* Fixes a problem in fs/bfs/inode.c:164 where inodes not synced to disk
don't get fully marked as clean. Here's how to reproduce it:
# mount -o loop -t bfs /bfs.img /mnt
# df -i /mnt
Filesystem Inodes IUsed IFree IUse% Mounted on
/bfs.img 48 1 47 3% /mnt
# df -k /mnt
Filesystem 1K-blocks Used Available Use% Mounted on
/bfs.img 512 5 508 1% /mnt
# cp 60k-archive.zip /mnt/mt.zip
# df -k /mnt
Filesystem 1K-blocks Used Available Use% Mounted on
/bfs.img 512 65 447 13% /mnt
# df -i /mnt
Filesystem Inodes IUsed IFree IUse% Mounted on
/bfs.img 48 2 46 5% /mnt
# rm /mnt/mt.zip
# echo $?
0
[If the unlink happens before the buffers flush, the following happens:]
# df -i /mnt
Filesystem Inodes IUsed IFree IUse% Mounted on
/bfs.img 48 2 46 5% /mnt
# df -k /mnt
Filesystem 1K-blocks Used Available Use% Mounted on
/bfs.img 512 65 447 13% /mnt
fs/bfs/bfs.h | 1
Signed-off-by: Andrew Stribblehill <ads@wompom.org>
Cc: <tigran@veritas.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux/bfs_fs.h')
-rw-r--r-- | include/linux/bfs_fs.h | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/include/linux/bfs_fs.h b/include/linux/bfs_fs.h index f7f0913cd110..c1237aa92e38 100644 --- a/include/linux/bfs_fs.h +++ b/include/linux/bfs_fs.h | |||
@@ -14,8 +14,9 @@ | |||
14 | #define BFS_INODES_PER_BLOCK 8 | 14 | #define BFS_INODES_PER_BLOCK 8 |
15 | 15 | ||
16 | /* SVR4 vnode type values (bfs_inode->i_vtype) */ | 16 | /* SVR4 vnode type values (bfs_inode->i_vtype) */ |
17 | #define BFS_VDIR 2 | 17 | #define BFS_VDIR 2L |
18 | #define BFS_VREG 1 | 18 | #define BFS_VREG 1L |
19 | |||
19 | 20 | ||
20 | /* BFS inode layout on disk */ | 21 | /* BFS inode layout on disk */ |
21 | struct bfs_inode { | 22 | struct bfs_inode { |
@@ -58,22 +59,22 @@ struct bfs_super_block { | |||
58 | __u32 s_padding[118]; | 59 | __u32 s_padding[118]; |
59 | }; | 60 | }; |
60 | 61 | ||
61 | #define BFS_NZFILESIZE(ip) \ | ||
62 | (((ip)->i_eoffset + 1) - (ip)->i_sblock * BFS_BSIZE) | ||
63 | |||
64 | #define BFS_FILESIZE(ip) \ | ||
65 | ((ip)->i_sblock == 0 ? 0 : BFS_NZFILESIZE(ip)) | ||
66 | |||
67 | #define BFS_FILEBLOCKS(ip) \ | ||
68 | ((ip)->i_sblock == 0 ? 0 : ((ip)->i_eblock + 1) - (ip)->i_sblock) | ||
69 | 62 | ||
70 | #define BFS_OFF2INO(offset) \ | 63 | #define BFS_OFF2INO(offset) \ |
71 | ((((offset) - BFS_BSIZE) / sizeof(struct bfs_inode)) + BFS_ROOT_INO) | 64 | ((((offset) - BFS_BSIZE) / sizeof(struct bfs_inode)) + BFS_ROOT_INO) |
72 | 65 | ||
73 | #define BFS_INO2OFF(ino) \ | 66 | #define BFS_INO2OFF(ino) \ |
74 | ((__u32)(((ino) - BFS_ROOT_INO) * sizeof(struct bfs_inode)) + BFS_BSIZE) | 67 | ((__u32)(((ino) - BFS_ROOT_INO) * sizeof(struct bfs_inode)) + BFS_BSIZE) |
68 | #define BFS_NZFILESIZE(ip) \ | ||
69 | ((cpu_to_le32((ip)->i_eoffset) + 1) - cpu_to_le32((ip)->i_sblock) * BFS_BSIZE) | ||
70 | |||
71 | #define BFS_FILESIZE(ip) \ | ||
72 | ((ip)->i_sblock == 0 ? 0 : BFS_NZFILESIZE(ip)) | ||
75 | 73 | ||
74 | #define BFS_FILEBLOCKS(ip) \ | ||
75 | ((ip)->i_sblock == 0 ? 0 : (cpu_to_le32((ip)->i_eblock) + 1) - cpu_to_le32((ip)->i_sblock)) | ||
76 | #define BFS_UNCLEAN(bfs_sb, sb) \ | 76 | #define BFS_UNCLEAN(bfs_sb, sb) \ |
77 | ((bfs_sb->s_from != -1) && (bfs_sb->s_to != -1) && !(sb->s_flags & MS_RDONLY)) | 77 | ((cpu_to_le32(bfs_sb->s_from) != -1) && (cpu_to_le32(bfs_sb->s_to) != -1) && !(sb->s_flags & MS_RDONLY)) |
78 | |||
78 | 79 | ||
79 | #endif /* _LINUX_BFS_FS_H */ | 80 | #endif /* _LINUX_BFS_FS_H */ |