[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191008105207.GG5078@quack2.suse.cz>
Date: Tue, 8 Oct 2019 12:52:07 +0200
From: Jan Kara <jack@...e.cz>
To: Matthew Bobrowski <mbobrowski@...browski.org>
Cc: tytso@....edu, jack@...e.cz, adilger.kernel@...ger.ca,
linux-ext4@...r.kernel.org, linux-fsdevel@...r.kernel.org,
hch@...radead.org, david@...morbit.com, darrick.wong@...cle.com
Subject: Re: [PATCH v4 4/8] ext4: introduce direct I/O read path using iomap
infrastructure
On Thu 03-10-19 21:34:00, Matthew Bobrowski wrote:
> This patch introduces a new direct I/O read path that makes use of the
> iomap infrastructure.
>
> The new function ext4_dio_read_iter() is responsible for calling into
> the iomap infrastructure via iomap_dio_rw(). If the read operation
> being performed on the inode does not pass the preliminary checks
> performed within ext4_dio_supported(), then we simply fallback to
> buffered I/O in order to fulfil the request.
>
> Existing direct I/O read buffer_head code has been removed as it's now
> redundant.
>
> Signed-off-by: Matthew Bobrowski <mbobrowski@...browski.org>
The patch looks good to me. Just one small nit below. With that fixed, you
can add:
Reviewed-by: Jan Kara <jack@...e.cz>
> + /*
> + * Get exclusion from truncate and other inode operations.
> + */
> + if (!inode_trylock_shared(inode)) {
> + if (iocb->ki_flags & IOCB_NOWAIT)
> + return -EAGAIN;
> + inode_lock_shared(inode);
> + }
I've noticed here you actually introduce new trylock pattern - previously
we had unconditional inode_lock_shared() in ext4_direct_IO_read(). So the
cleanest would be to just use unconditional inode_lock_shared() here and
then fixup IOCB_NOWAIT handling (I agree that was missing in the original
code) in a separate patch. And the pattern should rather look like:
if (iocb->ki_flags & IOCB_NOWAIT) {
if (!inode_trylock_shared(inode))
return -EAGAIN;
} else {
inode_lock_shared(inode);
}
to avoid two atomical operations instead of one in the fast path. No need
to repeat old mistakes when we know better :).
Honza
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists