xfs
[Top] [All Lists]

Re: [PATCH V3] reduce bmv_count in xfs_vn_fiemap

To: Eric Sandeen <sandeen@xxxxxxxxxxx>
Subject: Re: [PATCH V3] reduce bmv_count in xfs_vn_fiemap
From: Olaf Weber <olaf@xxxxxxx>
Date: Fri, 17 Jul 2009 13:46:02 +0200
Cc: xfs mailing list <xfs@xxxxxxxxxxx>
In-reply-to: <4A5F7B7B.6020903@xxxxxxxxxxx> (Eric Sandeen's message of "Thu, 16 Jul 2009 14:11:55 -0500")
References: <4A5E2F01.7030107@xxxxxxxxxxx> <bzybpnkhp62.fsf@xxxxxxxxxxxxxxxxxxxx> <4A5F3DBA.9040005@xxxxxxxxxxx> <4A5F7B7B.6020903@xxxxxxxxxxx>
User-agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4.3 (irix)
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@xxxxxxxxxxx>

Reviewed-by: Olaf Weber <olaf@xxxxxxx>

> ---

> 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@xxxxxxx

<Prev in Thread] Current Thread [Next in Thread>