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>
This commit is contained in:
Aneesh Kumar K.V 2008-11-22 15:04:59 -05:00 committed by Theodore Ts'o
parent 1a0d3786dd
commit 3a06d778df
6 changed files with 24 additions and 18 deletions

View File

@ -727,11 +727,11 @@ static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino)
*/ */
#define EXT4_HAS_COMPAT_FEATURE(sb,mask) \ #define EXT4_HAS_COMPAT_FEATURE(sb,mask) \
(EXT4_SB(sb)->s_es->s_feature_compat & cpu_to_le32(mask)) ((EXT4_SB(sb)->s_es->s_feature_compat & cpu_to_le32(mask)) != 0)
#define EXT4_HAS_RO_COMPAT_FEATURE(sb,mask) \ #define EXT4_HAS_RO_COMPAT_FEATURE(sb,mask) \
(EXT4_SB(sb)->s_es->s_feature_ro_compat & cpu_to_le32(mask)) ((EXT4_SB(sb)->s_es->s_feature_ro_compat & cpu_to_le32(mask)) != 0)
#define EXT4_HAS_INCOMPAT_FEATURE(sb,mask) \ #define EXT4_HAS_INCOMPAT_FEATURE(sb,mask) \
(EXT4_SB(sb)->s_es->s_feature_incompat & cpu_to_le32(mask)) ((EXT4_SB(sb)->s_es->s_feature_incompat & cpu_to_le32(mask)) != 0)
#define EXT4_SET_COMPAT_FEATURE(sb,mask) \ #define EXT4_SET_COMPAT_FEATURE(sb,mask) \
EXT4_SB(sb)->s_es->s_feature_compat |= cpu_to_le32(mask) EXT4_SB(sb)->s_es->s_feature_compat |= cpu_to_le32(mask)
#define EXT4_SET_RO_COMPAT_FEATURE(sb,mask) \ #define EXT4_SET_RO_COMPAT_FEATURE(sb,mask) \
@ -1286,6 +1286,9 @@ extern int ext4_get_blocks_wrap(handle_t *handle, struct inode *inode,
sector_t block, unsigned int max_blocks, sector_t block, unsigned int max_blocks,
struct buffer_head *bh, int create, struct buffer_head *bh, int create,
int extend_disksize, int flag); int extend_disksize, int flag);
extern int ext4_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
__u64 start, __u64 len);
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif /* _EXT4_H */ #endif /* _EXT4_H */

View File

