From: "Darrick J. Wong" <djwong@kernel.org>
To: Ritesh Harjani <ritesh.list@gmail.com>
Cc: Andreas Gruenbacher <agruenba@redhat.com>,
linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
Christoph Hellwig <hch@infradead.org>,
Matthew Wilcox <willy@infradead.org>,
Dave Chinner <david@fromorbit.com>,
Brian Foster <bfoster@redhat.com>,
Ojaswin Mujoo <ojaswin@linux.ibm.com>,
Disha Goel <disgoel@linux.ibm.com>
Subject: Re: [PATCHv9 3/6] iomap: Add some uptodate state handling helpers for ifs state bitmap
Date: Mon, 12 Jun 2023 09:16:17 -0700 [thread overview]
Message-ID: <20230612161617.GE11441@frogsfrogsfrogs> (raw)
In-Reply-To: <87ilbshf56.fsf@doe.com>
On Mon, Jun 12, 2023 at 09:00:29PM +0530, Ritesh Harjani wrote:
> Andreas Gruenbacher <agruenba@redhat.com> writes:
>
> > On Sat, Jun 10, 2023 at 1:39 PM Ritesh Harjani (IBM)
> > <ritesh.list@gmail.com> wrote:
> >> This patch adds two of the helper routines iomap_ifs_is_fully_uptodate()
> >> and iomap_ifs_is_block_uptodate() for managing uptodate state of
> >> ifs state bitmap.
> >>
> >> In later patches ifs state bitmap array will also handle dirty state of all
> >> blocks of a folio. Hence this patch adds some helper routines for handling
> >> uptodate state of the ifs state bitmap.
> >>
> >> Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
> >> ---
> >> fs/iomap/buffered-io.c | 28 ++++++++++++++++++++--------
> >> 1 file changed, 20 insertions(+), 8 deletions(-)
> >>
> >> diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
> >> index e237f2b786bc..206808f6e818 100644
> >> --- a/fs/iomap/buffered-io.c
> >> +++ b/fs/iomap/buffered-io.c
> >> @@ -43,6 +43,20 @@ static inline struct iomap_folio_state *iomap_get_ifs(struct folio *folio)
> >>
> >> static struct bio_set iomap_ioend_bioset;
> >>
> >> +static inline bool iomap_ifs_is_fully_uptodate(struct folio *folio,
> >> + struct iomap_folio_state *ifs)
> >> +{
> >> + struct inode *inode = folio->mapping->host;
> >> +
> >> + return bitmap_full(ifs->state, i_blocks_per_folio(inode, folio));
> >
> > This should be written as something like:
> >
> > unsigned int blks_per_folio = i_blocks_per_folio(inode, folio);
> > return bitmap_full(ifs->state + IOMAP_ST_UPTODATE * blks_per_folio,
> > blks_per_folio);
> >
>
> Nah, I feel it is not required... It make sense when we have the same
> function getting use for both "uptodate" and "dirty" state.
> Here the function anyways operates on uptodate state.
> Hence I feel it is not required.
Honestly I thought that enum-for-bits thing was excessive considering
that ifs has only two state bits. But, since you included it, it
doesn't make much sense /not/ to use it here.
OTOH, if you disassemble the object code and discover that the compiler
*isn't* using constant propagation to simplify the object code, then
yes, that would be a good reason to get rid of it.
--D
> >> +}
> >> +
> >> +static inline bool iomap_ifs_is_block_uptodate(struct iomap_folio_state *ifs,
> >> + unsigned int block)
> >> +{
> >> + return test_bit(block, ifs->state);
> >
> > This function should be called iomap_ifs_block_is_uptodate(), and
> > probably be written as follows, passing in the folio as well (this
> > will optimize out, anyway):
> >
> > struct inode *inode = folio->mapping->host;
> > unsigned int blks_per_folio = i_blocks_per_folio(inode, folio);
> > return test_bit(block, ifs->state + IOMAP_ST_UPTODATE * blks_per_folio);
> >
>
> Same here.
>
> -ritesh
next prev parent reply other threads:[~2023-06-12 16:16 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-10 11:39 [PATCHv9 0/6] iomap: Add support for per-block dirty state to improve write performance Ritesh Harjani (IBM)
2023-06-10 11:39 ` [PATCHv9 1/6] iomap: Rename iomap_page to iomap_folio_state and others Ritesh Harjani (IBM)
2023-06-12 6:21 ` Christoph Hellwig
2023-06-12 6:23 ` Christoph Hellwig
2023-06-12 9:19 ` Ritesh Harjani
2023-06-12 15:05 ` Darrick J. Wong
2023-06-12 15:08 ` Matthew Wilcox
2023-06-12 15:59 ` Darrick J. Wong
2023-06-12 17:43 ` Ritesh Harjani
2023-06-12 17:54 ` Matthew Wilcox
2023-06-13 5:05 ` Christoph Hellwig
2023-06-10 11:39 ` [PATCHv9 2/6] iomap: Drop ifs argument from iomap_set_range_uptodate() Ritesh Harjani (IBM)
2023-06-12 6:24 ` Christoph Hellwig
2023-06-10 11:39 ` [PATCHv9 3/6] iomap: Add some uptodate state handling helpers for ifs state bitmap Ritesh Harjani (IBM)
2023-06-12 6:25 ` Christoph Hellwig
2023-06-12 9:14 ` Ritesh Harjani
2023-06-12 12:54 ` Andreas Gruenbacher
2023-06-12 15:18 ` Ritesh Harjani
2023-06-12 15:24 ` Matthew Wilcox
2023-06-12 15:33 ` Ritesh Harjani
2023-06-12 15:57 ` Andreas Gruenbacher
2023-06-12 16:10 ` Darrick J. Wong
2023-06-12 17:54 ` Ritesh Harjani
2023-06-12 12:40 ` Andreas Gruenbacher
2023-06-12 15:30 ` Ritesh Harjani
2023-06-12 16:14 ` Andreas Grünbacher
2023-06-12 16:16 ` Darrick J. Wong [this message]
2023-06-12 16:19 ` Andreas Gruenbacher
2023-06-12 17:57 ` Ritesh Harjani
2023-06-10 11:39 ` [PATCHv9 4/6] iomap: Refactor iomap_write_delalloc_punch() function out Ritesh Harjani (IBM)
2023-06-12 6:25 ` Christoph Hellwig
2023-06-12 9:01 ` Ritesh Harjani
2023-06-12 13:22 ` Matthew Wilcox
2023-06-12 14:03 ` Ritesh Harjani
2023-06-12 14:19 ` Matthew Wilcox
2023-06-12 13:56 ` Pankaj Raghav
2023-06-12 14:55 ` Ritesh Harjani
2023-06-10 11:39 ` [PATCHv9 5/6] iomap: Allocate ifs in ->write_begin() early Ritesh Harjani (IBM)
2023-06-10 11:39 ` [PATCHv9 6/6] iomap: Add per-block dirty state tracking to improve performance Ritesh Harjani (IBM)
2023-06-12 6:30 ` Christoph Hellwig
2023-06-12 9:00 ` Ritesh Harjani
2023-06-12 16:27 ` Matthew Wilcox
2023-06-15 15:03 ` [PATCHv9 0/6] iomap: Add support for per-block dirty state to improve write performance Ritesh Harjani
2023-06-15 16:12 ` 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=20230612161617.GE11441@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=agruenba@redhat.com \
--cc=bfoster@redhat.com \
--cc=david@fromorbit.com \
--cc=disgoel@linux.ibm.com \
--cc=hch@infradead.org \
--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