IO-Uring Archive on lore.kernel.org
 help / color / Atom feed
From: Damien Le Moal <Damien.LeMoal@wdc.com>
To: Kanchan Joshi <joshi.k@samsung.com>
Cc: "axboe@kernel.dk" <axboe@kernel.dk>,
	"viro@zeniv.linux.org.uk" <viro@zeniv.linux.org.uk>,
	"bcrl@kvack.org" <bcrl@kvack.org>,
	"asml.silence@gmail.com" <asml.silence@gmail.com>,
	"hch@infradead.org" <hch@infradead.org>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	"mb@lightnvm.io" <mb@lightnvm.io>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-aio@kvack.org" <linux-aio@kvack.org>,
	"io-uring@vger.kernel.org" <io-uring@vger.kernel.org>,
	"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
	"selvakuma.s1@samsung.com" <selvakuma.s1@samsung.com>,
	"nj.shetty@samsung.com" <nj.shetty@samsung.com>,
	"javier.gonz@samsung.com" <javier.gonz@samsung.com>,
	Arnav Dawn <a.dawn@samsung.com>
Subject: Re: [PATCH v2 1/2] fs,block: Introduce RWF_ZONE_APPEND and handling in direct IO path
Date: Tue, 30 Jun 2020 07:56:46 +0000
Message-ID: <CY4PR04MB375162ABFFA5BB660869C57DE76F0@CY4PR04MB3751.namprd04.prod.outlook.com> (raw)
In-Reply-To: <CY4PR04MB37517AAE0B475F631C81B404E76F0@CY4PR04MB3751.namprd04.prod.outlook.com>

On 2020/06/30 16:53, Damien Le Moal wrote:
> On 2020/06/30 16:43, Kanchan Joshi wrote:
>> On Tue, Jun 30, 2020 at 12:37:07AM +0000, Damien Le Moal wrote:
>>> On 2020/06/30 3:35, Kanchan Joshi wrote:
>>>> On Fri, Jun 26, 2020 at 02:50:20AM +0000, Damien Le Moal wrote:
>>>>> On 2020/06/26 2:18, Kanchan Joshi wrote:
>>>>>> Introduce RWF_ZONE_APPEND flag to represent zone-append. User-space
>>>>>> sends this with write. Add IOCB_ZONE_APPEND which is set in
>>>>>> kiocb->ki_flags on receiving RWF_ZONE_APPEND.
>>>>>> Make direct IO submission path use IOCB_ZONE_APPEND to send bio with
>>>>>> append op. Direct IO completion returns zone-relative offset, in sector
>>>>>> unit, to upper layer using kiocb->ki_complete interface.
>>>>>> Report error if zone-append is requested on regular file or on sync
>>>>>> kiocb (i.e. one without ki_complete).
>>>>>>
>>>>>> Signed-off-by: Kanchan Joshi <joshi.k@samsung.com>
>>>>>> Signed-off-by: SelvaKumar S <selvakuma.s1@samsung.com>
>>>>>> Signed-off-by: Arnav Dawn <a.dawn@samsung.com>
>>>>>> Signed-off-by: Nitesh Shetty <nj.shetty@samsung.com>
>>>>>> Signed-off-by: Javier Gonzalez <javier.gonz@samsung.com>
>>>>>> ---
>>>>>>  fs/block_dev.c          | 28 ++++++++++++++++++++++++----
>>>>>>  include/linux/fs.h      |  9 +++++++++
>>>>>>  include/uapi/linux/fs.h |  5 ++++-
>>>>>>  3 files changed, 37 insertions(+), 5 deletions(-)
>>>>>>
>>>>>> diff --git a/fs/block_dev.c b/fs/block_dev.c
>>>>>> index 47860e5..5180268 100644
>>>>>> --- a/fs/block_dev.c
>>>>>> +++ b/fs/block_dev.c
>>>>>> @@ -185,6 +185,10 @@ static unsigned int dio_bio_write_op(struct kiocb *iocb)
>>>>>>  	/* avoid the need for a I/O completion work item */
>>>>>>  	if (iocb->ki_flags & IOCB_DSYNC)
>>>>>>  		op |= REQ_FUA;
>>>>>> +
>>>>>> +	if (iocb->ki_flags & IOCB_ZONE_APPEND)
>>>>>> +		op |= REQ_OP_ZONE_APPEND;
>>>>>
>>>>> This is wrong. REQ_OP_WRITE is already set in the declaration of "op". How can
>>>>> this work ?
>>>> REQ_OP_ZONE_APPEND will override the REQ_WRITE op, while previously set op
>>>> flags (REQ_FUA etc.) will be retained. But yes, this can be made to look
>>>> cleaner.
>>>> V3 will include the other changes you pointed out. Thanks for the review.
>>>>
>>>
>>> REQ_OP_WRITE and REQ_OP_ZONE_APPEND are different bits, so there is no
>>> "override". A well formed BIO bi_opf is one op+flags. Specifying multiple OP
>>> codes does not make sense.
>>
>> one op+flags behavior is retained here. OP is not about bits (op flags are).
>> Had it been, REQ_OP_WRITE (value 1) can not be differentiated from
>> REQ_OP_ZONE_APPEND (value 13).
>> We do not do "bio_op(bio) & REQ_OP_WRITE", rather we look at the
>> absolute value "bio_op(bio) == REQ_OP_WRITE".
> 
> Sure, the ops are not bits like the flags, but (excluding the flags) doing:
> 
> op |= REQ_OP_ZONE_APPEND;
> 
> will give you op == (REQ_OP_WRITE | REQ_OP_ZONE_APPEND). That's not what you want...

