From patchwork Tue Dec 6 05:36:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yue Hu X-Patchwork-Id: 30087 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2646854wrr; Mon, 5 Dec 2022 21:45:52 -0800 (PST) X-Google-Smtp-Source: AA0mqf4uFTr/RA2Fiqe6F0QV8kZ/TBeznyE3bXAyUy1us/FEJFXdngR2QY8qwr6RVVsiB70wWytP X-Received: by 2002:aa7:db19:0:b0:46b:fc0d:ddc0 with SMTP id t25-20020aa7db19000000b0046bfc0dddc0mr18647227eds.214.1670305551925; Mon, 05 Dec 2022 21:45:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670305551; cv=none; d=google.com; s=arc-20160816; b=DiU22D/FWCnaMC65mXSoHZckqWjDotSVP+MRt+cQBzHAc4mimw7Va+zriVvgLFFi7u qZK6hK6PVAelWM39/afUPo3VRlmP/D5YDPuWa7QMcOpgFEC31M6wFGjM7Lq2lsBqSMcR F50Kfw6TonmYLSBXO/nrPcxZwueLmeWo4f+8tQXCfV+gqo0navc+DM5fLORwPgD/HYOt PMuSlC5cMv69A1/+iDyli/ipd/WP59ZQsxrhsnfJAn7/yN25vI4rBUrANT7mFXaXSJmz bj1dBwtwi1Sltz0OL/TjmZs4XnoRLZ+XOBt7zfV+YN61pkBD+iudwEu/ptaOtScs8lCa UltQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=QQZFshjqB4wtFOz2UdJmUUSt4cp78Rg6R2ZZnizTKMg=; b=I+6s4aT1pcMYHSCU6AWYx2Af1OVRbu5TbFcXYbo0u7lF0rVjjmuXJVBqPCMZr1eR8m 4YhJNaIhEQ7PHmC57RL7/6dXI1qig7SNksnRYdyDoUuFFh1xCSYrU75ErYRh4v5RA4KD /0go8eu7FR/rMhnS3C9fljtJdrVdAz/4CsIqk+ULF94FLAy2XnnvrTE12+wKh1xKNRTr STlZtxo46oh/pXIcvb3uqaSqjr0xylsFMOhtCO9VyDUGTqJuFkv2avnvHVyk5Kn8qvUU DP5XJu81+gTri3E1V35+fiGwacAfb2mVPab+Fe2vncRMS7fHkG6d0T+gliztuI2JwPMa WnFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=l3HsB9xf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ck26-20020a0564021c1a00b0046c0ff54c7csi1010173edb.189.2022.12.05.21.45.25; Mon, 05 Dec 2022 21:45:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=l3HsB9xf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232584AbiLFFhV (ORCPT + 99 others); Tue, 6 Dec 2022 00:37:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232543AbiLFFhK (ORCPT ); Tue, 6 Dec 2022 00:37:10 -0500 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8797D23143 for ; Mon, 5 Dec 2022 21:37:06 -0800 (PST) Received: by mail-pj1-x102f.google.com with SMTP id b13-20020a17090a5a0d00b0021906102d05so13707887pjd.5 for ; Mon, 05 Dec 2022 21:37:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QQZFshjqB4wtFOz2UdJmUUSt4cp78Rg6R2ZZnizTKMg=; b=l3HsB9xfeGFcIIP515/iK95rBFJKDGwlVkcARHwqen0mD40gKB/Yn7NQZyMWoudwjy 8MRXlW5s5bDKsqGU9Cak0jPqZQ1Flu0kG88Ie3Dr+ZI4glRiK1WUm47/ROQ3fBT3/bHC ZkOVdc+qklLxFuW924h1qsdp+RifGP3HnFdyVA8jJuqcy4YKYM10nFRXI1bg23grsl0t YiShF0ICEgoV3CoKI0uxzWjbHUo/H5RdG7V2Pb6WYtAlfiwcP7rFaRQ0wbPU80WkrqW3 5OQYyLRj36leTdvt//Wj+JsMmrCk8zUsjEioanMIoDiSDsFKZz6ksGO5kTInOYW0YD6+ oWIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QQZFshjqB4wtFOz2UdJmUUSt4cp78Rg6R2ZZnizTKMg=; b=um2qDIfCfx+rsprT5Ka+U0D4mKfl87WsDUHezXCsJdhwJL7NnnuUweKgD5XMxNcrWf ZQCs6Pq3SuqK9z23x4ncOIwiWW6m+81Upvka3JiI/Vew2fIQfnuYwotUJqMzhr+f/nai npwQLnEI4ytDM7DyoT3QFT90ioWKYbJH/2EXrJx4l1qaacxHa0W2Uwe8Xun07kfNV8uB HD8rpYtoxw1PlnBVhjUsiHN3niP7uutgz0oKWkZnTALNusjz3C4QgVb0ef7fXepACrZM CcHhW+f0CmCqpRmgBTMzU9aJivX9jBJ49Ve79z7LW3uB9+ctzZVjXifDO/Lzw5O2iaKr JdhQ== X-Gm-Message-State: ANoB5pn3P1tLG4COJA6ysasbFu++yPguXEo2jwIpaPQ2gEo3qudk85o/ jsb84riE5OwNApOa3No4b7nEL190GHY= X-Received: by 2002:a17:902:e311:b0:189:c7f1:c2a1 with SMTP id q17-20020a170902e31100b00189c7f1c2a1mr13885211plc.141.1670305026035; Mon, 05 Dec 2022 21:37:06 -0800 (PST) Received: from localhost.localdomain ([156.236.96.165]) by smtp.gmail.com with ESMTPSA id nk13-20020a17090b194d00b00219feae9486sm357964pjb.7.2022.12.05.21.37.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 21:37:05 -0800 (PST) From: Yue Hu To: xiang@kernel.org, chao@kernel.org, linux-erofs@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, zhangwen@coolpad.com, Yue Hu Subject: [PATCH] erofs: fix missing continue for !shouldalloc in z_erofs_bind_cache() Date: Tue, 6 Dec 2022 13:36:33 +0800 Message-Id: <20221206053633.4251-1-zbestahu@gmail.com> X-Mailer: git-send-email 2.17.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751442314848060649?= X-GMAIL-MSGID: =?utf-8?q?1751442314848060649?= From: Yue Hu Do cmpxchg_relaxed() is only for successful allocation if I/O is needed. Fixes: 69b511baa0be ("erofs: clean up cached I/O strategies") Signed-off-by: Yue Hu --- fs/erofs/zdata.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c index 2584a62c9d28..b66c16473273 100644 --- a/fs/erofs/zdata.c +++ b/fs/erofs/zdata.c @@ -333,19 +333,19 @@ static void z_erofs_bind_cache(struct z_erofs_decompress_frontend *fe, } else { /* I/O is needed, no possible to decompress directly */ standalone = false; - if (shouldalloc) { - /* - * try to use cached I/O if page allocation - * succeeds or fallback to in-place I/O instead - * to avoid any direct reclaim. - */ - newpage = erofs_allocpage(pagepool, gfp); - if (!newpage) - continue; - set_page_private(newpage, - Z_EROFS_PREALLOCATED_PAGE); - t = tag_compressed_page_justfound(newpage); - } + if (!shouldalloc) + continue; + + /* + * try to use cached I/O if page allocation + * succeeds or fallback to in-place I/O instead + * to avoid any direct reclaim. + */ + newpage = erofs_allocpage(pagepool, gfp); + if (!newpage) + continue; + set_page_private(newpage, Z_EROFS_PREALLOCATED_PAGE); + t = tag_compressed_page_justfound(newpage); } if (!cmpxchg_relaxed(&pcl->compressed_bvecs[i].page, NULL,