diff options
author | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2008-11-22 15:04:59 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2008-11-22 15:04:59 -0500 |
commit | 3a06d778dfeda7eaeeb79bfa49cf97f2aae132b4 (patch) | |
tree | 08c813063950404356c9c64678eed72f21f217b9 | |
parent | 1a0d3786dd57dbd74f340322054c3d618b999dcf (diff) |
ext4: sparse fixes
* Change EXT4_HAS_*_FEATURE to return a boolean
* Add a function prototype for ext4_fiemap() in ext4.h
* Make ext4_ext_fiemap_cb() and ext4_xattr_fiemap() be static functions
* Add lock annotations to mb_free_blocks()
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r-- | fs/ext4/ext4.h | 9 | ||||
-rw-r--r-- | fs/ext4/extents.c | 5 | ||||
-rw-r--r-- | fs/ext4/file.c | 3 | ||||
-rw-r--r-- | fs/ext4/inode.c | 2 | ||||
-rw-r--r-- | fs/ext4/mballoc.c | 4 | ||||
-rw-r--r-- | fs/ext4/super.c | 19 |
6 files changed, 24 insertions, 18 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 558545d1fea..5125c1f6e7e 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -727,11 +727,11 @@ static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino) | |||
727 | */ | 727 | */ |
728 | 728 | ||
729 | #define EXT4_HAS_COMPAT_FEATURE(sb,mask) \ | 729 | #define EXT4_HAS_COMPAT_FEATURE(sb,mask) \ |
730 | (EXT4_SB(sb)->s_es->s_feature_compat & cpu_to_le32(mask)) | 730 | ((EXT4_SB(sb)->s_es->s_feature_compat & cpu_to_le32(mask)) != 0) |
731 | #define EXT4_HAS_RO_COMPAT_FEATURE(sb,mask) \ | 731 | #define EXT4_HAS_RO_COMPAT_FEATURE(sb,mask) \ |
732 | (EXT4_SB(sb)->s_es->s_feature_ro_compat & cpu_to_le32(mask)) | 732 | ((EXT4_SB(sb)->s_es->s_feature_ro_compat & cpu_to_le32(mask)) != 0) |
733 | #define EXT4_HAS_INCOMPAT_FEATURE(sb,mask) \ | 733 | #define EXT4_HAS_INCOMPAT_FEATURE(sb,mask) \ |
734 | (EXT4_SB(sb)->s_es->s_feature_incompat & cpu_to_le32(mask)) | 734 | ((EXT4_SB(sb)->s_es->s_feature_incompat & cpu_to_le32(mask)) != 0) |
735 | #define EXT4_SET_COMPAT_FEATURE(sb,mask) \ | 735 | #define EXT4_SET_COMPAT_FEATURE(sb,mask) \ |
736 | EXT4_SB(sb)->s_es->s_feature_compat |= cpu_to_le32(mask) | 736 | EXT4_SB(sb)->s_es->s_feature_compat |= cpu_to_le32(mask) |
737 | #define EXT4_SET_RO_COMPAT_FEATURE(sb,mask) \ | 737 | #define EXT4_SET_RO_COMPAT_FEATURE(sb,mask) \ |
@@ -1286,6 +1286,9 @@ extern int ext4_get_blocks_wrap(handle_t *handle, struct inode *inode, | |||
1286 | sector_t block, unsigned int max_blocks, | 1286 | sector_t block, unsigned int max_blocks, |
1287 | struct buffer_head *bh, int create, | 1287 | struct buffer_head *bh, int create, |
1288 | int extend_disksize, int flag); | 1288 | int extend_disksize, int flag); |
1289 | extern int ext4_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | ||
1290 | __u64 start, __u64 len); | ||
1291 | |||
1289 | #endif /* __KERNEL__ */ | 1292 | #endif /* __KERNEL__ */ |
1290 | 1293 | ||
1291 | #endif /* _EXT4_H */ | 1294 | #endif /* _EXT4_H */ |
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index b92cb60737b..c64080e4949 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -3080,7 +3080,7 @@ retry: | |||
3080 | /* | 3080 | /* |
3081 | * Callback function called for each extent to gather FIEMAP information. | 3081 | * Callback function called for each extent to gather FIEMAP information. |
3082 | */ | 3082 | */ |
3083 | int ext4_ext_fiemap_cb(struct inode *inode, struct ext4_ext_path *path, | 3083 | static int ext4_ext_fiemap_cb(struct inode *inode, struct ext4_ext_path *path, |
3084 | struct ext4_ext_cache *newex, struct ext4_extent *ex, | 3084 | struct ext4_ext_cache *newex, struct ext4_extent *ex, |
3085 | void *data) | 3085 | void *data) |
3086 | { | 3086 | { |
@@ -3149,7 +3149,8 @@ int ext4_ext_fiemap_cb(struct inode *inode, struct ext4_ext_path *path, | |||
3149 | /* fiemap flags we can handle specified here */ | 3149 | /* fiemap flags we can handle specified here */ |
3150 | #define EXT4_FIEMAP_FLAGS (FIEMAP_FLAG_SYNC|FIEMAP_FLAG_XATTR) | 3150 | #define EXT4_FIEMAP_FLAGS (FIEMAP_FLAG_SYNC|FIEMAP_FLAG_XATTR) |
3151 | 3151 | ||
3152 | int ext4_xattr_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo) | 3152 | static int ext4_xattr_fiemap(struct inode *inode, |
3153 | struct fiemap_extent_info *fieinfo) | ||
3153 | { | 3154 | { |
3154 | __u64 physical = 0; | 3155 | __u64 physical = 0; |
3155 | __u64 length; | 3156 | __u64 length; |
diff --git a/fs/ext4/file.c b/fs/ext4/file.c index 6bd11fba71f..f731cb545a0 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c | |||
@@ -140,9 +140,6 @@ static int ext4_file_mmap(struct file *file, struct vm_area_struct *vma) | |||
140 | return 0; | 140 | return 0; |
141 | } | 141 | } |
142 | 142 | ||
143 | extern int ext4_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | ||
144 | __u64 start, __u64 len); | ||
145 | |||
146 | const struct file_operations ext4_file_operations = { | 143 | const struct file_operations ext4_file_operations = { |
147 | .llseek = generic_file_llseek, | 144 | .llseek = generic_file_llseek, |
148 | .read = do_sync_read, | 145 | .read = do_sync_read, |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 91e06f88f08..bcd5ffa76c0 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -3907,7 +3907,7 @@ static int __ext4_get_inode_loc(struct inode *inode, | |||
3907 | ext4_fsblk_t block; | 3907 | ext4_fsblk_t block; |
3908 | int inodes_per_block, inode_offset; | 3908 | int inodes_per_block, inode_offset; |
3909 | 3909 | ||
3910 | iloc->bh = 0; | 3910 | iloc->bh = NULL; |
3911 | if (!ext4_valid_inum(sb, inode->i_ino)) | 3911 | if (!ext4_valid_inum(sb, inode->i_ino)) |
3912 | return -EIO; | 3912 | return -EIO; |
3913 | 3913 | ||
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 1d78435ce38..edf9730ba72 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -1056,6 +1056,8 @@ static void mb_set_bits(spinlock_t *lock, void *bm, int cur, int len) | |||
1056 | 1056 | ||
1057 | static void mb_free_blocks(struct inode *inode, struct ext4_buddy *e4b, | 1057 | static void mb_free_blocks(struct inode *inode, struct ext4_buddy *e4b, |
1058 | int first, int count) | 1058 | int first, int count) |
1059 | __releases(bitlock) | ||
1060 | __acquires(bitlock) | ||
1059 | { | 1061 | { |
1060 | int block = 0; | 1062 | int block = 0; |
1061 | int max = 0; | 1063 | int max = 0; |
@@ -2244,7 +2246,7 @@ ext4_mb_store_history(struct ext4_allocation_context *ac) | |||
2244 | 2246 | ||
2245 | 2247 | ||
2246 | /* Create and initialize ext4_group_info data for the given group. */ | 2248 | /* Create and initialize ext4_group_info data for the given group. */ |
2247 | int ext4_mb_add_groupinfo(struct super_block *sb, ext4_group_t group, | 2249 | static int ext4_mb_add_groupinfo(struct super_block *sb, ext4_group_t group, |
2248 | struct ext4_group_desc *desc) | 2250 | struct ext4_group_desc *desc) |
2249 | { | 2251 | { |
2250 | int i, len; | 2252 | int i, len; |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 8fa57be5040..a9dd1170bfe 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -1924,7 +1924,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
1924 | int db_count; | 1924 | int db_count; |
1925 | int i; | 1925 | int i; |
1926 | int needs_recovery, has_huge_files; | 1926 | int needs_recovery, has_huge_files; |
1927 | __le32 features; | 1927 | int features; |
1928 | __u64 blocks_count; | 1928 | __u64 blocks_count; |
1929 | int err; | 1929 | int err; |
1930 | 1930 | ||
@@ -2056,15 +2056,17 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
2056 | features = EXT4_HAS_INCOMPAT_FEATURE(sb, ~EXT4_FEATURE_INCOMPAT_SUPP); | 2056 | features = EXT4_HAS_INCOMPAT_FEATURE(sb, ~EXT4_FEATURE_INCOMPAT_SUPP); |
2057 | if (features) { | 2057 | if (features) { |
2058 | printk(KERN_ERR "EXT4-fs: %s: couldn't mount because of " | 2058 | printk(KERN_ERR "EXT4-fs: %s: couldn't mount because of " |
2059 | "unsupported optional features (%x).\n", | 2059 | "unsupported optional features (%x).\n", sb->s_id, |
2060 | sb->s_id, le32_to_cpu(features)); | 2060 | (le32_to_cpu(EXT4_SB(sb)->s_es->s_feature_incompat) & |
2061 | ~EXT4_FEATURE_INCOMPAT_SUPP)); | ||
2061 | goto failed_mount; | 2062 | goto failed_mount; |
2062 | } | 2063 | } |
2063 | features = EXT4_HAS_RO_COMPAT_FEATURE(sb, ~EXT4_FEATURE_RO_COMPAT_SUPP); | 2064 | features = EXT4_HAS_RO_COMPAT_FEATURE(sb, ~EXT4_FEATURE_RO_COMPAT_SUPP); |
2064 | if (!(sb->s_flags & MS_RDONLY) && features) { | 2065 | if (!(sb->s_flags & MS_RDONLY) && features) { |
2065 | printk(KERN_ERR "EXT4-fs: %s: couldn't mount RDWR because of " | 2066 | printk(KERN_ERR "EXT4-fs: %s: couldn't mount RDWR because of " |
2066 | "unsupported optional features (%x).\n", | 2067 | "unsupported optional features (%x).\n", sb->s_id, |
2067 | sb->s_id, le32_to_cpu(features)); | 2068 | (le32_to_cpu(EXT4_SB(sb)->s_es->s_feature_ro_compat) & |
2069 | ~EXT4_FEATURE_RO_COMPAT_SUPP)); | ||
2068 | goto failed_mount; | 2070 | goto failed_mount; |
2069 | } | 2071 | } |
2070 | has_huge_files = EXT4_HAS_RO_COMPAT_FEATURE(sb, | 2072 | has_huge_files = EXT4_HAS_RO_COMPAT_FEATURE(sb, |
@@ -3131,13 +3133,14 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) | |||
3131 | lock_super(sb); | 3133 | lock_super(sb); |
3132 | } | 3134 | } |
3133 | } else { | 3135 | } else { |
3134 | __le32 ret; | 3136 | int ret; |
3135 | if ((ret = EXT4_HAS_RO_COMPAT_FEATURE(sb, | 3137 | if ((ret = EXT4_HAS_RO_COMPAT_FEATURE(sb, |
3136 | ~EXT4_FEATURE_RO_COMPAT_SUPP))) { | 3138 | ~EXT4_FEATURE_RO_COMPAT_SUPP))) { |
3137 | printk(KERN_WARNING "EXT4-fs: %s: couldn't " | 3139 | printk(KERN_WARNING "EXT4-fs: %s: couldn't " |
3138 | "remount RDWR because of unsupported " | 3140 | "remount RDWR because of unsupported " |
3139 | "optional features (%x).\n", | 3141 | "optional features (%x).\n", sb->s_id, |
3140 | sb->s_id, le32_to_cpu(ret)); | 3142 | (le32_to_cpu(sbi->s_es->s_feature_ro_compat) & |
3143 | ~EXT4_FEATURE_RO_COMPAT_SUPP)); | ||
3141 | err = -EROFS; | 3144 | err = -EROFS; |
3142 | goto restore_opts; | 3145 | goto restore_opts; |
3143 | } | 3146 | } |