From: Tao Ma <tao.ma@oracle.com>
To: linux-kernel@vger.kernel.org
Cc: Tao Ma <tao.ma@oracle.com>,
xfs@oss.sgi.com, Christoph Hellwig <hch@lst.de>,
Eric Sandeen <sandeen@redhat.com>, Alex Elder <aelder@sgi.com>
Subject: [PATCH v3] XFS: Let the broken fiemap work in query mode.
Date: Wed, 28 Apr 2010 22:39:09 +0800 [thread overview]
Message-ID: <1272465549-6503-1-git-send-email-tao.ma@oracle.com> (raw)
In-Reply-To: <20100428113359.GB27769@infradead.org>
> On Wed, Apr 28, 2010 at 11:00:25AM +0800, Tao Ma wrote:
>> - bm.bmv_count = fieinfo->fi_extents_max + 1;
>> + bm.bmv_count = !fieinfo->fi_extents_max ? MAXEXTNUM :
>> + fieinfo->fi_extents_max + 1;
>> + bm.bmv_count = MIN(bm.bmv_count,
>> + (__s32)(PAGE_SIZE * 16 / sizeof(struct getbmapx)));
>
> I would use min_t here instead of the case, but otherwise the patch
> looks good to me
>
>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
Ok, here comes the v3. Thanks for the review.
Regards,
Tao
>From c735bccfbb925841545dcb1853fa8ffb3f3c8785 Mon Sep 17 00:00:00 2001
From: Tao Ma <tao.ma@oracle.com>
Date: Wed, 28 Apr 2010 21:57:32 +0800
Subject: [PATCH v3] XFS: Let the broken fiemap work in query mode.
According to Documentation/filesystems/fiemap.txt, If fm_extent_count
is zero, then the fm_extents[] array is ignored (no extents will be
returned), and the fm_mapped_extents count will hold the number of
extents needed.
But as the commit 97db39a1f6f69e906e98118392400de5217aa33a has changed
bmv_count to the caller's input buffer, this number query function can't
work any more. As this commit is written to change bmv_count from
MAXEXTNUM because of ENOMEM.
This patch just try to set bm.bmv.count to something sane.
Thanks to Dave Chinner <david@fromorbit.com> for the suggestion.
Cc: Eric Sandeen <sandeen@redhat.com>
Cc: Alex Elder <aelder@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Tao Ma <tao.ma@oracle.com>
---
fs/xfs/linux-2.6/xfs_iops.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c
index 2259460..68531fc 100644
--- a/fs/xfs/linux-2.6/xfs_iops.c
+++ b/fs/xfs/linux-2.6/xfs_iops.c
@@ -662,7 +662,10 @@ xfs_vn_fiemap(
bm.bmv_length = BTOBB(length);
/* We add one because in getbmap world count includes the header */
- bm.bmv_count = fieinfo->fi_extents_max + 1;
+ bm.bmv_count = !fieinfo->fi_extents_max ? MAXEXTNUM :
+ fieinfo->fi_extents_max + 1;
+ bm.bmv_count = min_t(__s32, bm.bmv_count,
+ (PAGE_SIZE * 16 / sizeof(struct getbmapx)));
bm.bmv_iflags = BMV_IF_PREALLOC;
if (fieinfo->fi_flags & FIEMAP_FLAG_XATTR)
bm.bmv_iflags |= BMV_IF_ATTRFORK;
--
1.6.3.3.334.g916e1.dirty
prev parent reply other threads:[~2010-04-28 14:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-27 6:17 [PATCH] " Tao Ma
2010-04-28 1:50 ` Dave Chinner
2010-04-28 2:00 ` Tao Ma
2010-04-28 2:30 ` Dave Chinner
2010-04-28 3:00 ` [PATCH v2] " Tao Ma
2010-04-28 11:33 ` Christoph Hellwig
2010-04-28 14:39 ` Tao Ma [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1272465549-6503-1-git-send-email-tao.ma@oracle.com \
--to=tao.ma@oracle.com \
--cc=aelder@sgi.com \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=sandeen@redhat.com \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®