public inbox for [email protected]
 help / color / mirror / Atom feed
From: Jens Axboe <[email protected]>
To: Brian Foster <[email protected]>, Zorro Lang <[email protected]>
Cc: [email protected], [email protected]
Subject: Re: [PATCH v3 1/4] fsstress: add IO_URING read and write operations
Date: Thu, 3 Sep 2020 08:07:41 -0600	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <20200903124247.GA444163@bfoster>

On 9/3/20 6:42 AM, Brian Foster wrote:
> On Sun, Aug 23, 2020 at 02:30:29PM +0800, Zorro Lang wrote:
>> IO_URING is a new feature of curent linux kernel, add basic IO_URING
>> read/write into fsstess to cover this kind of IO testing.
>>
>> Signed-off-by: Zorro Lang <[email protected]>
>> ---
>>  README                 |   4 +-
>>  configure.ac           |   1 +
>>  include/builddefs.in   |   1 +
>>  ltp/Makefile           |   5 ++
>>  ltp/fsstress.c         | 139 ++++++++++++++++++++++++++++++++++++++++-
>>  m4/Makefile            |   1 +
>>  m4/package_liburing.m4 |   4 ++
>>  7 files changed, 152 insertions(+), 3 deletions(-)
>>  create mode 100644 m4/package_liburing.m4
>>
> ...
>> diff --git a/ltp/fsstress.c b/ltp/fsstress.c
>> index 709fdeec..7a0e278a 100644
>> --- a/ltp/fsstress.c
>> +++ b/ltp/fsstress.c
> ...
>> @@ -2170,6 +2189,108 @@ do_aio_rw(int opno, long r, int flags)
>>  }
>>  #endif
>>  
>> +#ifdef URING
>> +void
>> +do_uring_rw(int opno, long r, int flags)
>> +{
>> +	char		*buf;
>> +	int		e;
>> +	pathname_t	f;
>> +	int		fd;
>> +	size_t		len;
>> +	int64_t		lr;
>> +	off64_t		off;
>> +	struct stat64	stb;
>> +	int		v;
>> +	char		st[1024];
>> +	struct io_uring_sqe	*sqe;
>> +	struct io_uring_cqe	*cqe;
>> +	struct iovec	iovec;
>> +	int		iswrite = (flags & (O_WRONLY | O_RDWR)) ? 1 : 0;
>> +
>> +	init_pathname(&f);
>> +	if (!get_fname(FT_REGFILE, r, &f, NULL, NULL, &v)) {
>> +		if (v)
>> +			printf("%d/%d: do_uring_rw - no filename\n", procid, opno);
>> +		goto uring_out3;
>> +	}
>> +	fd = open_path(&f, flags);
>> +	e = fd < 0 ? errno : 0;
>> +	check_cwd();
>> +	if (fd < 0) {
>> +		if (v)
>> +			printf("%d/%d: do_uring_rw - open %s failed %d\n",
>> +			       procid, opno, f.path, e);
>> +		goto uring_out3;
>> +	}
>> +	if (fstat64(fd, &stb) < 0) {
>> +		if (v)
>> +			printf("%d/%d: do_uring_rw - fstat64 %s failed %d\n",
>> +			       procid, opno, f.path, errno);
>> +		goto uring_out2;
>> +	}
>> +	inode_info(st, sizeof(st), &stb, v);
>> +	if (!iswrite && stb.st_size == 0) {
>> +		if (v)
>> +			printf("%d/%d: do_uring_rw - %s%s zero size\n", procid, opno,
>> +			       f.path, st);
>> +		goto uring_out2;
>> +	}
>> +	sqe = io_uring_get_sqe(&ring);
>> +	if (!sqe) {
>> +		if (v)
>> +			printf("%d/%d: do_uring_rw - io_uring_get_sqe failed\n",
>> +			       procid, opno);
>> +		goto uring_out2;
>> +	}
> 
> I'm not familiar with the io_uring bits, but do we have to do anything
> to clean up this sqe object (or the cqe) before we return?

The cqe/sqe resources are tied to the ring, so as long as
io_uring_queue_exit() is called, then they are freed. And it is after
the run, so looks fine to me.

-- 
Jens Axboe


  reply	other threads:[~2020-09-03 14:58 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-23  6:30 [PATCH v3 0/4] fsstress,fsx: add io_uring test and do some fix Zorro Lang
2020-08-23  6:30 ` [PATCH v3 1/4] fsstress: add IO_URING read and write operations Zorro Lang
2020-09-03 12:42   ` Brian Foster
2020-09-03 14:07     ` Jens Axboe [this message]
2020-08-23  6:30 ` [PATCH v3 2/4] fsstress: reduce the number of events when io_setup Zorro Lang
2020-09-03 12:42   ` Brian Foster
2020-08-23  6:30 ` [PATCH v3 3/4] fsstress: fix memory leak in do_aio_rw Zorro Lang
2020-09-03 12:43   ` Brian Foster
2020-08-23  6:30 ` [PATCH v3 4/4] fsx: add IO_URING test Zorro Lang
2020-09-03 12:44   ` Brian Foster
2020-09-06 15:55     ` Zorro Lang
2020-09-06 16:27       ` Zorro Lang

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 \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /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