And yes, REQ_OP_WRITE | REQ_OP_ZONE_APPEND == REQ_OP_ZONE_APPEND... But still
not a reason for not setting the op correctly :)



-- 
Damien Le Moal
Western Digital Research

  reply index

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20200625171829epcas5p268486a0780571edb4999fc7b3caab602@epcas5p2.samsung.com>
2020-06-25 17:15 ` [PATCH v2 0/2] zone-append support in io-uring and aio Kanchan Joshi
     [not found]   ` <CGME20200625171834epcas5p226a24dfcb84cfa83fe29a2bd17795d85@epcas5p2.samsung.com>
2020-06-25 17:15     ` [PATCH v2 1/2] fs,block: Introduce RWF_ZONE_APPEND and handling in direct IO path Kanchan Joshi
2020-06-26  2:50       ` Damien Le Moal
2020-06-29 18:32         ` Kanchan Joshi
2020-06-30  0:37           ` Damien Le Moal
2020-06-30  7:40             ` Kanchan Joshi
2020-06-30  7:52               ` Damien Le Moal
2020-06-30  7:56                 ` Damien Le Moal [this message]
2020-06-30  8:16                   ` Kanchan Joshi
2020-06-26  8:58       ` Christoph Hellwig
2020-06-26 21:15         ` Kanchan Joshi
2020-06-27  6:51           ` Christoph Hellwig
     [not found]   ` <CGME20200625171838epcas5p449183e12770187142d8d55a9bf422a8d@epcas5p4.samsung.com>
2020-06-25 17:15     ` [PATCH v2 2/2] io_uring: add support for zone-append Kanchan Joshi
2020-06-25 19:40       ` Pavel Begunkov
2020-06-26  3:11   ` [PATCH v2 0/2] zone-append support in io-uring and aio Damien Le Moal
2020-06-26  6:37     ` javier.gonz
2020-06-26  6:56       ` Damien Le Moal
2020-06-26  7:03         ` javier.gonz@samsung.com
2020-06-26 22:15     ` Kanchan Joshi
2020-06-30 12:46   ` Matthew Wilcox

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=CY4PR04MB375162ABFFA5BB660869C57DE76F0@CY4PR04MB3751.namprd04.prod.outlook.com \
    --to=damien.lemoal@wdc.com \
    --cc=a.dawn@samsung.com \
    --cc=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=bcrl@kvack.org \
    --cc=hch@infradead.org \
    --cc=io-uring@vger.kernel.org \
    --cc=javier.gonz@samsung.com \
    --cc=joshi.k@samsung.com \
    --cc=linux-aio@kvack.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mb@lightnvm.io \
    --cc=nj.shetty@samsung.com \
    --cc=selvakuma.s1@samsung.com \
    --cc=viro@zeniv.linux.org.uk \
    /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

IO-Uring Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/io-uring/0 io-uring/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 io-uring io-uring/ https://lore.kernel.org/io-uring \
		io-uring@vger.kernel.org
	public-inbox-index io-uring

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.io-uring


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git