* [PATCH] xfsteststs: get fsstress DIO working on non-xfs filesystems
@ 2010-01-18 20:46 Eric Sandeen
2010-01-19 1:08 ` Dave Chinner
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Eric Sandeen @ 2010-01-18 20:46 UTC (permalink / raw)
To: xfs-oss
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@sandeen.net>
---
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;
}
align = (__int64_t)diob.d_miniosz;
lr = ((__int64_t)random() << 32) + random();
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] xfsteststs: get fsstress DIO working on non-xfs filesystems
2010-01-18 20:46 [PATCH] xfsteststs: get fsstress DIO working on non-xfs filesystems Eric Sandeen
@ 2010-01-19 1:08 ` Dave Chinner
2010-01-19 9:13 ` Christoph Hellwig
2013-10-10 2:56 ` [PATCH V2] xfstests: " Eric Sandeen
2 siblings, 0 replies; 5+ messages in thread
From: Dave Chinner @ 2010-01-19 1:08 UTC (permalink / raw)
To: Eric Sandeen; +Cc: xfs-oss
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.
ioctl(fd, BLKSSZGET, ...) perhaps? And then if that fails, just hard
code it?
> hch suggested moving XFS_IOC_DIOINFO up higher in the vfs, that's
> probably a good idea in the long run.
Yeah, that makes sense to do.
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] xfsteststs: get fsstress DIO working on non-xfs filesystems
2010-01-18 20:46 [PATCH] xfsteststs: get fsstress DIO working on non-xfs filesystems Eric Sandeen
2010-01-19 1:08 ` Dave Chinner
@ 2010-01-19 9:13 ` Christoph Hellwig
2013-10-10 2:56 ` [PATCH V2] xfstests: " Eric Sandeen
2 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2010-01-19 9:13 UTC (permalink / raw)
To: Eric Sandeen; +Cc: xfs-oss
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@sandeen.net>
> ---
>
> 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;
}
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH V2] xfstests: get fsstress DIO working on non-xfs filesystems
2010-01-18 20:46 [PATCH] xfsteststs: get fsstress DIO working on non-xfs filesystems Eric Sandeen
2010-01-19 1:08 ` Dave Chinner
2010-01-19 9:13 ` Christoph Hellwig
@ 2013-10-10 2:56 ` Eric Sandeen
2013-10-10 3:20 ` Dave Chinner
2 siblings, 1 reply; 5+ messages in thread
From: Eric Sandeen @ 2013-10-10 2:56 UTC (permalink / raw)
To: xfs-oss
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, getting min IO size from
sector size if possible.
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
---
V2: factor out get_alignment, use BLKSSZGET for min DIO size
rather than guessing at 512.
diff --git a/ltp/fsstress.c b/ltp/fsstress.c
index 5d5611f..af06059 100644
--- a/ltp/fsstress.c
+++ b/ltp/fsstress.c
@@ -550,6 +550,27 @@ int main(int argc, char **argv)
return 0;
}
+/*
+ * Get alignment via XFS_IOC_DIOINFO, else fall back to
+ * best guess from BLKSSZGET, else return -1.
+ */
+static int
+get_alignment(pathname_t *f, int fd, struct dioattr *dio)
+{
+ if (xfsctl(f->path, fd, XFS_IOC_DIOINFO, dio) < 0) {
+ int sectorsize;
+
+ if (ioctl(fd, BLKSSZGET, §orsize) < 0)
+ return -1;
+
+ dio->d_maxiosz = -1U;
+ dio->d_miniosz = sectorsize;
+ dio->d_mem = sectorsize;
+ }
+
+ return 0;
+}
+
void
add_to_flist(int ft, int id, int parent)
{
@@ -1965,10 +1986,10 @@ dread_f(int opno, long r)
close(fd);
return;
}
- if (xfsctl(f.path, fd, XFS_IOC_DIOINFO, &diob) < 0) {
+ if (get_alignment(&f, fd, &diob) < 0) {
if (v)
printf(
- "%d/%d: dread - xfsctl(XFS_IOC_DIOINFO) %s%s failed %d\n",
+ "%d/%d: dread - get_alignment %s%s failed %d\n",
procid, opno, f.path, st, errno);
free_pathname(&f);
close(fd);
@@ -2037,9 +2058,9 @@ dwrite_f(int opno, long r)
return;
}
inode_info(st, sizeof(st), &stb, v);
- if (xfsctl(f.path, fd, XFS_IOC_DIOINFO, &diob) < 0) {
+ if (get_alignment(&f, fd, &diob) < 0) {
if (v)
- printf("%d/%d: dwrite - xfsctl(XFS_IOC_DIOINFO)"
+ printf("%d/%d: dwrite - get_alignment"
" %s%s failed %d\n",
procid, opno, f.path, st, errno);
free_pathname(&f);
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH V2] xfstests: get fsstress DIO working on non-xfs filesystems
2013-10-10 2:56 ` [PATCH V2] xfstests: " Eric Sandeen
@ 2013-10-10 3:20 ` Dave Chinner
0 siblings, 0 replies; 5+ messages in thread
From: Dave Chinner @ 2013-10-10 3:20 UTC (permalink / raw)
To: Eric Sandeen; +Cc: xfs-oss
On Wed, Oct 09, 2013 at 09:56:28PM -0500, 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, getting min IO size from
> sector size if possible.
>
> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
> ---
>
> V2: factor out get_alignment, use BLKSSZGET for min DIO size
> rather than guessing at 512.
>
>
> diff --git a/ltp/fsstress.c b/ltp/fsstress.c
> index 5d5611f..af06059 100644
> --- a/ltp/fsstress.c
> +++ b/ltp/fsstress.c
> @@ -550,6 +550,27 @@ int main(int argc, char **argv)
> return 0;
> }
>
> +/*
> + * Get alignment via XFS_IOC_DIOINFO, else fall back to
> + * best guess from BLKSSZGET, else return -1.
> + */
> +static int
> +get_alignment(pathname_t *f, int fd, struct dioattr *dio)
> +{
> + if (xfsctl(f->path, fd, XFS_IOC_DIOINFO, dio) < 0) {
> + int sectorsize;
> +
> + if (ioctl(fd, BLKSSZGET, §orsize) < 0)
> + return -1;
> +
> + dio->d_maxiosz = -1U;
> + dio->d_miniosz = sectorsize;
> + dio->d_mem = sectorsize;
To be safe, shouldn't we align d_mem to page size given it is the
alignment of the data within the user page, not the alignment of the
offset of the IO?
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-10-10 3:20 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-18 20:46 [PATCH] xfsteststs: get fsstress DIO working on non-xfs filesystems Eric Sandeen
2010-01-19 1:08 ` Dave Chinner
2010-01-19 9:13 ` Christoph Hellwig
2013-10-10 2:56 ` [PATCH V2] xfstests: " Eric Sandeen
2013-10-10 3:20 ` Dave Chinner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox