mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bernd Schubert <bernd@bsbernd.com>
To: Jingbo Xu <jefflexu@linux.alibaba.com>,
	miklos@szeredi.hu, linux-fsdevel@vger.kernel.org,
	bschubert@ddn.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] fuse: invalidate the page cache after direct write
Date: Fri, 9 Jan 2026 15:05:36 +0100	[thread overview]
Message-ID: <b8f7dd35-7702-4c70-be4f-0704abc1976d@bsbernd.com> (raw)
In-Reply-To: <20260109070110.18721-1-jefflexu@linux.alibaba.com>



On 1/9/26 08:01, Jingbo Xu wrote:
> -	return err ?: ia->write.out.size;
> +	/*
> +	 * As in generic_file_direct_write(), invalidate after the write, to
> +	 * invalidate read-ahead cache that may have competed with the write.
> +	 * Without FOPEN_DIRECT_IO, generic_file_direct_write() does the
> +	 * invalidation for synchronous write.
> +	 */
> +	if (!err && written && mapping->nrpages &&
> +	    ((ff->open_flags & FOPEN_DIRECT_IO) || !ia->io->blocking)) {
> +		invalidate_inode_pages2_range(mapping, pos >> PAGE_SHIFT,
> +					(pos + written - 1) >> PAGE_SHIFT);
> +	}
> +
> +	return err ?: written;
>  }

Sorry, but I'm confused about "|| !ia->io->blocking". When we go into this
code path it either via generic_file_direct_write(), which then
already invalidates or directly and then 
(ff->open_flags & FOPEN_DIRECT_IO) is set?


Thanks,
Bernd



  reply	other threads:[~2026-01-09 14:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-09  7:01 Jingbo Xu
2026-01-09 14:05 ` Bernd Schubert [this message]
2026-01-11  7:29   ` Jingbo Xu

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=b8f7dd35-7702-4c70-be4f-0704abc1976d@bsbernd.com \
    --to=bernd@bsbernd.com \
    --cc=bschubert@ddn.com \
    --cc=jefflexu@linux.alibaba.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /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

all inboxes | Powered by JetHome®