From: Brian Foster <bfoster@redhat.com>
To: "Ritesh Harjani (IBM)" <ritesh.list@gmail.com>
Cc: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
Matthew Wilcox <willy@infradead.org>,
Dave Chinner <david@fromorbit.com>,
Ojaswin Mujoo <ojaswin@linux.ibm.com>,
Disha Goel <disgoel@linux.ibm.com>
Subject: Re: [RFCv5 2/5] iomap: Refactor iop_set_range_uptodate() function
Date: Mon, 15 May 2023 11:09:29 -0400 [thread overview]
Message-ID: <ZGJLKdJeNzAtjSZb@bfoster> (raw)
In-Reply-To: <203a9e25873f6c94c9de89823439aa1f6a7dc714.1683485700.git.ritesh.list@gmail.com>
On Mon, May 08, 2023 at 12:57:57AM +0530, Ritesh Harjani (IBM) wrote:
> This patch moves up and combine the definitions of two functions
> (iomap_iop_set_range_uptodate() & iomap_set_range_uptodate()) into
> iop_set_range_uptodate() & refactors it's arguments a bit.
>
> No functionality change in this patch.
>
> Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
> ---
Hi Ritesh,
I just have a few random and nitty comments/questions on the series..
> fs/iomap/buffered-io.c | 57 ++++++++++++++++++++----------------------
> 1 file changed, 27 insertions(+), 30 deletions(-)
>
> diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
> index cbd945d96584..e732581dc2d4 100644
> --- a/fs/iomap/buffered-io.c
> +++ b/fs/iomap/buffered-io.c
> @@ -43,6 +43,27 @@ static inline struct iomap_page *to_iomap_page(struct folio *folio)
>
> static struct bio_set iomap_ioend_bioset;
>
> +static void iop_set_range_uptodate(struct inode *inode, struct folio *folio,
> + size_t off, size_t len)
> +{
Any particular reason this now takes the inode as a param now instead of
continuing to use the folio?
Brian
> + struct iomap_page *iop = to_iomap_page(folio);
> + unsigned int first_blk = off >> inode->i_blkbits;
> + unsigned int last_blk = (off + len - 1) >> inode->i_blkbits;
> + unsigned int nr_blks = last_blk - first_blk + 1;
> + unsigned long flags;
> +
> + if (iop) {
> + spin_lock_irqsave(&iop->uptodate_lock, flags);
> + bitmap_set(iop->uptodate, first_blk, nr_blks);
> + if (bitmap_full(iop->uptodate,
> + i_blocks_per_folio(inode, folio)))
> + folio_mark_uptodate(folio);
> + spin_unlock_irqrestore(&iop->uptodate_lock, flags);
> + } else {
> + folio_mark_uptodate(folio);
> + }
> +}
> +
> static struct iomap_page *iop_alloc(struct inode *inode, struct folio *folio,
> unsigned int flags)
> {
> @@ -145,30 +166,6 @@ static void iomap_adjust_read_range(struct inode *inode, struct folio *folio,
> *lenp = plen;
> }
>
> -static void iomap_iop_set_range_uptodate(struct folio *folio,
> - struct iomap_page *iop, size_t off, size_t len)
> -{
> - struct inode *inode = folio->mapping->host;
> - unsigned first = off >> inode->i_blkbits;
> - unsigned last = (off + len - 1) >> inode->i_blkbits;
> - unsigned long flags;
> -
> - spin_lock_irqsave(&iop->uptodate_lock, flags);
> - bitmap_set(iop->uptodate, first, last - first + 1);
> - if (bitmap_full(iop->uptodate, i_blocks_per_folio(inode, folio)))
> - folio_mark_uptodate(folio);
> - spin_unlock_irqrestore(&iop->uptodate_lock, flags);
> -}
> -
> -static void iomap_set_range_uptodate(struct folio *folio,
> - struct iomap_page *iop, size_t off, size_t len)
> -{
> - if (iop)
> - iomap_iop_set_range_uptodate(folio, iop, off, len);
> - else
> - folio_mark_uptodate(folio);
> -}
> -
> static void iomap_finish_folio_read(struct folio *folio, size_t offset,
> size_t len, int error)
> {
> @@ -178,7 +175,8 @@ static void iomap_finish_folio_read(struct folio *folio, size_t offset,
> folio_clear_uptodate(folio);
> folio_set_error(folio);
> } else {
> - iomap_set_range_uptodate(folio, iop, offset, len);
> + iop_set_range_uptodate(folio->mapping->host, folio, offset,
> + len);
> }
>
> if (!iop || atomic_sub_and_test(len, &iop->read_bytes_pending))
> @@ -240,7 +238,7 @@ static int iomap_read_inline_data(const struct iomap_iter *iter,
> memcpy(addr, iomap->inline_data, size);
> memset(addr + size, 0, PAGE_SIZE - poff - size);
> kunmap_local(addr);
> - iomap_set_range_uptodate(folio, iop, offset, PAGE_SIZE - poff);
> + iop_set_range_uptodate(iter->inode, folio, offset, PAGE_SIZE - poff);
> return 0;
> }
>
> @@ -277,7 +275,7 @@ static loff_t iomap_readpage_iter(const struct iomap_iter *iter,
>
> if (iomap_block_needs_zeroing(iter, pos)) {
> folio_zero_range(folio, poff, plen);
> - iomap_set_range_uptodate(folio, iop, poff, plen);
> + iop_set_range_uptodate(iter->inode, folio, poff, plen);
> goto done;
> }
>
> @@ -598,7 +596,7 @@ static int __iomap_write_begin(const struct iomap_iter *iter, loff_t pos,
> if (status)
> return status;
> }
> - iomap_set_range_uptodate(folio, iop, poff, plen);
> + iop_set_range_uptodate(iter->inode, folio, poff, plen);
> } while ((block_start += plen) < block_end);
>
> return 0;
> @@ -705,7 +703,6 @@ static int iomap_write_begin(struct iomap_iter *iter, loff_t pos,
> static size_t __iomap_write_end(struct inode *inode, loff_t pos, size_t len,
> size_t copied, struct folio *folio)
> {
> - struct iomap_page *iop = to_iomap_page(folio);
> flush_dcache_folio(folio);
>
> /*
> @@ -721,7 +718,7 @@ static size_t __iomap_write_end(struct inode *inode, loff_t pos, size_t len,
> */
> if (unlikely(copied < len && !folio_test_uptodate(folio)))
> return 0;
> - iomap_set_range_uptodate(folio, iop, offset_in_folio(folio, pos), len);
> + iop_set_range_uptodate(inode, folio, offset_in_folio(folio, pos), len);
> filemap_dirty_folio(inode->i_mapping, folio);
> return copied;
> }
> --
> 2.39.2
>
next prev parent reply other threads:[~2023-05-15 15:07 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-07 19:27 [RFCv5 0/5] iomap: Add support for per-block dirty state to improve write performance Ritesh Harjani (IBM)
2023-05-07 19:27 ` [RFCv5 1/5] iomap: Rename iomap_page_create/release() to iop_alloc/free() Ritesh Harjani (IBM)
2023-05-18 6:13 ` Christoph Hellwig
2023-05-19 15:01 ` Ritesh Harjani
2023-05-07 19:27 ` [RFCv5 2/5] iomap: Refactor iop_set_range_uptodate() function Ritesh Harjani (IBM)
2023-05-15 15:09 ` Brian Foster [this message]
2023-05-16 10:12 ` Ritesh Harjani
2023-05-18 6:16 ` Christoph Hellwig
2023-05-19 15:03 ` Ritesh Harjani
2023-05-07 19:27 ` [RFCv5 3/5] iomap: Add iop's uptodate state handling functions Ritesh Harjani (IBM)
2023-05-15 15:10 ` Brian Foster
2023-05-16 10:14 ` Ritesh Harjani
2023-05-18 6:18 ` Christoph Hellwig
2023-05-19 15:07 ` Ritesh Harjani
2023-05-23 6:00 ` Christoph Hellwig
2023-05-07 19:27 ` [RFCv5 4/5] iomap: Allocate iop in ->write_begin() early Ritesh Harjani (IBM)
2023-05-18 6:21 ` Christoph Hellwig
2023-05-19 15:18 ` Ritesh Harjani
2023-05-19 15:53 ` Matthew Wilcox
2023-05-22 4:05 ` Ritesh Harjani
2023-05-07 19:28 ` [RFCv5 5/5] iomap: Add per-block dirty state tracking to improve performance Ritesh Harjani (IBM)
[not found] ` <CGME20230515081618eucas1p1c852fec3ba7a42ee7094248c30ff5978@eucas1p1.samsung.com>
2023-05-15 8:16 ` Pankaj Raghav
2023-05-15 8:31 ` Ritesh Harjani
2023-05-15 13:23 ` Pankaj Raghav
2023-05-15 15:15 ` Brian Foster
2023-05-16 14:49 ` Ritesh Harjani
2023-05-16 19:29 ` Brian Foster
2023-05-17 15:20 ` Ritesh Harjani
2023-05-17 18:48 ` Brian Foster
2023-05-18 13:23 ` Christoph Hellwig
2023-05-18 16:15 ` Matthew Wilcox
2023-05-22 4:33 ` Ritesh Harjani
2023-05-22 4:48 ` Matthew Wilcox
2023-05-22 11:18 ` Brian Foster
2023-05-23 0:56 ` Darrick J. Wong
2023-05-23 12:15 ` Brian Foster
2023-05-23 13:43 ` Ritesh Harjani
2023-05-23 14:44 ` Brian Foster
2023-05-23 15:02 ` Ritesh Harjani
2023-05-23 15:22 ` Brian Foster
2023-05-23 15:38 ` Ritesh Harjani
2023-05-23 15:59 ` Matthew Wilcox
2023-05-18 13:27 ` Christoph Hellwig
2023-05-19 16:08 ` Ritesh Harjani
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=ZGJLKdJeNzAtjSZb@bfoster \
--to=bfoster@redhat.com \
--cc=david@fromorbit.com \
--cc=disgoel@linux.ibm.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=ojaswin@linux.ibm.com \
--cc=ritesh.list@gmail.com \
--cc=willy@infradead.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).