All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
To: Jan Kara <jack@suse.cz>
Cc: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org,
	Jan Kara <jack@suse.cz>, Christoph Hellwig <hch@infradead.org>,
	"Darrick J . Wong" <djwong@kernel.org>,
	Ojaswin Mujoo <ojaswin@linux.ibm.com>,
	Disha Goel <disgoel@linux.ibm.com>,
	Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCHv5 5/9] ext2: Move direct-io to use iomap
Date: Thu, 20 Apr 2023 20:18:17 +0530	[thread overview]
Message-ID: <87h6taip8u.fsf@doe.com> (raw)
In-Reply-To: <20230417112006.3bzzitsxy67jpviq@quack3>

Jan Kara <jack@suse.cz> writes:

> On Sun 16-04-23 15:38:40, Ritesh Harjani (IBM) wrote:
>> This patch converts ext2 direct-io path to iomap interface.
>> - This also takes care of DIO_SKIP_HOLES part in which we return -ENOTBLK
>>   from ext2_iomap_begin(), in case if the write is done on a hole.
>> - This fallbacks to buffered-io in case of DIO_SKIP_HOLES or in case of
>>   a partial write or if any error is detected in ext2_iomap_end().
>>   We try to return -ENOTBLK in such cases.
>> - For any unaligned or extending DIO writes, we pass
>>   IOMAP_DIO_FORCE_WAIT flag to ensure synchronous writes.
>> - For extending writes we set IOMAP_F_DIRTY in ext2_iomap_begin because
>>   otherwise with dsync writes on devices that support FUA, generic_write_sync
>>   won't be called and we might miss inode metadata updates.
>> - Since ext2 already now uses _nolock vartiant of sync write. Hence
>>   there is no inode lock problem with iomap in this patch.
>> - ext2_iomap_ops are now being shared by DIO, DAX & fiemap path
>>
>> Tested-by: Disha Goel <disgoel@linux.ibm.com>
>> Reviewed-by: Christoph Hellwig <hch@lst.de>
>> Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
>
> One comment below:
>
>> @@ -844,6 +868,13 @@ static int
>>  ext2_iomap_end(struct inode *inode, loff_t offset, loff_t length,
>>  		ssize_t written, unsigned flags, struct iomap *iomap)
>>  {
>> +	/*
>> +	 * Switch to buffered-io in case of any error.
>> +	 * Blocks allocated can be used by the buffered-io path.
>> +	 */
>> +	if ((flags & IOMAP_DIRECT) && (flags & IOMAP_WRITE) && written == 0)
>> +		return -ENOTBLK;
>> +
>>  	if (iomap->type == IOMAP_MAPPED &&
>>  	    written < length &&
>>  	    (flags & IOMAP_WRITE))
>
> Is this really needed? What for?
>

Sorry Jan, I got caught into something else so couldn't respond on this
earlier. Thanks a lot for review.

I don't think this will be called for IOMAP_DIRECT for write case.
I mostly see this code was already present for IOMAP_DAX path.
It is to truncate the blocks in case if the iomap dax write failed to
write but the blocks might have been allocated in ->iomap_begin
function.

Is there a specific query that you would like me to check and verify?
I can check more by probing this path to see what happens when this gets
called. But my understanding was it is used for truncating blocks as I
mentioned above.

Thanks
-ritesh

  reply	other threads:[~2023-04-20 14:48 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-16 10:08 [PATCHv5 0/9] ext2: DIO to use iomap Ritesh Harjani (IBM)
2023-04-16 10:08 ` [PATCHv5 1/9] ext2/dax: Fix ext2_setsize when len is page aligned Ritesh Harjani (IBM)
2023-04-16 10:08 ` [PATCHv5 2/9] fs/buffer.c: Add generic_buffer_fsync implementation Ritesh Harjani (IBM)
2023-04-17 11:01   ` Jan Kara
2023-04-17 11:07     ` Jan Kara
2023-04-17 11:38     ` Ritesh Harjani
2023-04-17 16:45       ` Jan Kara
2023-04-18  5:04         ` Christoph Hellwig
2023-04-20 14:42           ` Ritesh Harjani
2023-04-16 10:08 ` [PATCHv5 3/9] ext4: Use generic_buffer_fsync() implementation Ritesh Harjani (IBM)
2023-04-16 10:08 ` [PATCHv5 4/9] ext2: " Ritesh Harjani (IBM)
2023-04-16 10:08 ` [PATCHv5 5/9] ext2: Move direct-io to use iomap Ritesh Harjani (IBM)
2023-04-17 11:20   ` Jan Kara
2023-04-20 14:48     ` Ritesh Harjani [this message]
2023-04-16 10:08 ` [PATCHv5 6/9] fs.h: Add TRACE_IOCB_STRINGS for use in trace points Ritesh Harjani (IBM)
2023-04-16 10:08 ` [PATCHv5 7/9] ext2: Add direct-io " Ritesh Harjani (IBM)
2023-04-16 10:08 ` [PATCHv5 8/9] iomap: Remove IOMAP_DIO_NOSYNC unused dio flag Ritesh Harjani (IBM)
2023-04-16 10:08 ` [PATCHv5 9/9] iomap: Add DIO tracepoints Ritesh Harjani (IBM)
2023-04-16 13:49   ` Christoph Hellwig

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=87h6taip8u.fsf@doe.com \
    --to=ritesh.list@gmail.com \
    --cc=disgoel@linux.ibm.com \
    --cc=djwong@kernel.org \
    --cc=hch@infradead.org \
    --cc=hch@lst.de \
    --cc=jack@suse.cz \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=ojaswin@linux.ibm.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.