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 C9F38C678D4 for ; Fri, 3 Mar 2023 07:58:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229703AbjCCH6v (ORCPT ); Fri, 3 Mar 2023 02:58:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229502AbjCCH6r (ORCPT ); Fri, 3 Mar 2023 02:58:47 -0500 Received: from dggsgout12.his.huawei.com (dggsgout12.his.huawei.com [45.249.212.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F68F43938; Thu, 2 Mar 2023 23:58:45 -0800 (PST) Received: from mail02.huawei.com (unknown [172.30.67.169]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4PSgMh2cFcz4f3lxC; Fri, 3 Mar 2023 15:58:40 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.127.227]) by APP3 (Coremail) with SMTP id _Ch0CgCnUyGwqAFkWC0HEQ--.51341S5; Fri, 03 Mar 2023 15:58:42 +0800 (CST) From: Ye Bin To: tytso@mit.edu, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org Cc: linux-kernel@vger.kernel.org, jack@suse.cz, Ye Bin Subject: [PATCH v2 1/2] ext4: introduce 'update_only' parameter for ext4_find_inline_data_nolock() Date: Fri, 3 Mar 2023 16:21:57 +0800 Message-Id: <20230303082158.4012809-2-yebin@huaweicloud.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230303082158.4012809-1-yebin@huaweicloud.com> References: <20230303082158.4012809-1-yebin@huaweicloud.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: _Ch0CgCnUyGwqAFkWC0HEQ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-SenderInfo: p1hex046kxt4xhlfz01xgou0bp/ X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ye Bin Introduce 'update_only' parameter for ext4_find_inline_data_nolock() to use this function to update 'inline_off' only. Signed-off-by: Ye Bin --- fs/ext4/ext4.h | 2 +- fs/ext4/inline.c | 7 ++++--- fs/ext4/inode.c | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 4eeb02d456a9..b073976f4bf2 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -3545,7 +3545,7 @@ extern loff_t ext4_llseek(struct file *file, loff_t offset, int origin); /* inline.c */ extern int ext4_get_max_inline_size(struct inode *inode); -extern int ext4_find_inline_data_nolock(struct inode *inode); +extern int ext4_find_inline_data_nolock(struct inode *inode, bool update_only); extern int ext4_init_inline_data(handle_t *handle, struct inode *inode, unsigned int len); extern int ext4_destroy_inline_data(handle_t *handle, struct inode *inode); diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c index 2b42ececa46d..0fa8f41de3de 100644 --- a/fs/ext4/inline.c +++ b/fs/ext4/inline.c @@ -126,7 +126,7 @@ int ext4_get_max_inline_size(struct inode *inode) * currently only used in a code path coming form ext4_iget, before * the new inode has been unlocked */ -int ext4_find_inline_data_nolock(struct inode *inode) +int ext4_find_inline_data_nolock(struct inode *inode, bool update_only) { struct ext4_xattr_ibody_find is = { .s = { .not_found = -ENODATA, }, @@ -159,7 +159,8 @@ int ext4_find_inline_data_nolock(struct inode *inode) (void *)ext4_raw_inode(&is.iloc)); EXT4_I(inode)->i_inline_size = EXT4_MIN_INLINE_DATA_SIZE + le32_to_cpu(is.s.here->e_value_size); - ext4_set_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA); + if (!update_only) + ext4_set_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA); } out: brelse(is.iloc.bh); @@ -761,7 +762,7 @@ int ext4_write_inline_data_end(struct inode *inode, loff_t pos, unsigned len, * ext4_write_begin() called * ext4_try_to_write_inline_data() */ - (void) ext4_find_inline_data_nolock(inode); + (void) ext4_find_inline_data_nolock(inode, false); kaddr = kmap_atomic(page); ext4_write_inline_data(inode, &iloc, kaddr, pos, copied); diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index d251d705c276..6ecaa1bef9bb 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -4798,7 +4798,7 @@ static inline int ext4_iget_extra_inode(struct inode *inode, if (EXT4_INODE_HAS_XATTR_SPACE(inode) && *magic == cpu_to_le32(EXT4_XATTR_MAGIC)) { ext4_set_inode_state(inode, EXT4_STATE_XATTR); - return ext4_find_inline_data_nolock(inode); + return ext4_find_inline_data_nolock(inode, false); } else EXT4_I(inode)->i_inline_off = 0; return 0; -- 2.31.1