From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D21163CCFDF for ; Fri, 3 Apr 2026 17:18:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775236710; cv=none; b=ZOsnflkCmLXbYcmfjPG+DWu9fTfdBZ4dlxmQ6IsgF6vM1wmJ0lyQLeJDbrs5vWWYH3wTAJDUt1ogQszUXKjd3uUoFKsFqE1CHykoBSP13fLwtJoie7zLvSOueorx6zHyx+25goEAFwIA3qqboodZ3pRH7b+GeLXW+aF8KMR5BiM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775236710; c=relaxed/simple; bh=Cvq5tuLj5ZY1DMhHPFEu+lE7/fw/C+ofjPzqyp3q+wU=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=DVkotZNDW8266F5xfBl6vI3t/d64GzM9mtiRiyTvlfQ/AGxMKpI8k2wmKhevjaquBs7FKEbNd7R0LXtJdPVPzyFs4m6R2bSvkLT24vX3wOot9uy4nPa+TvGZtu1iS80KTTbjjPgKelTkaxEVRpvmtsEwI4+QdjEswWPXp+REWxQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=H/onQm1j; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=TtGG9Fuc; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="H/onQm1j"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="TtGG9Fuc" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1775236706; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QTtM7wHX05jakm5x7iALH4OzPfU5pZiWtOLbV28TT+g=; b=H/onQm1jDTDcnplgOhY3lkd25noaX/SNgzCJqizhcedgbm5JcrNUL9yO836rFzkUaIc7o7 eI6rMLVerDRJ2RaiAvZRdM/cyAfn8MAl8zTbyLWexB3EcRvxG9UI5aQ9HzWWfDJyBqZMsq amCjMOY/u98oE3Rp0OtpoWmNBvyF8Pw= Received: from mail-oi1-f200.google.com (mail-oi1-f200.google.com [209.85.167.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-133-4wlHTVqeMFyvVcPWqTkZPw-1; Fri, 03 Apr 2026 13:18:26 -0400 X-MC-Unique: 4wlHTVqeMFyvVcPWqTkZPw-1 X-Mimecast-MFC-AGG-ID: 4wlHTVqeMFyvVcPWqTkZPw_1775236705 Received: by mail-oi1-f200.google.com with SMTP id 5614622812f47-467dceb8e77so5336737b6e.1 for ; Fri, 03 Apr 2026 10:18:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1775236705; x=1775841505; darn=vger.kernel.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=QTtM7wHX05jakm5x7iALH4OzPfU5pZiWtOLbV28TT+g=; b=TtGG9Fucx42gRq8YjpM3ui2Nst/fsorIKywH60Rh4WbYVx96mVVhI/HT4BZD+3wZdn IB6AHTkwQUePPRMnemvnTRKs9jIfqMOm6HMnx7DXoAMXCfgBEWvb+RpDZ0uWIq8mLONC ZkuP2VmOFbzEc54BTqb4sxvcovtYLpPdm1OWQsfEmRo2YCMAmhKh8IWsLUXypYE1J+KM SoEm304HAzVibXjVzd9dQjCfhR/3Qmse0JY5KGT8x26wOOgbdvvLum2hQp+ZsbIVCZQj K/Nw8FKvPMNA4oTwsY09s5LNAiBi9zq0zQGcBzBwKdH0S0YpujaXqif6YaOBlB3SLqUM R8mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775236705; x=1775841505; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=QTtM7wHX05jakm5x7iALH4OzPfU5pZiWtOLbV28TT+g=; b=Ub0w5W1OztQta92HWBX7WNtTENl40/WVSev95rANvkRUB0AC+YbokE1yi4VLVMAtcC RjbiXglVrEQHYxPsJ5BGsisZ8hUc1GD2YJWWWBwDWeCVBLGpreJBdND1HN0IWtMFIq3C aDOe/lkovQlz92GjlAW9PujTIQKasCAD7xcjzNqMORKhHlv+s+UqA1bSTo/k5yyKgT/b MILpqfYJJlzEKtftuBiqeEP46XYPsc+Q7iVCu0yJIE+8oo9wyQ1Mj57kWIMZ5SHVuxWM RQ7ToZa0Am6UfkzU9gnMdgS2o891+t69vZFnhg0io2m2L9KRaSYvab2LKszINUtYEu5D OwlQ== X-Forwarded-Encrypted: i=1; AJvYcCUzR5q5nN7OHv7RDmp9bbKIu3on60gXqKRqTnl0DVGK/hh3GzXRkOZtNtAMAX5SxGJ6FLwh/Ibb4+EuFGI=@vger.kernel.org X-Gm-Message-State: AOJu0YwTgkzgwgBE6ayJC5jmGSb1YJeNip3Ga74xmN3OUofsD8Xqe7xh D5nlJLy98KhcTgrLHSqGHjtM5BbjqPEkp6uwa83K+FK5m091LYUtAmvJTdsNB29/2RMdzSxuyrU /GKNiXihvt4Y2gvJDdJffhP9EuKrSSoOn4vjtiExlHxgwdIhCWBuCutJvJUVGYCSsPQ== X-Gm-Gg: ATEYQzxs+36vV1mMi6dGtItVSsSDdoGOiw6aNcgKhRUU68Odxnlzaj6k7KdkbfOSVvp 9JFQo5FGe8/pEDkwCDlHfr/AL8PdtiIHnAwIjk7XFHEF2+byT/5AfBUGMjak8dVoAwWLHjpN7S7 /mIkH3H5FG3pmNAychS3ZaiOD+Vj8Qj9fbd5Aw4YExQMNjOBHSB7kVo1Df7qNy0xhbiC9MbfAuU J+W4NrEhovPQ+NZYAc1HwS7SXu4IpjUYvUPJmhtW9ctButkoDx7yOgOoih3KWdcPYsYCQEOdZ1h TQ1kA9gxAEHk4exS/tbTnNStdILsotzHubIrudRAKtxp/HN7GRMfeCUYZUxLB6YYsI6TF60FmWQ rwV0DoBDg/XoHInA99LA0Fv/VdIFc7aHOk1zfCa5i/XBnVmymUfgh X-Received: by 2002:a05:6808:6503:b0:467:46e7:e6dd with SMTP id 5614622812f47-46ef5fed372mr1930300b6e.16.1775236705052; Fri, 03 Apr 2026 10:18:25 -0700 (PDT) X-Received: by 2002:a05:6808:6503:b0:467:46e7:e6dd with SMTP id 5614622812f47-46ef5fed372mr1930282b6e.16.1775236704582; Fri, 03 Apr 2026 10:18:24 -0700 (PDT) Received: from li-4c4c4544-0032-4210-804c-c3c04f423534.ibm.com ([2600:1700:6476:1430::29]) by smtp.gmail.com with ESMTPSA id 5614622812f47-46f0f4e16a9sm1611319b6e.4.2026.04.03.10.18.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2026 10:18:23 -0700 (PDT) Message-ID: Subject: Re: [PATCH] ceph: do not fill fscache for RWF_DONTCACHE writeback From: Viacheslav Dubeyko To: Max Kellermann 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 Date: Fri, 03 Apr 2026 10:18:21 -0700 In-Reply-To: References: <20260401205613.2095623-1-max.kellermann@ionos.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.3 (3.58.3-1.fc43app2) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Fri, 2026-04-03 at 08:52 +0200, Max Kellermann wrote: > On Thu, Apr 2, 2026 at 9:44=E2=80=AFPM Viacheslav Dubeyko 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 righ= t now. > > Does it make sense? >=20 > Yes, see: >=20 > > > --- > > > Note: this is an additional feature on top of my Ceph-DONTCACHE patch= , > > > see https://lore.kernel.org/ceph-devel/20260401053109.1861724-1-max.k= ellermann@ionos.com/ >=20 > The code in this patch is not reachable until my RWF_DONTCACHE patch > is merged as well. >=20 > > Are you sure that caching should be always true? All other calls checks= that > > ceph_is_cache_enabled(): > >=20 > > bool caching =3D ceph_is_cache_enabled(inode); >=20 > 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, u= 64 *len, bool caching) >=20 > >=20 > > > + *len =3D 0; > > > +} > >=20 > >=20 > > The ceph_folio_is_cacheable() and ceph_flush_fscache_write() are out of > > CONFIG_CEPH_FSCACHE. It doesn't look right. >=20 > 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 compilat= ion 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. >=20 > > > @@ -1412,11 +1427,14 @@ int ceph_submit_write(struct address_space *m= apping, > > > bool caching =3D ceph_is_cache_enabled(inode); > > > u64 offset; > > > u64 len; > > > + u64 cache_offset, cache_len; > >=20 > > Why do you need to introduce the cache_offset and cache_len? We already= have > > offset and len. >=20 > These keep track of the region that should be submitted to fscache. > Folios without "dropbehind" need to be excluded from that. >=20 > > > new_request: > > > offset =3D ceph_fscrypt_page_offset(ceph_wbc->pages[0]); > > > len =3D ceph_wbc->wsize; > > > + cache_offset =3D 0; > >=20 > > Is it correct initialization? Frankly speaking, I don't quite follow wh= y we need > > such initialization. >=20 > 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.