All of lore.kernel.org
 help / color / mirror / Atom feed
From: Damien Le Moal <Damien.LeMoal@wdc.com>
To: Krishna Kanth Reddy <krish.reddy@samsung.com>,
	"axboe@kernel.dk" <axboe@kernel.dk>
Cc: "fio@vger.kernel.org" <fio@vger.kernel.org>,
	Ankit Kumar <ankit.kumar@samsung.com>
Subject: Re: [PATCH 3/4] iouring: support for Zone Append command
Date: Fri, 26 Jun 2020 05:43:27 +0000	[thread overview]
Message-ID: <CY4PR04MB375159898F07C71C4870DE63E7930@CY4PR04MB3751.namprd04.prod.outlook.com> (raw)
In-Reply-To: 1593106733-19596-4-git-send-email-krish.reddy@samsung.com

On 2020/06/26 2:41, Krishna Kanth Reddy wrote:
> From: Ankit Kumar <ankit.kumar@samsung.com>
> 
> The zone append command uses the write path with offset as
> start of the zone. Upon successful completion, multiple of
> sectors relative to the zone's start offset, where the data
> has been placed is returned.
> 
> Signed-off-by: Krishna Kanth Reddy <krish.reddy@samsung.com>
> ---
>  engines/io_uring.c | 23 ++++++++++++++++++++++-
>  1 file changed, 22 insertions(+), 1 deletion(-)
> 
> diff --git a/engines/io_uring.c b/engines/io_uring.c
> index cd0810f..cb7c5ba 100644
> --- a/engines/io_uring.c
> +++ b/engines/io_uring.c
> @@ -251,7 +251,13 @@ static int fio_ioring_prep(struct thread_data *td, struct io_u *io_u)
>  			sqe->ioprio = td->o.ioprio_class << 13;
>  		if (ld->ioprio_set)
>  			sqe->ioprio |= td->o.ioprio;
> -		sqe->off = io_u->offset;
> +		if (td->o.zone_append && io_u->ddir == DDIR_WRITE)
> +			sqe->rw_flags |= RWF_ZONE_APPEND;
> +		if ((td->o.zone_mode == ZONE_MODE_ZBD)
> +		     && td->o.zone_append && io_u->ddir == DDIR_WRITE) {
> +			sqe->off = io_u->zone_start_offset;
> +		} else
> +			sqe->off = io_u->offset;

Why test twice "td->o.zone_append && io_u->ddir == DDIR_WRITE" ? this can be
rewritten to not have to test this 2 times:

		if (td->o.zone_append && io_u->ddir == DDIR_WRITE) {
			sqe->rw_flags |= RWF_ZONE_APPEND;
			if (td->o.zone_mode == ZONE_MODE_ZBD)
				sqe->off = io_u->zone_start_offset;
			else
				sqe->off = io_u->offset;
		}

And fix the start offset as already commented, using io_u->offset and
td->o.zone_size.

>  	} else if (ddir_sync(io_u->ddir)) {
>  		if (io_u->ddir == DDIR_SYNC_FILE_RANGE) {
>  			sqe->off = f->first_write;
> @@ -324,6 +330,21 @@ static int fio_ioring_getevents(struct thread_data *td, unsigned int min,
>  	ld->cq_ring_off = *ring->head;
>  	do {
>  		r = fio_ioring_cqring_reap(td, events, max);
> +		if (td->o.zone_mode == ZONE_MODE_ZBD) {
> +			struct io_uring_cqe *cqe;
> +			struct io_u *io_u;
> +			unsigned index;

need blank line.

> +			for (unsigned event = 0; event < r; event++) {
> +				index = (event + ld->cq_ring_off) & ld->cq_ring_mask;
> +
> +				cqe = &ld->cq_ring.cqes[index];
> +				io_u = (struct io_u *) (uintptr_t) cqe->user_data;
> +
> +				if (td->o.zone_append && td->o.do_verify
> +				    && td->o.verify && (io_u->ddir == DDIR_WRITE))
> +					io_u->ipo->offset = io_u->zone_start_offset + (cqe->flags << 9);

cqe->flags needs to be cast to 64bit or the shift could give the wrong result.

Same comments as for libaio regarding structure.

> +			}
> +		}
>  		if (r) {
>  			events += r;
>  			if (actual_min != 0)
> 


-- 
Damien Le Moal
Western Digital Research


  reply	other threads:[~2020-06-26  5:43 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20200625174119epcas5p122a2197102fe336aa35fdea1273fd1b0@epcas5p1.samsung.com>
2020-06-25 17:38 ` [PATCH 0/4] v2 Patchset : Zone Append command support for NVMe Zoned Namespaces (ZNS) Krishna Kanth Reddy
     [not found]   ` <CGME20200625174124epcas5p18e4fbc502c9cf1fef7e84ba5cefba945@epcas5p1.samsung.com>
2020-06-25 17:38     ` [PATCH 1/4] Add " Krishna Kanth Reddy
2020-06-26  5:33       ` Damien Le Moal
2020-07-03 17:17         ` Krishna Kanth Reddy
2020-06-26  5:50       ` Damien Le Moal
2020-07-03 16:50         ` Krishna Kanth Reddy
     [not found]   ` <CGME20200625174129epcas5p304bf58bb381b4b0c39e0ff91b50a23a9@epcas5p3.samsung.com>
2020-06-25 17:38     ` [PATCH 2/4] libaio: support for Zone Append command Krishna Kanth Reddy
2020-06-26  5:38       ` Damien Le Moal
2020-07-03 10:47         ` Krishna Kanth Reddy
     [not found]   ` <CGME20200625174131epcas5p36cf7cd413dcb698f117474df71e5648b@epcas5p3.samsung.com>
2020-06-25 17:38     ` [PATCH 3/4] iouring: " Krishna Kanth Reddy
2020-06-26  5:43       ` Damien Le Moal [this message]
2020-07-03 10:37         ` Krishna Kanth Reddy
     [not found]   ` <CGME20200625174133epcas5p1eace8f03319bee805b93c50fe6c690c7@epcas5p1.samsung.com>
2020-06-25 17:38     ` [PATCH 4/4] t/zbd: Add support to verify Zone Append command with libaio, io_uring IO engine tests Krishna Kanth Reddy
2020-06-25 18:44       ` Dmitry Fomichev
2020-07-03  8:46         ` Krishna Kanth Reddy
2020-06-26  5:45       ` Damien Le Moal
2020-07-03  9:09         ` Krishna Kanth Reddy

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=CY4PR04MB375159898F07C71C4870DE63E7930@CY4PR04MB3751.namprd04.prod.outlook.com \
    --to=damien.lemoal@wdc.com \
    --cc=ankit.kumar@samsung.com \
    --cc=axboe@kernel.dk \
    --cc=fio@vger.kernel.org \
    --cc=krish.reddy@samsung.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 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.