Re: [PATCH 10/39] ocfs2: Add helper function in uptodate.c for removing xattr clusters

From: Mark Fasheh
Date: Tue Oct 07 2008 - 16:18:33 EST


On Wed, Oct 01, 2008 at 11:11:56PM -0700, Andrew Morton wrote:
> > On Wed, 24 Sep 2008 15:00:51 -0700 Mark Fasheh <mfasheh@xxxxxxxx> wrote:
> > +/* Called when we remove xattr clusters from an inode. */
> > +void ocfs2_remove_xattr_clusters_from_cache(struct inode *inode,
> > + sector_t block,
> > + u32 c_len)
> > +{
> > + u64 i, b_len = ocfs2_clusters_to_blocks(inode->i_sb, 1) * c_len;
> > +
> > + for (i = 0; i < b_len; i++, block++)
> > + ocfs2_remove_block_from_cache(inode, block);
> > +}
>
> I really really hope that `i' and `b_len' didn't really need to be
> 64-bit here.

Yeah, there's no way currently that any of those variables should get even
close to that large. I made them unsigned ints with the patch below.
--Mark

--
Mark Fasheh

From: Mark Fasheh <mfasheh@xxxxxxxx>

ocfs2: use smaller counters in ocfs2_remove_xattr_clusters_from_cache

i and b_len don't really need to be u64's. Xattr extent lengths should be
limited by the VFS, and then the size of our on-disk length field.

Signed-off-by: Mark Fasheh <mfasheh@xxxxxxxx>
---
fs/ocfs2/uptodate.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/ocfs2/uptodate.c b/fs/ocfs2/uptodate.c
index 5235140..187b99f 100644
--- a/fs/ocfs2/uptodate.c
+++ b/fs/ocfs2/uptodate.c
@@ -562,7 +562,7 @@ void ocfs2_remove_xattr_clusters_from_cache(struct inode *inode,
sector_t block,
u32 c_len)
{
- u64 i, b_len = ocfs2_clusters_to_blocks(inode->i_sb, 1) * c_len;
+ unsigned int i, b_len = ocfs2_clusters_to_blocks(inode->i_sb, 1) * c_len;

for (i = 0; i < b_len; i++, block++)
ocfs2_remove_block_from_cache(inode, block);
--
1.5.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/