From nobody Tue Sep 9 22:46:26 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F541C61DA3 for ; Tue, 21 Feb 2023 10:33:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233738AbjBUKdW (ORCPT ); Tue, 21 Feb 2023 05:33:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232115AbjBUKdU (ORCPT ); Tue, 21 Feb 2023 05:33:20 -0500 Received: from out30-101.freemail.mail.aliyun.com (out30-101.freemail.mail.aliyun.com [115.124.30.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8455F7ED9 for ; Tue, 21 Feb 2023 02:33:17 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R321e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045168;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=3;SR=0;TI=SMTPD_---0VcC1Vwm_1676975594; Received: from localhost(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0VcC1Vwm_1676975594) by smtp.aliyun-inc.com; Tue, 21 Feb 2023 18:33:15 +0800 From: Jingbo Xu To: dhowells@redhat.com, linux-cachefs@redhat.com Cc: linux-kernel@vger.kernel.org Subject: [PATCH 1/2] cachefiles: don't align the write IO in ondemand mode Date: Tue, 21 Feb 2023 18:33:12 +0800 Message-Id: <20230221103313.120834-2-jefflexu@linux.alibaba.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20230221103313.120834-1-jefflexu@linux.alibaba.com> References: <20230221103313.120834-1-jefflexu@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" If the write IO requested by the user daemon is not aligned with the block size of the backing filesystem, it's expected to fail directly rather than submit the aligned write IO (with expanded file range unmatching with the given iov_iter). Signed-off-by: Jingbo Xu --- fs/cachefiles/ondemand.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/cachefiles/ondemand.c b/fs/cachefiles/ondemand.c index 0254ed39f68c..c017aca2a8a2 100644 --- a/fs/cachefiles/ondemand.c +++ b/fs/cachefiles/ondemand.c @@ -52,7 +52,8 @@ static ssize_t cachefiles_ondemand_fd_write_iter(struct k= iocb *kiocb, return -ENOBUFS; =20 cachefiles_begin_secure(cache, &saved_cred); - ret =3D __cachefiles_prepare_write(object, file, &pos, &len, true); + ret =3D cachefiles_has_space(cache, 0, len >> cache->bshift, + cachefiles_has_space_for_write); cachefiles_end_secure(cache, saved_cred); if (ret < 0) return ret; --=20 2.19.1.6.gb485710b