* [PATCH v1 0/2] Add support for using liburing xattr
@ 2021-11-29 22:15 Stefan Roesch
2021-11-29 22:15 ` [PATCH v1 1/2] fstress: add suport for using liburing setxattr Stefan Roesch
2021-11-29 22:15 ` [PATCH v1 2/2] fstress: add suport for using liburing getxattr Stefan Roesch
0 siblings, 2 replies; 5+ messages in thread
From: Stefan Roesch @ 2021-11-29 22:15 UTC (permalink / raw)
To: fstests, kernel-team; +Cc: shr
This adds support for using the xattr implementation in liburing.
Patch 1: fstress: add suport for using liburing setxattr
Uses the liburing setxattr implementation in fsstress.
Patch 2: fstress: add suport for using liburing getxattr
Uses the liburing getxattr implementation in fsstress.
There are two additional patch series related to this:
- io_uring: add xattr support
- liburing: add xattr support
Stefan Roesch (2):
fstress: add suport for using liburing setxattr
fstress: add suport for using liburing getxattr
ltp/fsstress.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 88 insertions(+), 3 deletions(-)
Signed-off-by: Stefan Roesch <shr@fb.com>
base-commit: 2050356437e3576673ec5ead79ad72eb619f0d72
--
2.30.2
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v1 1/2] fstress: add suport for using liburing setxattr
2021-11-29 22:15 [PATCH v1 0/2] Add support for using liburing xattr Stefan Roesch
@ 2021-11-29 22:15 ` Stefan Roesch
2021-11-30 20:33 ` Dave Chinner
2021-11-29 22:15 ` [PATCH v1 2/2] fstress: add suport for using liburing getxattr Stefan Roesch
1 sibling, 1 reply; 5+ messages in thread
From: Stefan Roesch @ 2021-11-29 22:15 UTC (permalink / raw)
To: fstests, kernel-team; +Cc: shr
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;
+
if (e == 0)
fep->xattr_counter++;
if (v)
--
2.30.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v1 2/2] fstress: add suport for using liburing getxattr
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-29 22:15 ` Stefan Roesch
1 sibling, 0 replies; 5+ messages in thread
From: Stefan Roesch @ 2021-11-29 22:15 UTC (permalink / raw)
To: fstests, kernel-team; +Cc: shr
Summary:
Liburing added support for getxattr. 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 | 48 ++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 46 insertions(+), 2 deletions(-)
diff --git a/ltp/fsstress.c b/ltp/fsstress.c
index 4a5c4afe..df7820d6 100644
--- a/ltp/fsstress.c
+++ b/ltp/fsstress.c
@@ -3895,6 +3895,42 @@ getdents_f(opnum_t opno, long r)
closedir(dir);
}
+static int
+io_uring_getxattr(const char *path, const char *name, void *value, size_t size)
+{
+ 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_getxattr(sqe, name, value, path, 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
getfattr_f(opnum_t opno, long r)
{
@@ -3932,7 +3968,11 @@ getfattr_f(opnum_t opno, long r)
goto out;
}
- value_len = getxattr(f.path, name, NULL, 0);
+ if (have_io_uring)
+ value_len = io_uring_getxattr(f.path, name, NULL, 0);
+ else
+ value_len = getxattr(f.path, name, NULL, 0);
+
if (value_len < 0) {
if (v)
printf("%d/%lld: getfattr file %s name %s failed %d\n",
@@ -3954,7 +3994,11 @@ getfattr_f(opnum_t opno, long r)
goto out;
}
- e = getxattr(f.path, name, value, value_len) < 0 ? errno : 0;
+ if (have_io_uring)
+ e = io_uring_getxattr(f.path, name, value, value_len);
+ else
+ e = getxattr(f.path, name, value, value_len) < 0 ? errno : 0;
+
out_log:
if (v)
printf("%d/%lld: getfattr file %s name %s value length %d %d\n",
--
2.30.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v1 1/2] fstress: add suport for using liburing setxattr
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
2021-12-01 5:54 ` Stefan Roesch
0 siblings, 1 reply; 5+ messages in thread
From: Dave Chinner @ 2021-11-30 20:33 UTC (permalink / raw)
To: Stefan Roesch; +Cc: fstests, kernel-team
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1 1/2] fstress: add suport for using liburing setxattr
2021-11-30 20:33 ` Dave Chinner
@ 2021-12-01 5:54 ` Stefan Roesch
0 siblings, 0 replies; 5+ messages in thread
From: Stefan Roesch @ 2021-12-01 5:54 UTC (permalink / raw)
To: Dave Chinner; +Cc: fstests, kernel-team
On 11/30/21 12:33 PM, Dave Chinner wrote:
> 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...
>
Dave, thanks for the review. I sent out an updated version (v2) of the patch series
that implements the changes as dedicated operations where the user can select what
type of operation is preferred.
> Cheers,
>
> Dave.
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-12-01 5:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).