* [PATCH v4 0/2] Add support for using liburing xattr
@ 2021-12-16 18:43 Stefan Roesch
2021-12-16 18:43 ` [PATCH v4 1/2] fstress: add suport for using liburing setxattr Stefan Roesch
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Stefan Roesch @ 2021-12-16 18:43 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
---
V4: - fix a whitespace/tab issue
V3: - Rebased patch series.
V2: - Introduce dedicated functions for uring getxattr and
uring setxattr, so they are not automatically linked
in if liburing is available.
*** BLURB HERE ***
Stefan Roesch (2):
fstress: add suport for using liburing setxattr
fstress: add suport for using liburing getxattr
ltp/fsstress.c | 122 ++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 116 insertions(+), 6 deletions(-)
base-commit: 13dd19cee4298ffc323737029ca36f70f52f88e9
--
2.30.2
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v4 1/2] fstress: add suport for using liburing setxattr
2021-12-16 18:43 [PATCH v4 0/2] Add support for using liburing xattr Stefan Roesch
@ 2021-12-16 18:43 ` Stefan Roesch
2021-12-19 16:02 ` Eryu Guan
2021-12-16 18:43 ` [PATCH v4 2/2] fstress: add suport for using liburing getxattr Stefan Roesch
2021-12-17 4:20 ` [PATCH v4 0/2] Add support for using liburing xattr Zorro Lang
2 siblings, 1 reply; 5+ messages in thread
From: Stefan Roesch @ 2021-12-16 18:43 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 | 59 ++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 57 insertions(+), 2 deletions(-)
diff --git a/ltp/fsstress.c b/ltp/fsstress.c
index 5f3126e6..48d93436 100644
--- a/ltp/fsstress.c
+++ b/ltp/fsstress.c
@@ -145,12 +145,14 @@ typedef enum {
OP_URING_WRITE,
OP_WRITE,
OP_WRITEV,
+ OP_URING_SETXATTR,
OP_LAST
} opty_t;
typedef long long opnum_t;
typedef void (*opfnc_t)(opnum_t, long);
+typedef int (*setxattr_cbk)(const char *, const char *, const void *, size_t, int);
typedef struct opdesc {
char *name;
@@ -276,6 +278,7 @@ void uring_read_f(opnum_t, long);
void uring_write_f(opnum_t, long);
void write_f(opnum_t, long);
void writev_f(opnum_t, long);
+void uring_setxattr_f(opnum_t, long);
char *xattr_flag_to_string(int);
struct opdesc ops[OP_LAST] = {
@@ -346,6 +349,7 @@ struct opdesc ops[OP_LAST] = {
[OP_URING_WRITE] = {"uring_write", uring_write_f, 1, 1 },
[OP_WRITE] = {"write", write_f, 4, 1 },
[OP_WRITEV] = {"writev", writev_f, 4, 1 },
+ [OP_URING_SETXATTR] = {"uring_setxattr", uring_setxattr_f, 1, 1 },
}, *ops_end;
flist_t flist[FT_nft] = {
@@ -4771,8 +4775,45 @@ 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)
+setfattr_f_cbk(opnum_t opno, long r, setxattr_cbk cbk)
{
int e;
pathname_t f;
@@ -4834,7 +4875,7 @@ setfattr_f(opnum_t opno, long r)
goto out;
}
- e = setxattr(f.path, name, value, value_len, flag) < 0 ? errno : 0;
+ e = cbk(f.path, name, value, value_len, flag) < 0 ? errno : 0;
if (e == 0)
fep->xattr_counter++;
if (v)
@@ -4846,6 +4887,20 @@ out:
free_pathname(&f);
}
+void
+uring_setxattr_f(opnum_t opno, long r)
+{
+#ifdef URING
+ setfattr_f_cbk(opno, r, io_uring_setxattr);
+#endif
+}
+
+void
+setfattr_f(opnum_t opno, long r)
+{
+ setfattr_f_cbk(opno, r, setxattr);
+}
+
void
snapshot_f(opnum_t opno, long r)
{
--
2.30.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v4 2/2] fstress: add suport for using liburing getxattr
2021-12-16 18:43 [PATCH v4 0/2] Add support for using liburing xattr Stefan Roesch
2021-12-16 18:43 ` [PATCH v4 1/2] fstress: add suport for using liburing setxattr Stefan Roesch
@ 2021-12-16 18:43 ` Stefan Roesch
2021-12-17 4:20 ` [PATCH v4 0/2] Add support for using liburing xattr Zorro Lang
2 siblings, 0 replies; 5+ messages in thread
From: Stefan Roesch @ 2021-12-16 18:43 UTC (permalink / raw)
To: fstests, kernel-team; +Cc: shr
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 | 63 ++++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 59 insertions(+), 4 deletions(-)
diff --git a/ltp/fsstress.c b/ltp/fsstress.c
index 48d93436..27bff605 100644
--- a/ltp/fsstress.c
+++ b/ltp/fsstress.c
@@ -145,6 +145,7 @@ typedef enum {
OP_URING_WRITE,
OP_WRITE,
OP_WRITEV,
+ OP_URING_GETXATTR,
OP_URING_SETXATTR,
OP_LAST
} opty_t;
@@ -152,6 +153,7 @@ typedef enum {
typedef long long opnum_t;
typedef void (*opfnc_t)(opnum_t, long);
+typedef ssize_t (*getxattr_cbk)(const char *, const char *, void *, size_t);
typedef int (*setxattr_cbk)(const char *, const char *, const void *, size_t, int);
typedef struct opdesc {
@@ -278,6 +280,7 @@ void uring_read_f(opnum_t, long);
void uring_write_f(opnum_t, long);
void write_f(opnum_t, long);
void writev_f(opnum_t, long);
+void uring_getxattr_f(opnum_t, long);
void uring_setxattr_f(opnum_t, long);
char *xattr_flag_to_string(int);
@@ -349,6 +352,7 @@ struct opdesc ops[OP_LAST] = {
[OP_URING_WRITE] = {"uring_write", uring_write_f, 1, 1 },
[OP_WRITE] = {"write", write_f, 4, 1 },
[OP_WRITEV] = {"writev", writev_f, 4, 1 },
+ [OP_URING_GETXATTR] = {"uring_getxattr", uring_getxattr_f, 1, 0 },
[OP_URING_SETXATTR] = {"uring_setxattr", uring_setxattr_f, 1, 1 },
}, *ops_end;
@@ -3891,8 +3895,44 @@ getdents_f(opnum_t opno, long r)
closedir(dir);
}
-void
-getfattr_f(opnum_t opno, long r)
+static ssize_t
+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;
+}
+
+static void
+getfattr_f_cbk(opnum_t opno, long r, getxattr_cbk cbk)
{
fent_t *fep;
int e;
@@ -3928,7 +3968,7 @@ getfattr_f(opnum_t opno, long r)
goto out;
}
- value_len = getxattr(f.path, name, NULL, 0);
+ value_len = cbk(f.path, name, NULL, 0);
if (value_len < 0) {
if (v)
printf("%d/%lld: getfattr file %s name %s failed %d\n",
@@ -3950,7 +3990,8 @@ getfattr_f(opnum_t opno, long r)
goto out;
}
- e = getxattr(f.path, name, value, value_len) < 0 ? errno : 0;
+ e = cbk(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",
@@ -3960,6 +4001,20 @@ out:
free_pathname(&f);
}
+void
+uring_getxattr_f(opnum_t opno, long r)
+{
+#ifdef URING
+ getfattr_f_cbk(opno, r, io_uring_getxattr);
+#endif
+}
+
+void
+getfattr_f(opnum_t opno, long r)
+{
+ getfattr_f_cbk(opno, r, getxattr);
+}
+
void
link_f(opnum_t opno, long r)
{
--
2.30.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v4 0/2] Add support for using liburing xattr
2021-12-16 18:43 [PATCH v4 0/2] Add support for using liburing xattr Stefan Roesch
2021-12-16 18:43 ` [PATCH v4 1/2] fstress: add suport for using liburing setxattr Stefan Roesch
2021-12-16 18:43 ` [PATCH v4 2/2] fstress: add suport for using liburing getxattr Stefan Roesch
@ 2021-12-17 4:20 ` Zorro Lang
2 siblings, 0 replies; 5+ messages in thread
From: Zorro Lang @ 2021-12-17 4:20 UTC (permalink / raw)
To: Stefan Roesch; +Cc: fstests, kernel-team
On Thu, Dec 16, 2021 at 10:43:17AM -0800, Stefan Roesch wrote:
> 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
>
> ---
> V4: - fix a whitespace/tab issue
> V3: - Rebased patch series.
> V2: - Introduce dedicated functions for uring getxattr and
> uring setxattr, so they are not automatically linked
> in if liburing is available.
>
> *** BLURB HERE ***
>
> Stefan Roesch (2):
> fstress: add suport for using liburing setxattr
> fstress: add suport for using liburing getxattr
The code logic of this patchset looks good to me. But just notice that the
subject should be "fsstress", not "fstress", you can ask if Eryu would like
to help to change that when he merge the patch :-D
Reviewed-by: Zorro Lang <zlang@redhat.com>
>
> ltp/fsstress.c | 122 ++++++++++++++++++++++++++++++++++++++++++++++---
> 1 file changed, 116 insertions(+), 6 deletions(-)
>
>
> base-commit: 13dd19cee4298ffc323737029ca36f70f52f88e9
> --
> 2.30.2
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v4 1/2] fstress: add suport for using liburing setxattr
2021-12-16 18:43 ` [PATCH v4 1/2] fstress: add suport for using liburing setxattr Stefan Roesch
@ 2021-12-19 16:02 ` Eryu Guan
0 siblings, 0 replies; 5+ messages in thread
From: Eryu Guan @ 2021-12-19 16:02 UTC (permalink / raw)
To: Stefan Roesch; +Cc: fstests, kernel-team
On Thu, Dec 16, 2021 at 10:43:18AM -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 | 59 ++++++++++++++++++++++++++++++++++++++++++++++++--
> 1 file changed, 57 insertions(+), 2 deletions(-)
>
> diff --git a/ltp/fsstress.c b/ltp/fsstress.c
> index 5f3126e6..48d93436 100644
> --- a/ltp/fsstress.c
> +++ b/ltp/fsstress.c
> @@ -145,12 +145,14 @@ typedef enum {
> OP_URING_WRITE,
> OP_WRITE,
> OP_WRITEV,
> + OP_URING_SETXATTR,
> OP_LAST
> } opty_t;
>
> typedef long long opnum_t;
>
> typedef void (*opfnc_t)(opnum_t, long);
> +typedef int (*setxattr_cbk)(const char *, const char *, const void *, size_t, int);
>
> typedef struct opdesc {
> char *name;
> @@ -276,6 +278,7 @@ void uring_read_f(opnum_t, long);
> void uring_write_f(opnum_t, long);
> void write_f(opnum_t, long);
> void writev_f(opnum_t, long);
> +void uring_setxattr_f(opnum_t, long);
Order it by name?
> char *xattr_flag_to_string(int);
>
> struct opdesc ops[OP_LAST] = {
> @@ -346,6 +349,7 @@ struct opdesc ops[OP_LAST] = {
> [OP_URING_WRITE] = {"uring_write", uring_write_f, 1, 1 },
> [OP_WRITE] = {"write", write_f, 4, 1 },
> [OP_WRITEV] = {"writev", writev_f, 4, 1 },
> + [OP_URING_SETXATTR] = {"uring_setxattr", uring_setxattr_f, 1, 1 },
Make it aligned with other ops as well?
> }, *ops_end;
>
> flist_t flist[FT_nft] = {
> @@ -4771,8 +4775,45 @@ 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)
Space before tab in above line.
> +{
> + 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);
Seems we have to wait for the liburing patches go in first, otherwise
we'll hit compile error.
> +
> + 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;
> + }
Space before tab in above line.
Thanks,
Eryu
> +
> + 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)
> +setfattr_f_cbk(opnum_t opno, long r, setxattr_cbk cbk)
> {
> int e;
> pathname_t f;
> @@ -4834,7 +4875,7 @@ setfattr_f(opnum_t opno, long r)
> goto out;
> }
>
> - e = setxattr(f.path, name, value, value_len, flag) < 0 ? errno : 0;
> + e = cbk(f.path, name, value, value_len, flag) < 0 ? errno : 0;
> if (e == 0)
> fep->xattr_counter++;
> if (v)
> @@ -4846,6 +4887,20 @@ out:
> free_pathname(&f);
> }
>
> +void
> +uring_setxattr_f(opnum_t opno, long r)
> +{
> +#ifdef URING
> + setfattr_f_cbk(opno, r, io_uring_setxattr);
> +#endif
> +}
> +
> +void
> +setfattr_f(opnum_t opno, long r)
> +{
> + setfattr_f_cbk(opno, r, setxattr);
> +}
> +
> void
> snapshot_f(opnum_t opno, long r)
> {
> --
> 2.30.2
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-12-19 16:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-16 18:43 [PATCH v4 0/2] Add support for using liburing xattr Stefan Roesch
2021-12-16 18:43 ` [PATCH v4 1/2] fstress: add suport for using liburing setxattr Stefan Roesch
2021-12-19 16:02 ` Eryu Guan
2021-12-16 18:43 ` [PATCH v4 2/2] fstress: add suport for using liburing getxattr Stefan Roesch
2021-12-17 4:20 ` [PATCH v4 0/2] Add support for using liburing xattr Zorro Lang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.