From patchwork Sun Dec 10 02:50:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Yu X-Patchwork-Id: 176262 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp6340471vqy; Sat, 9 Dec 2023 19:05:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IFRr7MQ7qk8IPagjCpx9s4Zrar2LtrkloYFm7n8tuXgOa4Hl/I6jJqTxW5q/s05MiryiSo+ X-Received: by 2002:a05:6a00:1956:b0:6cd:fe6e:ac9b with SMTP id s22-20020a056a00195600b006cdfe6eac9bmr2867790pfk.0.1702177522200; Sat, 09 Dec 2023 19:05:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702177522; cv=none; d=google.com; s=arc-20160816; b=c0Rw/yd2e361doRPYhnItWFEHC2Ih2diCzTtRYY/loiEa9O0Xam7efxrg0H3MFCsR+ L/GsZQtJRzzPg25LZ9YwuDYhLBqT93ewVNsyYrIgNs4dJ7Gwnqd0UGuWviQzocAe57eh hDpyi3WZBpXHj1a9P8C6WAADlRW1dmTXI42MDl7N3+MZr8SYtIoMQfwPbKLTng5K7ZUs AkbBJZI67oqviqdqs/hUwZkVOmjodT4I9NJ+iDGAJcWn04IcggXUuZghoK9CYiY/r262 IM6IG0e3hCLhLnYiFDB/rbAr99B+0HQgYrkjKM0h2gJFZyU1Ev6Uh16wrjr05wCiiPs1 59lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=hG0kqq92zIXi0MBxRd6CIuJJsvrQ+mQMf8SE/OxDU+Q=; fh=U/2TN44sUOGrnVqwzkduEfLuoE2WE3W8MDIVfCQUKMA=; b=Sps8ofiXMTk17geTlADVV9n0IZG3V06XV389+9OAKbEzMT0SwHN56Lo43mc5KTCDwI NhTrSrb2X1IqTFShvWsMYi/qqTQWCeP0b3CgpBcUIlC5eeGBYagxEtrBMUyRZ0pbcz+f YSuFMeqCpFc1WT3MC9FOHfghnKkeMRI75RCjmysmQtKlHqvM50x6ZIFmdik3ZGTMx80i pSvmqHXf7QKFHepPeT8JOFPYTIX1BufloZa7t0mdKJqlDDks+wu8ajwBR/mKx8E60oxH kK2mHYhQi30dlY9AWcKqIROouwFCmuYYm4ptglS60O3fYjbULdVuqK7NaxMgqlTgh9mH Upsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="pvK/Nj6p"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id f22-20020a056a0022d600b006cea47262d2si3890615pfj.375.2023.12.09.19.05.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Dec 2023 19:05:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="pvK/Nj6p"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 5A60A8087FDD; Sat, 9 Dec 2023 19:05:19 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229556AbjLJCud (ORCPT + 99 others); Sat, 9 Dec 2023 21:50:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229488AbjLJCuc (ORCPT ); Sat, 9 Dec 2023 21:50:32 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57AAA11C for ; Sat, 9 Dec 2023 18:50:39 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7CAA6C433C7; Sun, 10 Dec 2023 02:50:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702176638; bh=Fy8/AA1OD+Qy+g3LE8R4kVkWVk6a6OxVXAjg9c/oDIY=; h=From:To:Cc:Subject:Date:From; b=pvK/Nj6puZuR4qQ1zHHitiOZsigt1+4HGBsGrDBtfYr7I50hE0hsH4ukQRJkB5KXR KrKWRD85V7B6RFQ/Cwrenir26zuliG7KuCZQ7iZ4lI7fSlfVnGU+4ukwXHwIU8jQCN oAUX9lcCad82VeK3SOWuSjiUK2CSMnP/8uyHSkEJRSm4NlC3hFBp3ouBPAbw/M9NSF dB7TcGXF6SWOwINTJN5vCkWmuYyT40AlXoIfIMZI2hASjWU5ujvOmfYYlvNZ0vNqV1 PtEquO9imX3chXv/W+8R34SmTbR/jvME5P6+ORCJQzNqk/6vFBDcUV8R2eDUKeo+C6 mygp0yaGKV5aQ== From: Chao Yu To: jack@suse.com Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, chao@kernel.org Subject: [PATCH] quota: convert dquot_claim_space_nodirty() to return void Date: Sun, 10 Dec 2023 10:50:28 +0800 Message-Id: <20231210025028.3262900-1-chao@kernel.org> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Sat, 09 Dec 2023 19:05:19 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784862497585201829 X-GMAIL-MSGID: 1784862497585201829 dquot_claim_space_nodirty() always return zero, let's convert it to return void, then, its caller can get rid of handling failure case. Signed-off-by: Chao Yu --- fs/quota/dquot.c | 6 +++--- include/linux/quotaops.h | 15 +++++---------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index 58b5de081b57..44ff2813ae51 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c @@ -1787,7 +1787,7 @@ EXPORT_SYMBOL(dquot_alloc_inode); /* * Convert in-memory reserved quotas to real consumed quotas */ -int dquot_claim_space_nodirty(struct inode *inode, qsize_t number) +void dquot_claim_space_nodirty(struct inode *inode, qsize_t number) { struct dquot **dquots; int cnt, index; @@ -1797,7 +1797,7 @@ int dquot_claim_space_nodirty(struct inode *inode, qsize_t number) *inode_reserved_space(inode) -= number; __inode_add_bytes(inode, number); spin_unlock(&inode->i_lock); - return 0; + return; } dquots = i_dquot(inode); @@ -1822,7 +1822,7 @@ int dquot_claim_space_nodirty(struct inode *inode, qsize_t number) spin_unlock(&inode->i_lock); mark_all_dquot_dirty(dquots); srcu_read_unlock(&dquot_srcu, index); - return 0; + return; } EXPORT_SYMBOL(dquot_claim_space_nodirty); diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h index 4fa4ef0a173a..06cc8888199e 100644 --- a/include/linux/quotaops.h +++ b/include/linux/quotaops.h @@ -74,7 +74,7 @@ void __dquot_free_space(struct inode *inode, qsize_t number, int flags); int dquot_alloc_inode(struct inode *inode); -int dquot_claim_space_nodirty(struct inode *inode, qsize_t number); +void dquot_claim_space_nodirty(struct inode *inode, qsize_t number); void dquot_free_inode(struct inode *inode); void dquot_reclaim_space_nodirty(struct inode *inode, qsize_t number); @@ -257,10 +257,9 @@ static inline void __dquot_free_space(struct inode *inode, qsize_t number, inode_sub_bytes(inode, number); } -static inline int dquot_claim_space_nodirty(struct inode *inode, qsize_t number) +static inline void dquot_claim_space_nodirty(struct inode *inode, qsize_t number) { inode_add_bytes(inode, number); - return 0; } static inline int dquot_reclaim_space_nodirty(struct inode *inode, @@ -358,14 +357,10 @@ static inline int dquot_reserve_block(struct inode *inode, qsize_t nr) DQUOT_SPACE_WARN|DQUOT_SPACE_RESERVE); } -static inline int dquot_claim_block(struct inode *inode, qsize_t nr) +static inline void dquot_claim_block(struct inode *inode, qsize_t nr) { - int ret; - - ret = dquot_claim_space_nodirty(inode, nr << inode->i_blkbits); - if (!ret) - mark_inode_dirty_sync(inode); - return ret; + dquot_claim_space_nodirty(inode, nr << inode->i_blkbits); + mark_inode_dirty_sync(inode); } static inline void dquot_reclaim_block(struct inode *inode, qsize_t nr)