Linux XFS filesystem development
 help / color / mirror / Atom feed
From: Pankaj Raghav <pankaj.raghav@linux.dev>
To: Jeff Layton <jlayton@kernel.org>, Christoph Hellwig <hch@lst.de>
Cc: Andres Freund <andres@anarazel.de>,
	linux-xfs@vger.kernel.org, Carlos Maiolino <cem@kernel.org>,
	Christian Brauner <brauner@kernel.org>,
	gost.dev@samsung.com, p.raghav@samsung.com
Subject: Re: Increase in XFS journal flushes with (direct_write;fdatasync)+
Date: Fri, 8 May 2026 13:47:58 +0200	[thread overview]
Message-ID: <334a4d92-887d-4572-b153-25906148601e@linux.dev> (raw)
In-Reply-To: <08a84b78e83a61b7dd661df32ac31d87b98ccc9c.camel@kernel.org>


>> The comment needs to explain the why and not the how.   AFAICS the
>> why is that lazytime is not propagated to the disk at this mount,
>> so incrementing i_version should not happen, but I'm adding Jeff
>> for insights.
>>
>>
> 
> That looks correct to me. I think the logic here is:
> 
> If we're going to disk anyway, then we might as well force an i_version
> update. In the case where we're not (dirty == I_DIRTY_TIME), then we
> only want to do an i_version update if someone has queried it. If an
> i_version update does occur, then we need to go to disk by setting
> I_DIRTY_SYNC.

Does this reflect the why:

diff --git a/fs/inode.c b/fs/inode.c
index 6a3cbc7dcd28..62c579a0cf7d 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -2124,7 +2124,13 @@ static int inode_update_cmtime(struct inode *inode, unsigned int flags)
                            inode_iversion_need_inc(inode))
                                return -EAGAIN;
                } else {
-                       if (inode_maybe_inc_iversion(inode, !!dirty))
+                       /*
+                        * Don't force iversion increment for pure lazytime
+                        * updates (I_DIRTY_TIME only), let I_VERSION_QUERIED
+                        * dictate whether the increment is needed.
+                        */
+                       if (inode_maybe_inc_iversion(inode,
+                                                    dirty != I_DIRTY_TIME))
                                dirty |= I_DIRTY_SYNC;
                }
        }


--
Pankaj

  reply	other threads:[~2026-05-08 11:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <IS8F8EYS5pW4UU5a3jxOTy-f18EgkDa_2zAUswRgTm6NVtvmajAaQyu9CDxkTelDnfXfCl7L_692C77zRAxwFQ==@protonmail.internalid>
2026-05-06 13:26 ` Increase in XFS journal flushes with (direct_write;fdatasync)+ Andres Freund
2026-05-06 15:05   ` Carlos Maiolino
2026-05-07 20:34   ` Pankaj Raghav (Samsung)
2026-05-08  8:10     ` Christoph Hellwig
2026-05-08  8:29       ` Pankaj Raghav
2026-05-08  8:43         ` Christoph Hellwig
2026-05-08 11:42           ` Jeff Layton
2026-05-08 11:47             ` Pankaj Raghav [this message]
2026-05-11  8:56               ` Christoph Hellwig
2026-05-11 10:31                 ` Pankaj Raghav

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=334a4d92-887d-4572-b153-25906148601e@linux.dev \
    --to=pankaj.raghav@linux.dev \
    --cc=andres@anarazel.de \
    --cc=brauner@kernel.org \
    --cc=cem@kernel.org \
    --cc=gost.dev@samsung.com \
    --cc=hch@lst.de \
    --cc=jlayton@kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=p.raghav@samsung.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox