Re: [PATCH v2 1/2] fs,block: Introduce RWF_ZONE_APPEND and handling in direct IO path

Kanchan Joshi
2020-06-29T18:35:07Z

[-- Attachment #1: Type: text/plain, Size: 1831 bytes --]

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.

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]