xfs
[Top] [All Lists]

Re: [PATCH] xfsteststs: get fsstress DIO working on non-xfs filesystems

To: Eric Sandeen <sandeen@xxxxxxxxxxx>
Subject: Re: [PATCH] xfsteststs: get fsstress DIO working on non-xfs filesystems
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Tue, 19 Jan 2010 04:13:16 -0500
Cc: xfs-oss <xfs@xxxxxxxxxxx>
In-reply-to: <4B54C8AB.6080607@xxxxxxxxxxx>
References: <4B54C8AB.6080607@xxxxxxxxxxx>
User-agent: Mutt/1.5.19 (2009-01-05)
On Mon, Jan 18, 2010 at 02:46:35PM -0600, Eric Sandeen wrote:
> Pretty sure all DIO IO fails in fsstress today since XFS_IOC_DIOINFO
> fails.  If so, rather than just bailing out on the op, assign
> some sane default DIO parameters.
> 
> This falls down for 4k sector devices but not really sure how to get
> the underlying sector size easily from here; I think we can live
> with this for now.
> 
> hch suggested moving XFS_IOC_DIOINFO up higher in the vfs, that's
> probably a good idea in the long run.
> 
> Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxxx>
> ---
> 
> diff --git a/ltp/fsstress.c b/ltp/fsstress.c
> index 6978381..dab6bf7 100644
> --- a/ltp/fsstress.c
> +++ b/ltp/fsstress.c
> @@ -1818,9 +1818,9 @@ dread_f(int opno, long r)
>                       printf(
>                       "%d/%d: dread - xfsctl(XFS_IOC_DIOINFO) %s failed %d\n",
>                               procid, opno, f.path, errno);
> -             free_pathname(&f);
> -             close(fd);
> -             return;
> +             diob.d_maxiosz = -1U;
> +             diob.d_miniosz = 512;
> +             diob.d_mem = 512;
>       }
>       align = (__int64_t)diob.d_miniosz;
>       lr = ((__int64_t)random() << 32) + random();
> @@ -1888,9 +1888,9 @@ dwrite_f(int opno, long r)
>                       printf("%d/%d: dwrite - xfsctl(XFS_IOC_DIOINFO)"
>                               " %s failed %d\n",
>                               procid, opno, f.path, errno);
> -             free_pathname(&f);
> -             close(fd);
> -             return;
> +             diob.d_maxiosz = -1U;
> +             diob.d_miniosz = 512;
> +             diob.d_mem = 512;

Can you factor out the alignment bits into a small helper and use it
in both places?


static void get_alignment(pathname_t *f, int fd, struct dioattr *dio)
{
        if (xfsctl(f->path, fd, XFS_IOC_DIOINFO, dio) < 0) {
                if (v)
                        printf(...);

                /* use fallback values if the query fails. */
                diob.d_maxiosz = -1U;
                diob.d_miniosz = 512;
                diob.d_mem = 512;
}

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