@ -3080,7 +3080,7 @@ retry:
/* /*
* Callback function called for each extent to gather FIEMAP information. * Callback function called for each extent to gather FIEMAP information.
*/ */
int ext4_ext_fiemap_cb(struct inode *inode, struct ext4_ext_path *path, static int ext4_ext_fiemap_cb(struct inode *inode, struct ext4_ext_path *path,
struct ext4_ext_cache *newex, struct ext4_extent *ex, struct ext4_ext_cache *newex, struct ext4_extent *ex,
void *data) void *data)
{ {
@ -3149,7 +3149,8 @@ int ext4_ext_fiemap_cb(struct inode *inode, struct ext4_ext_path *path,
/* fiemap flags we can handle specified here */ /* fiemap flags we can handle specified here */
#define EXT4_FIEMAP_FLAGS (FIEMAP_FLAG_SYNC|FIEMAP_FLAG_XATTR) #define EXT4_FIEMAP_FLAGS (FIEMAP_FLAG_SYNC|FIEMAP_FLAG_XATTR)
int ext4_xattr_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo) static int ext4_xattr_fiemap(struct inode *inode,
struct fiemap_extent_info *fieinfo)
{ {
__u64 physical = 0; __u64 physical = 0;
__u64 length; __u64 length;

View File

@ -140,9 +140,6 @@ static int ext4_file_mmap(struct file *file, struct vm_area_struct *vma)
return 0; return 0;
} }
extern int ext4_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
__u64 start, __u64 len);
const struct file_operations ext4_file_operations = { const struct file_operations ext4_file_operations = {
.llseek = generic_file_llseek, .llseek = generic_file_llseek,
.read = do_sync_read, .read = do_sync_read,

View File

@ -3907,7 +3907,7 @@ static int __ext4_get_inode_loc(struct inode *inode,
ext4_fsblk_t block; ext4_fsblk_t block;
int inodes_per_block, inode_offset; int inodes_per_block, inode_offset;
iloc->bh = 0; iloc->bh = NULL;
if (!ext4_valid_inum(sb, inode->i_ino)) if (!ext4_valid_inum(sb, inode->i_ino))
return -EIO; return -EIO;

View File

@ -1056,6 +1056,8 @@ static void mb_set_bits(spinlock_t *lock, void *bm, int cur, int len)
static void mb_free_blocks(struct inode *inode, struct ext4_buddy *e4b, static void mb_free_blocks(struct inode *inode, struct ext4_buddy *e4b,
int first, int count) int first, int count)
__releases(bitlock)
__acquires(bitlock)
{ {
int block = 0; int block = 0;
int max = 0; int max = 0;
@ -2244,7 +2246,7 @@ ext4_mb_store_history(struct ext4_allocation_context *ac)
/* Create and initialize ext4_group_info data for the given group. */ /* Create and initialize ext4_group_info data for the given group. */
int ext4_mb_add_groupinfo(struct super_block *sb, ext4_group_t group, static int ext4_mb_add_groupinfo(struct super_block *sb, ext4_group_t group,
struct ext4_group_desc *desc) struct ext4_group_desc *desc)
{ {
int i, len; int i, len;

View File

@ -1924,7 +1924,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
int db_count; int db_count;
int i; int i;
int needs_recovery, has_huge_files; int needs_recovery, has_huge_files;
__le32 features; int features;
__u64 blocks_count; __u64 blocks_count;
int err; int err;
@ -2056,15 +2056,17 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
features = EXT4_HAS_INCOMPAT_FEATURE(sb, ~EXT4_FEATURE_INCOMPAT_SUPP); features = EXT4_HAS_INCOMPAT_FEATURE(sb, ~EXT4_FEATURE_INCOMPAT_SUPP);
if (features) { if (features) {
printk(KERN_ERR "EXT4-fs: %s: couldn't mount because of " printk(KERN_ERR "EXT4-fs: %s: couldn't mount because of "
"unsupported optional features (%x).\n", "unsupported optional features (%x).\n", sb->s_id,
sb->s_id, le32_to_cpu(features)); (le32_to_cpu(EXT4_SB(sb)->s_es->s_feature_incompat) &
~EXT4_FEATURE_INCOMPAT_SUPP));
goto failed_mount; goto failed_mount;
} }
features = EXT4_HAS_RO_COMPAT_FEATURE(sb, ~EXT4_FEATURE_RO_COMPAT_SUPP); features = EXT4_HAS_RO_COMPAT_FEATURE(sb, ~EXT4_FEATURE_RO_COMPAT_SUPP);
if (!(sb->s_flags & MS_RDONLY) && features) { if (!(sb->s_flags & MS_RDONLY) && features) {
printk(KERN_ERR "EXT4-fs: %s: couldn't mount RDWR because of " printk(KERN_ERR "EXT4-fs: %s: couldn't mount RDWR because of "
"unsupported optional features (%x).\n", "unsupported optional features (%x).\n", sb->s_id,
sb->s_id, le32_to_cpu(features)); (le32_to_cpu(EXT4_SB(sb)->s_es->s_feature_ro_compat) &
~EXT4_FEATURE_RO_COMPAT_SUPP));
goto failed_mount; goto failed_mount;
} }
has_huge_files = EXT4_HAS_RO_COMPAT_FEATURE(sb, 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)
lock_super(sb); lock_super(sb);
} }
} else { } else {
__le32 ret; int ret;
if ((ret = EXT4_HAS_RO_COMPAT_FEATURE(sb, if ((ret = EXT4_HAS_RO_COMPAT_FEATURE(sb,
~EXT4_FEATURE_RO_COMPAT_SUPP))) { ~EXT4_FEATURE_RO_COMPAT_SUPP))) {
printk(KERN_WARNING "EXT4-fs: %s: couldn't " printk(KERN_WARNING "EXT4-fs: %s: couldn't "
"remount RDWR because of unsupported " "remount RDWR because of unsupported "
"optional features (%x).\n", "optional features (%x).\n", sb->s_id,
sb->s_id, le32_to_cpu(ret)); (le32_to_cpu(sbi->s_es->s_feature_ro_compat) &
~EXT4_FEATURE_RO_COMPAT_SUPP));
err = -EROFS; err = -EROFS;
goto restore_opts; goto restore_opts;
} }