[PATCH] ext4: sparse fixes

Previous thread: [PATCH] jbd2: fix commit code to properly abort journal by Theodore Ts'o on Thursday, October 4, 2007 - 1:50 am. (13 messages)

Next thread: [PATCH] jbd/jbd2: Journal initialization doesn't need __GFP_NOFAIL by Theodore Ts'o on Thursday, October 4, 2007 - 1:50 am. (14 messages)
To: <linux-kernel@...>
Cc: <linux-ext4@...>, Aneesh Kumar K.V <aneesh.kumar@...>
Date: Thursday, October 4, 2007 - 1:50 am

From: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>

Convert ext4_extent_idx.ei_leaf ext4_extent_idx.ei_leaf_lo
This helps in finding BUGs due to direct partial access of
these split 48 bit values.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
fs/ext4/extents.c | 4 ++--
include/linux/ext4_fs_extents.h | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index c03056a..8528774 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -65,7 +65,7 @@ static ext4_fsblk_t idx_pblock(struct ext4_extent_idx *ix)
{
ext4_fsblk_t block;

- block = le32_to_cpu(ix->ei_leaf);
+ block = le32_to_cpu(ix->ei_leaf_lo);
block |= ((ext4_fsblk_t) le16_to_cpu(ix->ei_leaf_hi) << 31) << 1;
return block;
}
@@ -88,7 +88,7 @@ static void ext4_ext_store_pblock(struct ext4_extent *ex, ext4_fsblk_t pb)
*/
static void ext4_idx_store_pblock(struct ext4_extent_idx *ix, ext4_fsblk_t pb)
{
- ix->ei_leaf = cpu_to_le32((unsigned long) (pb & 0xffffffff));
+ ix->ei_leaf_lo = cpu_to_le32((unsigned long) (pb & 0xffffffff));
ix->ei_leaf_hi = cpu_to_le16((unsigned long) ((pb >> 31) >> 1) & 0xffff);
}

diff --git a/include/linux/ext4_fs_extents.h b/include/linux/ext4_fs_extents.h
index cb2dfbb..d2045a2 100644
--- a/include/linux/ext4_fs_extents.h
+++ b/include/linux/ext4_fs_extents.h
@@ -83,7 +83,7 @@ struct ext4_extent {
*/
struct ext4_extent_idx {
__le32 ei_block; /* index covers logical blocks from 'block' */
- __le32 ei_leaf; /* pointer to the physical block of the next *
+ __le32 ei_leaf_lo; /* pointer to the physical block of the next *
* level. leaf or next index could be there */
__le16 ei_leaf_hi; /* high 16 bits of physical block */
__u16 ei_unused;
--
1.5.3.2.81.g17ed

-

To: <linux-kernel@...>
Cc: <linux-ext4@...>, Aneesh Kumar K.V <aneesh.kumar@...>
Date: Thursday, October 4, 2007 - 1:50 am

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

-

Previous thread: [PATCH] jbd2: fix commit code to properly abort journal by Theodore Ts'o on Thursday, October 4, 2007 - 1:50 am. (13 messages)

Next thread: [PATCH] jbd/jbd2: Journal initialization doesn't need __GFP_NOFAIL by Theodore Ts'o on Thursday, October 4, 2007 - 1:50 am. (14 messages)