From: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
Christoph Hellwig <hch@infradead.org>,
"Darrick J. Wong" <djwong@kernel.org>,
Matthew Wilcox <willy@infradead.org>,
Dave Chinner <david@fromorbit.com>,
Brian Foster <bfoster@redhat.com>,
Andreas Gruenbacher <agruenba@redhat.com>,
Ojaswin Mujoo <ojaswin@linux.ibm.com>,
Disha Goel <disgoel@linux.ibm.com>,
Aravinda Herle <araherle@in.ibm.com>
Subject: Re: [PATCHv9 6/6] iomap: Add per-block dirty state tracking to improve performance
Date: Mon, 12 Jun 2023 14:30:05 +0530 [thread overview]
Message-ID: <875y7thx7u.fsf@doe.com> (raw)
In-Reply-To: <ZIa7dFb42FkI5jgp@infradead.org>
Christoph Hellwig <hch@infradead.org> writes:
> Just some nitpicks,
Sure.
> this otherwise looks fine.
Thanks for the review.
>
> First during the last patches ifs as a variable name has started
> to really annoy me and I'm not sure why. I'd like to hear from the
> others, bu maybe just state might be a better name that flows easier?
>
Ok. Let's hear from others too.
>> +static void iomap_clear_range_dirty(struct folio *folio, size_t off, size_t len)
>> +{
>> + struct iomap_folio_state *ifs = iomap_get_ifs(folio);
>> +
>> + if (!ifs)
>> + return;
>> + iomap_ifs_clear_range_dirty(folio, ifs, off, len);
>
> Maybe just do
>
> if (ifs)
> iomap_ifs_clear_range_dirty(folio, ifs, off, len);
>
> ?
Sure.
>
> But also do we even need the ifs argument to iomap_ifs_clear_range_dirty
> after we've removed it everywhere else earlier?
>
Some of the previous discussions / reasoning behind it -
- In one of the previous discussions we discussed that functions which
has _ifs_ in their naming, then it generally should imply that we will
be working on iomap_folio_state struct. So we should pass that as a
argument.
- Also in most of these *_ifs_* functions we have "ifs" as a non-null
function argument.
- At some places where we are calling these _ifs_ functions, we
already have derived ifs, so why not just pass it.
FYI - We dropped "ifs" argument in one of the function which is
iomap_set_range_uptodate(), because we would like this function
to work in both cases.
1. When we have non-null folio->private (ifs)
2. When it is null.
So API wise it looks good in my humble opinion. But sure, in
case if someone has better ideas, I can look into that.
>> + /*
>> + * When we have per-block dirty tracking, there can be
>> + * blocks within a folio which are marked uptodate
>> + * but not dirty. In that case it is necessary to punch
>> + * out such blocks to avoid leaking any delalloc blocks.
>> + */
>> + ifs = iomap_get_ifs(folio);
>> + if (!ifs)
>> + goto skip_ifs_punch;
>> +
>> + last_byte = min_t(loff_t, end_byte - 1,
>> + (folio_next_index(folio) << PAGE_SHIFT) - 1);
>> + first_blk = offset_in_folio(folio, start_byte) >> blkbits;
>> + last_blk = offset_in_folio(folio, last_byte) >> blkbits;
>> + for (i = first_blk; i <= last_blk; i++) {
>> + if (!iomap_ifs_is_block_dirty(folio, ifs, i)) {
>> + ret = punch(inode, folio_pos(folio) + (i << blkbits),
>> + 1 << blkbits);
>> + if (ret)
>> + goto out;
>> + }
>> + }
>> +
>> +skip_ifs_punch:
>
> And happy to hear from the others, but to me having a helper for
> all the iomap_folio_state manipulation rather than having it in
> the middle of the function and jumped over if not needed would
> improve the code structure.
I think Darrick was also pointing towards having a separate funciton.
But let's hear from him & others too. I can consider adding a separate
function for above.
Does this look good?
static int iomap_write_delalloc_ifs_punch(struct inode *inode, struct folio *folio,
struct iomap_folio_state *ifs, loff_t start_byte, loff_t end_byte,
int (*punch)(struct inode *inode, loff_t offset, loff_t length))
The function argument are kept similar to what we have for
iomap_write_delalloc_punch(), except maybe *punch_start_byte (which is
not required).
-ritesh
next prev parent reply other threads:[~2023-06-12 9:04 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
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 [this message]
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=875y7thx7u.fsf@doe.com \
--to=ritesh.list@gmail.com \
--cc=agruenba@redhat.com \
--cc=araherle@in.ibm.com \
--cc=bfoster@redhat.com \
--cc=david@fromorbit.com \
--cc=disgoel@linux.ibm.com \
--cc=djwong@kernel.org \
--cc=hch@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=ojaswin@linux.ibm.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