* [PATCH] reduce bmv_count in xfs_vn_fiemap
@ 2009-07-15 19:33 Eric Sandeen
2009-07-16 10:56 ` Olaf Weber
0 siblings, 1 reply; 10+ messages in thread
From: Eric Sandeen @ 2009-07-15 19:33 UTC (permalink / raw)
To: xfs mailing list
commit 6321e3ed2acf3ee9643cdd403e1c88605d7944ba caused
the full bmv_count's worth of getbmapx structures to get
allocated; telling it to do MAXEXTNUM was a bit insane,
resulting in ENOMEM.
Chop it down to something reasonable, the caller can
loop over this if the file has > 64 extents.
(this is a regression, FWIW)
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
---
iff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c
index 58973bb..370e9a7 100644
--- a/fs/xfs/linux-2.6/xfs_iops.c
+++ b/fs/xfs/linux-2.6/xfs_iops.c
@@ -680,8 +680,12 @@ xfs_vn_fiemap(
else
bm.bmv_length = BTOBB(length);
- /* our formatter will tell xfs_getbmap when to stop. */
- bm.bmv_count = MAXEXTNUM;
+ /*
+ * xfs_getbmap allocates based on that; pick a count that's
+ * not too outragous.
+ * Our formatter will tell xfs_getbmap when to stop.
+ */
+ bm.bmv_count = 64;
bm.bmv_iflags = BMV_IF_PREALLOC;
if (fieinfo->fi_flags & FIEMAP_FLAG_XATTR)
bm.bmv_iflags |= BMV_IF_ATTRFORK;
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] reduce bmv_count in xfs_vn_fiemap
2009-07-15 19:33 [PATCH] reduce bmv_count in xfs_vn_fiemap Eric Sandeen
@ 2009-07-16 10:56 ` Olaf Weber
2009-07-16 14:19 ` Eric Sandeen
2009-07-16 14:48 ` [PATCH V2] " Eric Sandeen
0 siblings, 2 replies; 10+ messages in thread
From: Olaf Weber @ 2009-07-16 10:56 UTC (permalink / raw)
To: Eric Sandeen; +Cc: xfs mailing list
Eric Sandeen writes:
> commit 6321e3ed2acf3ee9643cdd403e1c88605d7944ba caused
> the full bmv_count's worth of getbmapx structures to get
> allocated; telling it to do MAXEXTNUM was a bit insane,
> resulting in ENOMEM.
> Chop it down to something reasonable, the caller can
> loop over this if the file has > 64 extents.
It does seem to me that this will result in an unusal case for the
caller, in that it will get fewer extents than fit in the provided
buffer, yet should loop. Do current callers know that they can hit
this case, detect it, and loop accordingly? Or is this just pushing
the problem/regression to userspace?
> (this is a regression, FWIW)
> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
> ---
> iff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c
> index 58973bb..370e9a7 100644
> --- a/fs/xfs/linux-2.6/xfs_iops.c
> +++ b/fs/xfs/linux-2.6/xfs_iops.c
> @@ -680,8 +680,12 @@ xfs_vn_fiemap(
> else
> bm.bmv_length = BTOBB(length);
> - /* our formatter will tell xfs_getbmap when to stop. */
> - bm.bmv_count = MAXEXTNUM;
> + /*
> + * xfs_getbmap allocates based on that; pick a count that's
> + * not too outragous.
> + * Our formatter will tell xfs_getbmap when to stop.
> + */
> + bm.bmv_count = 64;
> bm.bmv_iflags = BMV_IF_PREALLOC;
> if (fieinfo->fi_flags & FIEMAP_FLAG_XATTR)
> bm.bmv_iflags |= BMV_IF_ATTRFORK;
--
Olaf Weber SGI Phone: +31(0)30-6696752
Veldzigt 2b Fax: +31(0)30-6696799
Technical Lead 3454 PW de Meern Vnet: 955-7151
Storage Software The Netherlands Email: olaf@sgi.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] reduce bmv_count in xfs_vn_fiemap
2009-07-16 10:56 ` Olaf Weber
@ 2009-07-16 14:19 ` Eric Sandeen
2009-07-16 14:48 ` [PATCH V2] " Eric Sandeen
1 sibling, 0 replies; 10+ messages in thread
From: Eric Sandeen @ 2009-07-16 14:19 UTC (permalink / raw)
To: Olaf Weber; +Cc: xfs mailing list
Olaf Weber wrote:
> Eric Sandeen writes:
>
>> commit 6321e3ed2acf3ee9643cdd403e1c88605d7944ba caused
>> the full bmv_count's worth of getbmapx structures to get
>> allocated; telling it to do MAXEXTNUM was a bit insane,
>> resulting in ENOMEM.
>
>> Chop it down to something reasonable, the caller can
>> loop over this if the file has > 64 extents.
>
> It does seem to me that this will result in an unusal case for the
> caller, in that it will get fewer extents than fit in the provided
> buffer, yet should loop. Do current callers know that they can hit
> this case, detect it, and loop accordingly? Or is this just pushing
> the problem/regression to userspace?
Well, userspace just keeps calling until it gets FIEMAP_LAST in the
flags. But yeah, I forgot that we were given the nr of user extents,
I'll send a better V2.
-Eric
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH V2] reduce bmv_count in xfs_vn_fiemap
2009-07-16 10:56 ` Olaf Weber
2009-07-16 14:19 ` Eric Sandeen
@ 2009-07-16 14:48 ` Eric Sandeen
2009-07-16 15:18 ` Olaf Weber
2009-07-16 19:11 ` [PATCH V3] " Eric Sandeen
1 sibling, 2 replies; 10+ messages in thread
From: Eric Sandeen @ 2009-07-16 14:48 UTC (permalink / raw)
To: Olaf Weber; +Cc: xfs mailing list
commit 6321e3ed2acf3ee9643cdd403e1c88605d7944ba caused
the full bmv_count's worth of getbmapx structures to get
allocated; telling it to do MAXEXTNUM was a bit insane,
resulting in ENOMEM every time.
Chop it down to something reasonable, the number of slots
in the caller's input buffer. If this is too large the
caller may get ENOMEM but the reason should not be a
mystery, and they can try again with something smaller.
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
---
V2: set it to the fiemap info's fi_extents_max
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c
index 58973bb..954d701 100644
--- a/fs/xfs/linux-2.6/xfs_iops.c
+++ b/fs/xfs/linux-2.6/xfs_iops.c
@@ -680,8 +680,7 @@ xfs_vn_fiemap(
else
bm.bmv_length = BTOBB(length);
- /* our formatter will tell xfs_getbmap when to stop. */
- bm.bmv_count = MAXEXTNUM;
+ bm.bmv_count = fieinfo->fi_extents_max;
bm.bmv_iflags = BMV_IF_PREALLOC;
if (fieinfo->fi_flags & FIEMAP_FLAG_XATTR)
bm.bmv_iflags |= BMV_IF_ATTRFORK;
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH V2] reduce bmv_count in xfs_vn_fiemap
2009-07-16 14:48 ` [PATCH V2] " Eric Sandeen
@ 2009-07-16 15:18 ` Olaf Weber
2009-07-16 19:11 ` [PATCH V3] " Eric Sandeen
1 sibling, 0 replies; 10+ messages in thread
From: Olaf Weber @ 2009-07-16 15:18 UTC (permalink / raw)
To: Eric Sandeen; +Cc: xfs mailing list
Eric Sandeen writes:
> commit 6321e3ed2acf3ee9643cdd403e1c88605d7944ba caused
> the full bmv_count's worth of getbmapx structures to get
> allocated; telling it to do MAXEXTNUM was a bit insane,
> resulting in ENOMEM every time.
> Chop it down to something reasonable, the number of slots
> in the caller's input buffer. If this is too large the
> caller may get ENOMEM but the reason should not be a
> mystery, and they can try again with something smaller.
This version looks a lot better. Thanks.
> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Reviewed-By: Olaf Weber <olaf@sgi.com>
> ---
> V2: set it to the fiemap info's fi_extents_max
> diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c
> index 58973bb..954d701 100644
> --- a/fs/xfs/linux-2.6/xfs_iops.c
> +++ b/fs/xfs/linux-2.6/xfs_iops.c
> @@ -680,8 +680,7 @@ xfs_vn_fiemap(
> else
> bm.bmv_length = BTOBB(length);
> - /* our formatter will tell xfs_getbmap when to stop. */
> - bm.bmv_count = MAXEXTNUM;
> + bm.bmv_count = fieinfo->fi_extents_max;
> bm.bmv_iflags = BMV_IF_PREALLOC;
> if (fieinfo->fi_flags & FIEMAP_FLAG_XATTR)
> bm.bmv_iflags |= BMV_IF_ATTRFORK;
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
--
Olaf Weber SGI Phone: +31(0)30-6696752
Veldzigt 2b Fax: +31(0)30-6696799
Technical Lead 3454 PW de Meern Vnet: 955-7151
Storage Software The Netherlands Email: olaf@sgi.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH V3] reduce bmv_count in xfs_vn_fiemap
2009-07-16 14:48 ` [PATCH V2] " Eric Sandeen
2009-07-16 15:18 ` Olaf Weber
@ 2009-07-16 19:11 ` Eric Sandeen
2009-07-17 11:46 ` Olaf Weber
` (2 more replies)
1 sibling, 3 replies; 10+ messages in thread
From: Eric Sandeen @ 2009-07-16 19:11 UTC (permalink / raw)
To: Olaf Weber; +Cc: xfs mailing list
commit 6321e3ed2acf3ee9643cdd403e1c88605d7944ba caused
the full bmv_count's worth of getbmapx structures to get
allocated; telling it to do MAXEXTNUM was a bit insane,
resulting in ENOMEM every time.
Chop it down to something reasonable, the number of slots
in the caller's input buffer. If this is too large the
caller may get ENOMEM but the reason should not be a
mystery, and they can try again with something smaller.
We add 1 to the value because in the normal getbmap
world, bmv_count includes the header and xfs_getbmap does:
nex = bmv->bmv_count - 1;
if (nex <= 0)
return XFS_ERROR(EINVAL);
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
---
V2: set it to the fiemap info's fi_extents_max
V3: bump up by one to accomodate expected bmv header in core
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c
index 58973bb..954d701 100644
--- a/fs/xfs/linux-2.6/xfs_iops.c
+++ b/fs/xfs/linux-2.6/xfs_iops.c
@@ -680,8 +680,7 @@ xfs_vn_fiemap(
else
bm.bmv_length = BTOBB(length);
- /* our formatter will tell xfs_getbmap when to stop. */
- bm.bmv_count = MAXEXTNUM;
+ bm.bmv_count = fieinfo->fi_extents_max + 1;
bm.bmv_iflags = BMV_IF_PREALLOC;
if (fieinfo->fi_flags & FIEMAP_FLAG_XATTR)
bm.bmv_iflags |= BMV_IF_ATTRFORK;
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH V3] reduce bmv_count in xfs_vn_fiemap
2009-07-16 19:11 ` [PATCH V3] " Eric Sandeen
@ 2009-07-17 11:46 ` Olaf Weber
2009-07-18 14:25 ` Christoph Hellwig
2009-07-27 2:52 ` [PATCH V4] " Eric Sandeen
2 siblings, 0 replies; 10+ messages in thread
From: Olaf Weber @ 2009-07-17 11:46 UTC (permalink / raw)
To: Eric Sandeen; +Cc: xfs mailing list
Eric Sandeen writes:
> commit 6321e3ed2acf3ee9643cdd403e1c88605d7944ba caused
> the full bmv_count's worth of getbmapx structures to get
> allocated; telling it to do MAXEXTNUM was a bit insane,
> resulting in ENOMEM every time.
> Chop it down to something reasonable, the number of slots
> in the caller's input buffer. If this is too large the
> caller may get ENOMEM but the reason should not be a
> mystery, and they can try again with something smaller.
> We add 1 to the value because in the normal getbmap
> world, bmv_count includes the header and xfs_getbmap does:
> nex = bmv->bmv_count - 1;
> if (nex <= 0)
> return XFS_ERROR(EINVAL);
> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Reviewed-by: Olaf Weber <olaf@sgi.com>
> ---
> V2: set it to the fiemap info's fi_extents_max
> V3: bump up by one to accomodate expected bmv header in core
> diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c
> index 58973bb..954d701 100644
> --- a/fs/xfs/linux-2.6/xfs_iops.c
> +++ b/fs/xfs/linux-2.6/xfs_iops.c
> @@ -680,8 +680,7 @@ xfs_vn_fiemap(
> else
> bm.bmv_length = BTOBB(length);
> - /* our formatter will tell xfs_getbmap when to stop. */
> - bm.bmv_count = MAXEXTNUM;
> + bm.bmv_count = fieinfo->fi_extents_max + 1;
> bm.bmv_iflags = BMV_IF_PREALLOC;
> if (fieinfo->fi_flags & FIEMAP_FLAG_XATTR)
> bm.bmv_iflags |= BMV_IF_ATTRFORK;
--
Olaf Weber SGI Phone: +31(0)30-6696752
Veldzigt 2b Fax: +31(0)30-6696799
Technical Lead 3454 PW de Meern Vnet: 955-7151
Storage Software The Netherlands Email: olaf@sgi.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH V3] reduce bmv_count in xfs_vn_fiemap
2009-07-16 19:11 ` [PATCH V3] " Eric Sandeen
2009-07-17 11:46 ` Olaf Weber
@ 2009-07-18 14:25 ` Christoph Hellwig
2009-07-27 2:52 ` [PATCH V4] " Eric Sandeen
2 siblings, 0 replies; 10+ messages in thread
From: Christoph Hellwig @ 2009-07-18 14:25 UTC (permalink / raw)
To: Eric Sandeen; +Cc: Olaf Weber, xfs mailing list
On Thu, Jul 16, 2009 at 02:11:55PM -0500, Eric Sandeen wrote:
> V3: bump up by one to accomodate expected bmv header in core
That is probably woth a comment next to setting it in the code.
Otherwise looks good to me, and thanks for the fiemap tests so that
we get test coverage for this.
Reviewed-by: Christoph Hellwig <hch@lst.de>
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH V4] reduce bmv_count in xfs_vn_fiemap
2009-07-16 19:11 ` [PATCH V3] " Eric Sandeen
2009-07-17 11:46 ` Olaf Weber
2009-07-18 14:25 ` Christoph Hellwig
@ 2009-07-27 2:52 ` Eric Sandeen
2009-07-27 7:55 ` Olaf Weber
2 siblings, 1 reply; 10+ messages in thread
From: Eric Sandeen @ 2009-07-27 2:52 UTC (permalink / raw)
To: Olaf Weber; +Cc: xfs mailing list
commit 6321e3ed2acf3ee9643cdd403e1c88605d7944ba caused
the full bmv_count's worth of getbmapx structures to get
allocated; telling it to do MAXEXTNUM was a bit insane,
resulting in ENOMEM every time.
Chop it down to something reasonable, the number of slots
in the caller's input buffer. If this is too large the
caller may get ENOMEM but the reason should not be a
mystery, and they can try again with something smaller.
We add 1 to the value because in the normal getbmap
world, bmv_count includes the header and xfs_getbmap does:
nex = bmv->bmv_count - 1;
if (nex <= 0)
return XFS_ERROR(EINVAL);
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
---
V2: set it to the fiemap info's fi_extents_max
V3: bump up by one to accomodate expected bmv header in core
V4: comments
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c
index 58973bb..8070b34 100644
--- a/fs/xfs/linux-2.6/xfs_iops.c
+++ b/fs/xfs/linux-2.6/xfs_iops.c
@@ -680,8 +680,8 @@ xfs_vn_fiemap(
else
bm.bmv_length = BTOBB(length);
- /* our formatter will tell xfs_getbmap when to stop. */
- bm.bmv_count = MAXEXTNUM;
+ /* We add one because in getbmap world count includes the header */
+ bm.bmv_count = fieinfo->fi_extents_max + 1;
bm.bmv_iflags = BMV_IF_PREALLOC;
if (fieinfo->fi_flags & FIEMAP_FLAG_XATTR)
bm.bmv_iflags |= BMV_IF_ATTRFORK;
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH V4] reduce bmv_count in xfs_vn_fiemap
2009-07-27 2:52 ` [PATCH V4] " Eric Sandeen
@ 2009-07-27 7:55 ` Olaf Weber
0 siblings, 0 replies; 10+ messages in thread
From: Olaf Weber @ 2009-07-27 7:55 UTC (permalink / raw)
To: Eric Sandeen; +Cc: xfs mailing list
Eric Sandeen writes:
> commit 6321e3ed2acf3ee9643cdd403e1c88605d7944ba caused
> the full bmv_count's worth of getbmapx structures to get
> allocated; telling it to do MAXEXTNUM was a bit insane,
> resulting in ENOMEM every time.
> Chop it down to something reasonable, the number of slots
> in the caller's input buffer. If this is too large the
> caller may get ENOMEM but the reason should not be a
> mystery, and they can try again with something smaller.
> We add 1 to the value because in the normal getbmap
> world, bmv_count includes the header and xfs_getbmap does:
> nex = bmv->bmv_count - 1;
> if (nex <= 0)
> return XFS_ERROR(EINVAL);
> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Reviewed-By: Olaf Weber <olaf@sgi.com>
Thanks,
Olaf
--
Olaf Weber SGI Phone: +31(0)30-6696752
Veldzigt 2b Fax: +31(0)30-6696799
Technical Lead 3454 PW de Meern Vnet: 955-7151
Storage Software The Netherlands Email: olaf@sgi.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2009-07-27 7:55 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-15 19:33 [PATCH] reduce bmv_count in xfs_vn_fiemap Eric Sandeen
2009-07-16 10:56 ` Olaf Weber
2009-07-16 14:19 ` Eric Sandeen
2009-07-16 14:48 ` [PATCH V2] " Eric Sandeen
2009-07-16 15:18 ` Olaf Weber
2009-07-16 19:11 ` [PATCH V3] " Eric Sandeen
2009-07-17 11:46 ` Olaf Weber
2009-07-18 14:25 ` Christoph Hellwig
2009-07-27 2:52 ` [PATCH V4] " Eric Sandeen
2009-07-27 7:55 ` Olaf Weber
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox