From: Dave Chinner <david@fromorbit.com>
To: Stefan Roesch <shr@fb.com>
Cc: fstests@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH v1 1/2] fstress: add suport for using liburing setxattr
Date: Wed, 1 Dec 2021 07:33:44 +1100 [thread overview]
Message-ID: <20211130203344.GC3447530@dread.disaster.area> (raw)
In-Reply-To: <20211129221542.2549306-2-shr@fb.com>
On Mon, Nov 29, 2021 at 02:15:41PM -0800, Stefan Roesch wrote:
> Summary:
>
> Liburing added support for setxattr. This change adds
> support for this this in fsstress when fsstress is built
> with liburing support.
>
> Signed-off-by: Stefan Roesch <shr@fb.com>
> ---
> ltp/fsstress.c | 43 ++++++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 42 insertions(+), 1 deletion(-)
>
> diff --git a/ltp/fsstress.c b/ltp/fsstress.c
> index 003e0e49..4a5c4afe 100644
> --- a/ltp/fsstress.c
> +++ b/ltp/fsstress.c
> @@ -4779,6 +4779,43 @@ setattr_f(opnum_t opno, long r)
> close(fd);
> }
>
> +static int
> +io_uring_setxattr(const char *path, const char *name, const void *value, size_t size,
> + int flags)
> +{
> + struct io_uring_sqe *sqe;
> + struct io_uring_cqe *cqe;
> + int ret;
> +
> + sqe = io_uring_get_sqe(&ring);
> + if (!sqe) {
> + printf("io_uring_get_sqe failed\n");
> + ret = -1;
> + goto out;
> + }
> +
> + io_uring_prep_setxattr(sqe, name, value, path, flags, size);
> +
> + ret = io_uring_submit_and_wait(&ring, 1);
> + if (ret != 1) {
> + printf("io_uring_submit_and_wait failed, ret=%d\n", ret);
> + ret = -1;
> + goto out;
> + }
> +
> + ret = io_uring_wait_cqe(&ring, &cqe);
> + if (ret < 0) {
> + printf("io_uring_wait_cqe failed, ret=%d\n", ret);
> + goto out;
> + }
> +
> + ret = cqe->res;
> + io_uring_cqe_seen(&ring, cqe);
> +
> +out:
> + return ret;
> +}
> +
> void
> setfattr_f(opnum_t opno, long r)
> {
> @@ -4842,7 +4879,11 @@ setfattr_f(opnum_t opno, long r)
> goto out;
> }
>
> - e = setxattr(f.path, name, value, value_len, flag) < 0 ? errno : 0;
> + if (have_io_uring)
> + e = io_uring_setxattr(f.path, name, value, value_len, flag);
> + else
> + e = setxattr(f.path, name, value, value_len, flag) < 0 ? errno : 0;
While this is technically correct, it is architecturally wrong.
This replaces testing of the existing setxattr() syscall path on
systems that have io_uring enabled (which is most modern, upstream
test instances). That's a significant regression in test coverage,
especially given that most applications using xattrs do not use
io_uring...
The io_uring functionality should be added in the same way that
OP_URING_READ/OP_URING_WRITE were added. That is, new
operations were added in addition to the existing syscall based
OP_READ/OP_WRITE, OP_READV/OP_WRITEV and the AIO based versions
OP_AREAD/OP_AWRITE.
This way fsstress adds the io_uring mechanisms in addition to all
the normal syscall methods it already uses rather than replacing
them. This also allow io_uring operations to race with existing
syscall operations running the same operations on the same files
concurrently...
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2021-11-30 20:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-29 22:15 [PATCH v1 0/2] Add support for using liburing xattr Stefan Roesch
2021-11-29 22:15 ` [PATCH v1 1/2] fstress: add suport for using liburing setxattr Stefan Roesch
2021-11-30 20:33 ` Dave Chinner [this message]
2021-12-01 5:54 ` Stefan Roesch
2021-11-29 22:15 ` [PATCH v1 2/2] fstress: add suport for using liburing getxattr Stefan Roesch
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=20211130203344.GC3447530@dread.disaster.area \
--to=david@fromorbit.com \
--cc=fstests@vger.kernel.org \
--cc=kernel-team@fb.com \
--cc=shr@fb.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