* [PATCH] ext4: sparse fixes
2007-10-04 5:50 ` [PATCH] ext4: Convert ext4_extent_idx.ei_leaf to ext4_extent_idx.ei_leaf_lo Theodore Ts'o
@ 2007-10-04 5:50 ` Theodore Ts'o
0 siblings, 0 replies; 3+ messages in thread
From: Theodore Ts'o @ 2007-10-04 5:50 UTC (permalink / raw)
To: linux-kernel; +Cc: linux-ext4, Aneesh Kumar K.V
From: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
fs/ext4/fsync.c | 2 +-
fs/ext4/inode.c | 2 +-
fs/ext4/xattr.c | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c
index 2a167d7..8d50879 100644
--- a/fs/ext4/fsync.c
+++ b/fs/ext4/fsync.c
@@ -47,7 +47,7 @@ int ext4_sync_file(struct file * file, struct dentry *dentry, int datasync)
struct inode *inode = dentry->d_inode;
int ret = 0;
- J_ASSERT(ext4_journal_current_handle() == 0);
+ J_ASSERT(ext4_journal_current_handle() == NULL);
/*
* data=writeback:
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index a2e1ea4..07afd4a 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -1027,7 +1027,7 @@ struct buffer_head *ext4_getblk(handle_t *handle, struct inode *inode,
}
if (buffer_new(&dummy)) {
J_ASSERT(create != 0);
- J_ASSERT(handle != 0);
+ J_ASSERT(handle != NULL);
/*
* Now that we do not always journal data, we should
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index 12c7d65..8638730 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -1120,7 +1120,7 @@ int ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_isize,
int total_ino, total_blk;
void *base, *start, *end;
int extra_isize = 0, error = 0, tried_min_extra_isize = 0;
- int s_min_extra_isize = EXT4_SB(inode->i_sb)->s_es->s_min_extra_isize;
+ int s_min_extra_isize = le16_to_cpu(EXT4_SB(inode->i_sb)->s_es->s_min_extra_isize);
down_write(&EXT4_I(inode)->xattr_sem);
retry:
@@ -1292,7 +1292,7 @@ retry:
i.name = b_entry_name;
i.value = buffer;
- i.value_len = cpu_to_le32(size);
+ i.value_len = size;
error = ext4_xattr_block_find(inode, &i, bs);
if (error)
goto cleanup;
--
1.5.3.2.81.g17ed
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] ext4: sparse fixes
@ 2008-10-31 16:55 Aneesh Kumar K.V
2008-11-03 2:59 ` Theodore Tso
0 siblings, 1 reply; 3+ messages in thread
From: Aneesh Kumar K.V @ 2008-10-31 16:55 UTC (permalink / raw)
To: cmm, tytso, sandeen, frederic.bohe; +Cc: linux-ext4, Aneesh Kumar K.V
There are some locking fixes also in this patch.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
fs/ext4/ext4.h | 3 +++
fs/ext4/extents.c | 4 ++--
fs/ext4/inode.c | 2 +-
fs/ext4/mballoc.c | 5 ++++-
fs/ext4/super.c | 9 ++++-----
5 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 4880cc3..46419f5 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -1284,6 +1284,9 @@ extern int ext4_get_blocks_wrap(handle_t *handle, struct inode *inode,
sector_t block, unsigned long max_blocks,
struct buffer_head *bh, int create,
int extend_disksize, int flag);
+extern int ext4_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
+ __u64 start, __u64 len);
+
#endif /* __KERNEL__ */
#endif /* _EXT4_H */
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index ea2ce3c..b09b291 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -3083,7 +3083,7 @@ long ext4_fallocate(struct inode *inode, int mode, loff_t offset, loff_t len)
/*
* 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,
void *data)
{
@@ -3152,7 +3152,7 @@ int ext4_ext_fiemap_cb(struct inode *inode, struct ext4_ext_path *path,
/* fiemap flags we can handle specified here */
#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 length;
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 8dbf695..2d070ef 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -3841,7 +3841,7 @@ static int __ext4_get_inode_loc(struct inode *inode,
ext4_fsblk_t block;
int inodes_per_block, inode_offset;
- iloc->bh = 0;
+ iloc->bh = NULL;
if (!ext4_valid_inum(sb, inode->i_ino))
return -EIO;
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index dfe17a1..db05ffd 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)
static void mb_free_blocks(struct inode *inode, struct ext4_buddy *e4b,
int first, int count)
+__releases(bitlock)
+__acquires(bitlock)
{
int block = 0;
int max = 0;
@@ -2242,7 +2244,7 @@ ext4_mb_store_history(struct ext4_allocation_context *ac)
/* 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)
{
int i, len;
@@ -4441,6 +4443,7 @@ ext4_mb_free_metadata(handle_t *handle, struct ext4_buddy *e4b,
else if (block >= (entry->start_blk + entry->count))
n = &(*n)->rb_right;
else {
+ ext4_unlock_group(sb, group);
ext4_error(sb, __func__,
"Double free of blocks %d (%d %d)\n",
block, entry->start_blk, entry->count);
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index bdddea1..a725a5c 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1455,9 +1455,8 @@ static int ext4_fill_flex_info(struct super_block *sb)
/* We allocate both existing and potentially added groups */
flex_group_count = ((sbi->s_groups_count + groups_per_flex - 1) +
- ((sbi->s_es->s_reserved_gdt_blocks +1 ) <<
- EXT4_DESC_PER_BLOCK_BITS(sb))) /
- groups_per_flex;
+ ((le16_to_cpu(sbi->s_es->s_reserved_gdt_blocks) + 1) <<
+ EXT4_DESC_PER_BLOCK_BITS(sb))) / groups_per_flex;
sbi->s_flex_groups = kzalloc(flex_group_count *
sizeof(struct flex_groups), GFP_KERNEL);
if (sbi->s_flex_groups == NULL) {
@@ -2014,8 +2013,8 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
sb->s_id, le32_to_cpu(features));
goto failed_mount;
}
- has_huge_files = EXT4_HAS_RO_COMPAT_FEATURE(sb,
- EXT4_FEATURE_RO_COMPAT_HUGE_FILE);
+ has_huge_files = le32_to_cpu(EXT4_HAS_RO_COMPAT_FEATURE(sb,
+ EXT4_FEATURE_RO_COMPAT_HUGE_FILE));
if (has_huge_files) {
/*
* Large file size enabled file system can only be
--
1.6.0.3.514.g2f91b
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ext4: sparse fixes
2008-10-31 16:55 [PATCH] ext4: sparse fixes Aneesh Kumar K.V
@ 2008-11-03 2:59 ` Theodore Tso
0 siblings, 0 replies; 3+ messages in thread
From: Theodore Tso @ 2008-11-03 2:59 UTC (permalink / raw)
To: Aneesh Kumar K.V; +Cc: cmm, sandeen, frederic.bohe, linux-ext4
On Fri, Oct 31, 2008 at 10:25:35PM +0530, Aneesh Kumar K.V wrote:
> There are some locking fixes also in this patch.
Can we move the one real locking fix into a separate patch, and push
that to Linus ASAP, while leaving the cleanups to later?
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index bdddea1..a725a5c 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -1455,9 +1455,8 @@ static int ext4_fill_flex_info(struct super_block *sb)
>
> /* We allocate both existing and potentially added groups */
> flex_group_count = ((sbi->s_groups_count + groups_per_flex - 1) +
> - ((sbi->s_es->s_reserved_gdt_blocks +1 ) <<
> - EXT4_DESC_PER_BLOCK_BITS(sb))) /
> - groups_per_flex;
> + ((le16_to_cpu(sbi->s_es->s_reserved_gdt_blocks) + 1) <<
> + EXT4_DESC_PER_BLOCK_BITS(sb))) / groups_per_flex;
> sbi->s_flex_groups = kzalloc(flex_group_count *
> sizeof(struct flex_groups), GFP_KERNEL);
> if (sbi->s_flex_groups == NULL) {
This looks like a real bug fix which we should get to Linus quickly,
since could cause problems on Big Endian systems.
> @@ -2014,8 +2013,8 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
> sb->s_id, le32_to_cpu(features));
> goto failed_mount;
> }
> - has_huge_files = EXT4_HAS_RO_COMPAT_FEATURE(sb,
> - EXT4_FEATURE_RO_COMPAT_HUGE_FILE);
> + has_huge_files = le32_to_cpu(EXT4_HAS_RO_COMPAT_FEATURE(sb,
> + EXT4_FEATURE_RO_COMPAT_HUGE_FILE));
> if (has_huge_files) {
> /*
> * Large file size enabled file system can only be
This, on the other hand is a pointless sparse fixup that actually ends
up causing code bloat. EXT4_HAS_RO_COMPAT() is a macro which
returns a boolean. So we don't need to call le32_to_cpu() to it just
to shut up sparse. Better to simply give a sparse anotation that this
returns an int and not a le32.
- Ted
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-11-03 2:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-31 16:55 [PATCH] ext4: sparse fixes Aneesh Kumar K.V
2008-11-03 2:59 ` Theodore Tso
-- strict thread matches above, loose matches on Subject: below --
2007-10-04 5:50 [PATCH, RFC] Ext4 patches planned for submission upstream Theodore Ts'o
2007-10-04 5:50 ` [PATCH] jbd/jbd2: JBD memory allocation cleanups Theodore Ts'o
2007-10-04 5:50 ` [PATCH] jbd/jbd2: Journal initialization doesn't need __GFP_NOFAIL Theodore Ts'o
2007-10-04 5:50 ` [PATCH] JBD2/Ext4: Convert kmalloc to kzalloc in jbd2/ext4 Theodore Ts'o
[not found] ` <1191477059-5357-5-git-send-email-tytso@mit.edu>
2007-10-04 5:50 ` [PATCH] jbd2: fix commit code to properly abort journal Theodore Ts'o
2007-10-04 5:50 ` [PATCH] JBD2: debug code cleanup Theodore Ts'o
2007-10-04 5:50 ` [PATCH] Once ext4 will not implement fragment, it is believed it will never be Theodore Ts'o
2007-10-04 5:50 ` [PATCH] ext4: remove #ifdef CONFIG_EXT4_INDEX Theodore Ts'o
2007-10-04 5:50 ` [PATCH] Ext4: Uninitialized Block Groups Theodore Ts'o
2007-10-04 5:50 ` [PATCH] ext4: Fix sparse warnings Theodore Ts'o
2007-10-04 5:50 ` [PATCH] This feature relaxes check restrictions on where each block groups meta Theodore Ts'o
2007-10-04 5:50 ` [PATCH] Support large blocksize up to PAGESIZE (max 64KB) for ext4 Theodore Ts'o
2007-10-04 5:50 ` [PATCH] ext4: Avoid rec_len overflow with 64KB block size Theodore Ts'o
2007-10-04 5:50 ` [PATCH] Support large blocksize up to PAGESIZE (max 64KB) for ext2 Theodore Ts'o
2007-10-04 5:50 ` [PATCH] Support large blocksize up to PAGESIZE (max 64KB) for ext3 Theodore Ts'o
2007-10-04 5:50 ` [PATCH] ext2: Avoid rec_len overflow with 64KB block size Theodore Ts'o
2007-10-04 5:50 ` [PATCH] ext3: " Theodore Ts'o
2007-10-04 5:50 ` [PATCH] ext4: Convert bg_block_bitmap to bg_block_bitmap_lo Theodore Ts'o
2007-10-04 5:50 ` [PATCH] ext4: Convert bg_inode_bitmap and bg_inode_table Theodore Ts'o
2007-10-04 5:50 ` [PATCH] ext4: Convert s_blocks_count to s_blocks_count_lo Theodore Ts'o
2007-10-04 5:50 ` [PATCH] ext4: Convert s_r_blocks_count and s_free_blocks_count Theodore Ts'o
2007-10-04 5:50 ` [PATCH] ext4: Convert ext4_extent.ee_start to ext4_extent.ee_start_lo Theodore Ts'o
2007-10-04 5:50 ` [PATCH] ext4: Convert ext4_extent_idx.ei_leaf to ext4_extent_idx.ei_leaf_lo Theodore Ts'o
2007-10-04 5:50 ` [PATCH] ext4: sparse fixes Theodore Ts'o
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.