liburing: support xattr functions
cover liburing: support xattr functions
Add xattr support and testing to liburing
Patch 1: liburing: update io_uring
Update io_uring.h with io_uring kernel changes.
Patch 2: liburing: add fsetxattr and setxattr
Add new helper functions for fsetxattr and setxattr support in liburing.
Patch 3: liburing: add fgetxattr and getxattr
Add new helper functions for fgetxattr and getxattr support in liburing.
Patch 4: liburing: add new tests for xattr
Adds a new test program to test the xattr support.
There are also patches for io_uring and xfstests:
- Adds xattr support for io_uring
- Add xattr support to fsstress
Stefan Roesch (4):
liburing: Update io_uring in liburing
liburing: add helper functions for setxattr and fsetxattr
liburing: Add helper functions for fgetxattr and getxattr
liburing: Add new test program to verify xattr support
src/include/liburing.h | 47 +++- src/include/liburing/io_uring.h | 10 +- test/Makefile | 1 + test/xattr.c | 425 ++++++++++++++++++++++++++++++++ 4 files changed, 480 insertions(+), 3 deletions(-) create mode 100644 test/xattr.c
base-commit: 509873c4454012c5810c728695c21911c82acdc4
Signature · 1 line
2.30.2
PATCH 1/4 liburing: Update io_uring in liburing
Summary:
Update liburing with the kernel changes in io_uring.
--- src/include/liburing.h | 3 ++- src/include/liburing/io_uring.h | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-)
src/include/liburing.h +2 -1
@@ -258,7 +258,8 @@ static inline void io_uring_prep_rw(int op, struct io_uring_sqe *sqe, int fd, sqe->buf_index =0 ; sqe->personality =0 ; sqe->file_index =0 ; - sqe->__pad2[0 ] = sqe->__pad2[1 ] =0 ; + sqe->addr3 =0 ; + sqe->__pad2[0 ] =0 ; }/**
src/include/liburing/io_uring.h +8 -2
@@ -49,6 +49,7 @@ struct io_uring_sqe {__u32 rename_flags;__u32 unlink_flags;__u32 hardlink_flags; +__u32 xattr_flags; };__u64 user_data;/* data to be passed back at completion time */ /* pack this to avoid bogus arm OABI complaints */
@@ -64,7 +65,8 @@ struct io_uring_sqe {__s32 splice_fd_in;__u32 file_index; }; -__u64 __pad2[2 ]; +__u64 addr3; +__u64 __pad2[1 ]; };enum {
@@ -147,6 +149,10 @@ enum {IORING_OP_MKDIRAT ,IORING_OP_SYMLINKAT ,IORING_OP_LINKAT , +IORING_OP_FGETXATTR , +IORING_OP_FSETXATTR , +IORING_OP_GETXATTR , +IORING_OP_SETXATTR ,/* this goes last, obviously */ IORING_OP_LAST,
@@ -386,7 +392,7 @@ struct io_uring_probe {__u8 ops_len;/* length of ops[] array below */ __u16 resv;__u32 resv2[3 ]; -struct io_uring_probe_op ops[]; +struct io_uring_probe_op ops[0 ]; };struct io_uring_restriction {
Signature · 1 line
2.30.2
PATCH 2/4 liburing: add helper functions for setxattr and fsetxattr
In reply to Stefan RoeschSummary:
This adds the helper functions for:
- fsetxattr
- setxattr
--- src/include/liburing.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
src/include/liburing.h +23 -0
@@ -673,6 +673,29 @@ static inline void io_uring_prep_linkat(struct io_uring_sqe *sqe, int olddfd, sqe->hardlink_flags = (__u32 ) flags; } +static inline void io_uring_prep_setxattr (struct io_uring_sqe *sqe, +const char *name, +const char *value, +const char *path, +int flags, +size_t len) +{ +io_uring_prep_rw (IORING_OP_SETXATTR , sqe,0 , name, len, (__u64 ) value); + sqe->addr3 = (__u64 ) path; + sqe->xattr_flags = flags; +} + +static inline void io_uring_prep_fsetxattr (struct io_uring_sqe *sqe, +int fd, +const char *name, +const char *value, +int flags, +size_t len) +{ +io_uring_prep_rw (IORING_OP_FSETXATTR , sqe, fd, name, len, (__u64 ) value); + sqe->xattr_flags = flags; +} +/* * Returns number of unconsumed (if SQPOLL) or unsubmitted entries exist in * the SQ ring
Signature · 1 line
2.30.2
PATCH 3/4 liburing: Add helper functions for fgetxattr and getxattr
In reply to Stefan RoeschSummary:
This adds the helper functions for:
- fgetxattr
- getxattr
--- src/include/liburing.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
src/include/liburing.h +21 -0
@@ -673,6 +673,17 @@ static inline void io_uring_prep_linkat(struct io_uring_sqe *sqe, int olddfd, sqe->hardlink_flags = (__u32 ) flags; } +static inline void io_uring_prep_getxattr (struct io_uring_sqe *sqe, +const char *name, +const char *value, +const char *path, +size_t len) +{ +io_uring_prep_rw (IORING_OP_GETXATTR , sqe,0 , name, len, (__u64 ) value); + sqe->addr3 = (__u64 ) path; + sqe->xattr_flags =0 ; +} + static inline void io_uring_prep_setxattr(struct io_uring_sqe *sqe, const char *name, const char *value,
@@ -685,6 +696,16 @@ static inline void io_uring_prep_setxattr(struct io_uring_sqe *sqe, sqe->xattr_flags = flags; } +static inline void io_uring_prep_fgetxattr (struct io_uring_sqe *sqe, +int fd, +const char *name, +const char *value, +size_t len) +{ +io_uring_prep_rw (IORING_OP_FGETXATTR , sqe, fd, name, len, (__u64 ) value); + sqe->xattr_flags =0 ; +} + static inline void io_uring_prep_fsetxattr(struct io_uring_sqe *sqe, int fd, const char *name,
Signature · 1 line
2.30.2
PATCH 4/4 liburing: Add new test program to verify xattr support
In reply to Stefan RoeschSummary:
This adds a new test program to test the xattr support:
- fgetxattr
- fsetxattr
- getxattr
- setxattr
It also includes test cases for failure conditions and for passing in an invalid sqe. The test case for checking of invalid SQE, must be enabled by defining DESTRUCTIVE_TESTING.
--- test/Makefile | 1 + test/xattr.c | 425 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 426 insertions(+) create mode 100644 test/xattr.c
test/Makefile +1 -0
@@ -147,6 +147,7 @@ test_srcs := \ timeout-overflow.c \ unlink.c \ wakeup-hang.c \ + xattr.c \ skip-cqe.c \ # EOL
test/xattr.c new file +425 -0
425 lines not on this page · raw message
Signature · 1 line
2.30.2