mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Viacheslav Dubeyko <vdubeyko@redhat.com>
To: Max Kellermann <max.kellermann@ionos.com>
Cc: idryomov@gmail.com, amarkuze@redhat.com,
	ceph-devel@vger.kernel.org,  dhowells@redhat.com,
	pc@manguebit.org, netfs@lists.linux.dev,
	 linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ceph: do not fill fscache for RWF_DONTCACHE writeback
Date: Fri, 03 Apr 2026 10:18:21 -0700	[thread overview]
Message-ID: <ff8929f3cc1ceb1fef43f292c9c5926a25d8336a.camel@redhat.com> (raw)
In-Reply-To: <CAKPOu+9FvR-ZdhcQc-+KzVMgobCkrJpzEsJis2ekuz0zwC_qZQ@mail.gmail.com>

On Fri, 2026-04-03 at 08:52 +0200, Max Kellermann wrote:
> On Thu, Apr 2, 2026 at 9:44 PM Viacheslav Dubeyko <vdubeyko@redhat.com> wrote:
> > The Ceph write_begin path calls netfs_write_begin() but does not pass
> > IOCB_DONTCACHE through to trigger __folio_set_dropbehind. So,
> > folio_test_dropbehind() would never be true on the Ceph write path right now.
> > Does it make sense?
> 
> Yes, see:
> 
> > > ---
> > > Note: this is an additional feature on top of my Ceph-DONTCACHE patch,
> > > see https://lore.kernel.org/ceph-devel/20260401053109.1861724-1-max.kellermann@ionos.com/
> 
> The code in this patch is not reachable until my RWF_DONTCACHE patch
> is merged as well.
> 
> > Are you sure that caching should be always true? All other calls checks that
> > ceph_is_cache_enabled():
> > 
> > bool caching = ceph_is_cache_enabled(inode);
> 
> This function is only called if caching is enabled.

I think that such interface will be more clean and safe:

static inline void ceph_flush_fscache_write(struct inode *inode, u64 off, u64
*len, bool caching)

> 
> > 
> > > +     *len = 0;
> > > +}
> > 
> > 
> > The ceph_folio_is_cacheable() and ceph_flush_fscache_write() are out of
> > CONFIG_CEPH_FSCACHE. It doesn't look right.
> 
> All of the old code is out of CONFIG_CEPH_FSCACHE, too. Does the old
> code look right?

As far as I can see, all fscache code is under CONFIG_CEPH_FSCACHE compilation
option. If we have some issues with old code, then it makes sense to fix it. But
this code is fscache related and it should be under CONFIG_CEPH_FSCACHE
protection, from my point of view. Moreover, other fscache related code is under
CONFIG_CEPH_FSCACHE protection pretty above the code of these functions.

> 
> > > @@ -1412,11 +1427,14 @@ int ceph_submit_write(struct address_space *mapping,
> > >       bool caching = ceph_is_cache_enabled(inode);
> > >       u64 offset;
> > >       u64 len;
> > > +     u64 cache_offset, cache_len;
> > 
> > Why do you need to introduce the cache_offset and cache_len? We already have
> > offset and len.
> 
> These keep track of the region that should be submitted to fscache.
> Folios without "dropbehind" need to be excluded from that.
> 
> > >  new_request:
> > >       offset = ceph_fscrypt_page_offset(ceph_wbc->pages[0]);
> > >       len = ceph_wbc->wsize;
> > > +     cache_offset = 0;
> > 
> > Is it correct initialization? Frankly speaking, I don't quite follow why we need
> > such initialization.
> 
> Technically, cache_offset does not need to be initialized as long as
> cache_len is zero because then its value is never used. Would you feel
> more comfortable if I remove the unnecessary initializer? I wasn't
> sure which approach would raise fewer eyebrows.

I am simply trying to follow why we need in cache_offset. We are using the
offset currently:

/* Kick off an fscache write with what we have so far. */
ceph_fscache_write_to_cache(inode, offset, len, caching);


Why the offset is not good enough?

Thanks,
Slava.


  reply	other threads:[~2026-04-03 17:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-01 20:56 Max Kellermann
2026-04-02 19:44 ` Viacheslav Dubeyko
2026-04-03  6:52   ` Max Kellermann
2026-04-03 17:18     ` Viacheslav Dubeyko [this message]
2026-04-03 18:13       ` Max Kellermann

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=ff8929f3cc1ceb1fef43f292c9c5926a25d8336a.camel@redhat.com \
    --to=vdubeyko@redhat.com \
    --cc=amarkuze@redhat.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=dhowells@redhat.com \
    --cc=idryomov@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=max.kellermann@ionos.com \
    --cc=netfs@lists.linux.dev \
    --cc=pc@manguebit.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

all inboxes | Powered by JetHome®