From patchwork Fri Aug 23 12:47:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Brauner X-Patchwork-Id: 13775098 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 80E7F136E2E for ; Fri, 23 Aug 2024 12:47:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724417278; cv=none; b=JOYjfMzU2Y6QOVTXq71Avg0yyTMLgQef4R07FWxAJnNqzy4roUBiiwBPpI4hgWGcQVXtrUFV2K3kSGD0RuZsY3xaTtbsqFaLoL08jVq+uJSybm897AmpM/WU9HJVP8jTk1A0RlbyyvKhrMchHA4BGPXzH+45woOTZIi6dYZsles= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724417278; c=relaxed/simple; bh=61lPVSIVWgcbJa/vf4tJiRjGajVW5ENGjIg6PqK1Lso=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=le2W2oPA+YRse3C40dfzCrznD7Z7Ae92k9mp9XyWlvKKnlK4hkjOeU+ElRDgPhAakzn2GYUj5sHq1G6iIpKK7uztDfSaZdhRkX6aEYaS04Of1RDMQZoG9jfdt2/rvJJEeNmKNKf8XMKRYTQtm9SmGhAS5O5veXlrwX75ZtueHh8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=iJoceh6i; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="iJoceh6i" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2CE2EC32786; Fri, 23 Aug 2024 12:47:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724417278; bh=61lPVSIVWgcbJa/vf4tJiRjGajVW5ENGjIg6PqK1Lso=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iJoceh6iE+jUug7tt+H5mAVdKnka92Pc20uqyoWl+cpZg1GrTmBJ/lhFX6iR3l8hu t3XKKVKN1MvKMPkQtSGa9oD9BybyX5NRMUCHxAVbxpH8TX9VdFFiL8Wf3dUD/A93Qf HjWKmhSBqNHBkaYZ6CluaN9fg7xOlUd9a6763201l705eLnlq84czQXNVC/Ukc/DlZ JD3n5QmY7UF+H40gnkMvbSDqghplF7y0poHLqNnqSacwKD8k8x2H/CUtDHtWjcK+gH qIYg4ugUvDbrZYj6uoc4FJvtcdw5s8IuyKU580xOBKpDSNjD6q0c/F/uqISyJ86nF5 qvkjkRiYWO61g== From: Christian Brauner To: Linus Torvalds Cc: Christian Brauner , NeilBrown , Peter Zijlstra , Ingo Molnar , Jeff Layton , Jan Kara , linux-fsdevel@vger.kernel.org Subject: [PATCH v3 1/6] fs: add i_state helpers Date: Fri, 23 Aug 2024 14:47:35 +0200 Message-ID: <20240823-work-i_state-v3-1-5cd5fd207a57@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240823-work-i_state-v3-0-5cd5fd207a57@kernel.org> References: <20240823-work-i_state-v3-0-5cd5fd207a57@kernel.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mailer: b4 0.15-dev-37811 X-Developer-Signature: v=1; a=openpgp-sha256; l=2093; i=brauner@kernel.org; h=from:subject:message-id; bh=61lPVSIVWgcbJa/vf4tJiRjGajVW5ENGjIg6PqK1Lso=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMaSdaHnzaY2Hmy5zk1N2CN/y8Na1/94ybr7Pbx1yzrnqf GWAoX9/RykLgxgXg6yYIotDu0m43HKeis1GmRowc1iZQIYwcHEKwESuP2H4HytyKPns/ma2yWwc DuLce6fcVU36+yjp71vtVGHH7DNM7IwMN2M/RiodetGzV9Jw1r3Yjm4mhgvVmwPePv6kni2zn0u ZGwA= X-Developer-Key: i=brauner@kernel.org; a=openpgp; fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624 The i_state member is an unsigned long so that it can be used with the wait bit infrastructure which expects unsigned long. This wastes 4 bytes which we're unlikely to ever use. Switch to using the var event wait mechanism using the address of the bit. Thanks to Linus for the address idea. Signed-off-by: Christian Brauner Reviewed-by: Jan Kara --- fs/inode.c | 11 +++++++++++ include/linux/fs.h | 15 +++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/fs/inode.c b/fs/inode.c index 154f8689457f..877c64a1bf63 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -472,6 +472,17 @@ static void __inode_add_lru(struct inode *inode, bool rotate) inode->i_state |= I_REFERENCED; } +struct wait_queue_head *inode_bit_waitqueue(struct wait_bit_queue_entry *wqe, + struct inode *inode, u32 bit) +{ + void *bit_address; + + bit_address = inode_state_wait_address(inode, bit); + init_wait_var_entry(wqe, bit_address, 0); + return __var_waitqueue(bit_address); +} +EXPORT_SYMBOL(inode_bit_waitqueue); + /* * Add inode to LRU if needed (inode is unused and clean). * diff --git a/include/linux/fs.h b/include/linux/fs.h index 23e7d46b818a..1d895b8cb801 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -744,6 +744,21 @@ struct inode { void *i_private; /* fs or device private pointer */ } __randomize_layout; +/* + * Get bit address from inode->i_state to use with wait_var_event() + * infrastructre. + */ +#define inode_state_wait_address(inode, bit) ((char *)&(inode)->i_state + (bit)) + +struct wait_queue_head *inode_bit_waitqueue(struct wait_bit_queue_entry *wqe, + struct inode *inode, u32 bit); + +static inline void inode_wake_up_bit(struct inode *inode, u32 bit) +{ + /* Caller is responsible for correct memory barriers. */ + wake_up_var(inode_state_wait_address(inode, bit)); +} + struct timespec64 timestamp_truncate(struct timespec64 t, struct inode *inode); static inline unsigned int i_blocksize(const struct inode *node) From patchwork Fri Aug 23 12:47:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Brauner X-Patchwork-Id: 13775099 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 20E06136E2E for ; Fri, 23 Aug 2024 12:48:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724417281; cv=none; b=WSKc05hEcFy1ZU/GydYY2WusGsRBXcSK8ZimZtRlskPTvj+KHXEpQgvCvdDvrLbdSB+Sk5p4xCi/t8+U2uj9TLMJQjMKQTlk+aIAgSiTsPWS6Z3PK/qmcGc2j1fmKd/L+DTaFv0lfWltcB03so0K9oTo2fK/IWvMpabvH5u2cek= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724417281; c=relaxed/simple; bh=1RT5slxrbwBkxDVq5dZF1s58WrwjB/UEkZTkg1cebts=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=u/zVH52ih+vOnlrQR1l44isgCFuKs7ACHyUdCeRW6Cs110hKO5sK3NzOyrAG8SNFOmvoHj1XrC714nAw6X0/kzIo48UftCGaZaWqPWBtN1QdpcOlWM70JQlGd0ML1qHQw0zvF8EJlCe3ziDphHh6vmSZLI+4eMKw+NmfyIV3tV0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lJXgF/hd; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lJXgF/hd" Received: by smtp.kernel.org (Postfix) with ESMTPSA id ADD51C32786; Fri, 23 Aug 2024 12:47:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724417280; bh=1RT5slxrbwBkxDVq5dZF1s58WrwjB/UEkZTkg1cebts=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lJXgF/hdI+6DkxbsJa6Lk2SM5KuS0gn+oynqjXPfNBYpdVwet5Xlgg/s3dUONUPZ8 r5vqAyqxXq1DYK0oR36krGkrAf0mGCR7nFwWlke2s7JW3vxvHQikopFpH8Y6spjJpc vw8tmsRy17OQ6se+MzVieMM9MRd+nhpUJEqMdQCfUMF6cv9q/wb2E5F7LjSOS7g+XK PRQ1ILbalZF7qyZ28XfWp4n9XOmfbsQ3Tu/GPRqSD2L51pS7BST3XZi+Ts9qSglvd9 b5LY+Clk0vrw/FkxhayYbmZF66qyadhIcD5wGaNcUUwbnU12Mt1Gu7al5WuMfAQxQW OrNP5LtjrR8yQ== From: Christian Brauner To: Linus Torvalds Cc: Christian Brauner , NeilBrown , Peter Zijlstra , Ingo Molnar , Jeff Layton , Jan Kara , linux-fsdevel@vger.kernel.org Subject: [PATCH v3 2/6] fs: reorder i_state bits Date: Fri, 23 Aug 2024 14:47:36 +0200 Message-ID: <20240823-work-i_state-v3-2-5cd5fd207a57@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240823-work-i_state-v3-0-5cd5fd207a57@kernel.org> References: <20240823-work-i_state-v3-0-5cd5fd207a57@kernel.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mailer: b4 0.15-dev-37811 X-Developer-Signature: v=1; a=openpgp-sha256; l=2105; i=brauner@kernel.org; h=from:subject:message-id; bh=1RT5slxrbwBkxDVq5dZF1s58WrwjB/UEkZTkg1cebts=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMaSdaHnzzGJDm9GuVUx7WDIs7f35l8xq790aZ+RQ4tLv1 Hm3RuBeRykLgxgXg6yYIotDu0m43HKeis1GmRowc1iZQIYwcHEKwETuH2Vk2CzZ352W/dFuezrf 9tPvW4K+Naz9kZDR4HyY32rmjKafmxn+Zz7gyXfyVn1nYveX65lc4QYb99/CrlFr7opuPt6zxi2 fDwA= X-Developer-Key: i=brauner@kernel.org; a=openpgp; fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624 so that we can use the first bits to derive unique addresses from i_state. Signed-off-by: Christian Brauner Reviewed-by: Jan Kara --- include/linux/fs.h | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/include/linux/fs.h b/include/linux/fs.h index 1d895b8cb801..f257f8fad7d0 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2417,28 +2417,32 @@ static inline void kiocb_clone(struct kiocb *kiocb, struct kiocb *kiocb_src, * i_count. * * Q: What is the difference between I_WILL_FREE and I_FREEING? + * + * __I_{SYNC,NEW,LRU_ISOLATING} are used to derive unique addresses to wait + * upon. There's one free address left. */ -#define I_DIRTY_SYNC (1 << 0) -#define I_DIRTY_DATASYNC (1 << 1) -#define I_DIRTY_PAGES (1 << 2) -#define __I_NEW 3 +#define __I_NEW 0 #define I_NEW (1 << __I_NEW) -#define I_WILL_FREE (1 << 4) -#define I_FREEING (1 << 5) -#define I_CLEAR (1 << 6) -#define __I_SYNC 7 +#define __I_SYNC 1 #define I_SYNC (1 << __I_SYNC) -#define I_REFERENCED (1 << 8) +#define __I_LRU_ISOLATING 2 +#define I_LRU_ISOLATING (1 << __I_LRU_ISOLATING) + +#define I_DIRTY_SYNC (1 << 3) +#define I_DIRTY_DATASYNC (1 << 4) +#define I_DIRTY_PAGES (1 << 5) +#define I_WILL_FREE (1 << 6) +#define I_FREEING (1 << 7) +#define I_CLEAR (1 << 8) +#define I_REFERENCED (1 << 9) #define I_LINKABLE (1 << 10) #define I_DIRTY_TIME (1 << 11) -#define I_WB_SWITCH (1 << 13) -#define I_OVL_INUSE (1 << 14) -#define I_CREATING (1 << 15) -#define I_DONTCACHE (1 << 16) -#define I_SYNC_QUEUED (1 << 17) -#define I_PINNING_NETFS_WB (1 << 18) -#define __I_LRU_ISOLATING 19 -#define I_LRU_ISOLATING (1 << __I_LRU_ISOLATING) +#define I_WB_SWITCH (1 << 12) +#define I_OVL_INUSE (1 << 13) +#define I_CREATING (1 << 14) +#define I_DONTCACHE (1 << 15) +#define I_SYNC_QUEUED (1 << 16) +#define I_PINNING_NETFS_WB (1 << 17) #define I_DIRTY_INODE (I_DIRTY_SYNC | I_DIRTY_DATASYNC) #define I_DIRTY (I_DIRTY_INODE | I_DIRTY_PAGES) From patchwork Fri Aug 23 12:47:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Brauner X-Patchwork-Id: 13775100 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 B812F185B5C for ; Fri, 23 Aug 2024 12:48:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724417283; cv=none; b=a0p4IrqUS9+vq1zc4uya9YFpPQ4CiKKerlQT9l/XQSTe6bS9ZwgSgdR5Cx/2ewXa/jq+PuHrZJfHO0lxPumVRWbG+eNdmtKWzhyK6e+mSqF941vFGn9NrKCyGKWj5Lu0/mASdRZa2hZkvRg0ZP3kLU5IgXnCABMhn2b/gBhLdfs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724417283; c=relaxed/simple; bh=ZbrlJqiOhEXVHhy6EovBOTYkE8EmF/LU3ZtCoLkwGlY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=XrNtYg84wA44K72VBN0VYTU/MWPXqt3SqLJ/ab40uQLpqaPqYAGYFIg/QuYuy0D15x97rpMBoJnq9x4t7w8kSV2hVoYj7oFNAXcL94VkGwd5k/dG70N4kN4dA0fK+imr98xbPyJHiCv5kYMzrCzYJo+4kVThTH7wJjh67iy4gP8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fkKsAJBL; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="fkKsAJBL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3AA7AC4AF09; Fri, 23 Aug 2024 12:48:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724417283; bh=ZbrlJqiOhEXVHhy6EovBOTYkE8EmF/LU3ZtCoLkwGlY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fkKsAJBLEW6/oDgMBRp4v+BtqydOwI4AC46S2XSlDPKiJ8voe8PzmsrkddlsT8rZ0 ujtp9PdJYY7G2Py0t6xialKQBu2P5EzyZszCR2PxSMe0l4lLcN7+p/O+unUsjpbiE7 x7etbaiyf7EcELXwEJC40GCRZItxzrXIyBOBPuy6eK+YT4I1kpHGhnn5LqHOaD2bVK FnrqCnTXSoh02+s5PaZIl1daquwnbpY1FKEZFiMxYOibnmkqbhs4VwtJa4ASlJxWNH 2I+9pS7SyP4Wpxp3nHnsDdxnYdmxwlAA/W3EenZJEDUNE3yseuC0ab2HzmukNqWP5g 1fB8ULusSWHLA== From: Christian Brauner To: Linus Torvalds Cc: Christian Brauner , NeilBrown , Peter Zijlstra , Ingo Molnar , Jeff Layton , Jan Kara , linux-fsdevel@vger.kernel.org Subject: [PATCH v3 3/6] inode: port __I_SYNC to var event Date: Fri, 23 Aug 2024 14:47:37 +0200 Message-ID: <20240823-work-i_state-v3-3-5cd5fd207a57@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240823-work-i_state-v3-0-5cd5fd207a57@kernel.org> References: <20240823-work-i_state-v3-0-5cd5fd207a57@kernel.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mailer: b4 0.15-dev-37811 X-Developer-Signature: v=1; a=openpgp-sha256; l=2918; i=brauner@kernel.org; h=from:subject:message-id; bh=ZbrlJqiOhEXVHhy6EovBOTYkE8EmF/LU3ZtCoLkwGlY=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMaSdaHlb3XuR89fNsyJ/z8d5nd9xccq1BW/k+Nms2NZyN +dWqf9a3VHKwiDGxSArpsji0G4SLrecp2KzUaYGzBxWJpAhDFycAjCREz8YGd5Mi+X0XCjamMml YhC98Vhbv8HkO81d84syDIPZ2aI/KDEy3H7zV/Dj602SKx5f/LyAe+P9+TfcdTQnPagyynmxyOF VIx8A X-Developer-Key: i=brauner@kernel.org; a=openpgp; fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624 Port the __I_SYNC mechanism to use the new var event mechanism. Signed-off-by: Christian Brauner Reviewed-by: Jan Kara --- fs/fs-writeback.c | 45 +++++++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 1a5006329f6f..d8bec3c1bb1f 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -1386,12 +1386,13 @@ static void requeue_io(struct inode *inode, struct bdi_writeback *wb) static void inode_sync_complete(struct inode *inode) { + assert_spin_locked(&inode->i_lock); + inode->i_state &= ~I_SYNC; /* If inode is clean an unused, put it into LRU now... */ inode_add_lru(inode); - /* Waiters must see I_SYNC cleared before being woken up */ - smp_mb(); - wake_up_bit(&inode->i_state, __I_SYNC); + /* Called with inode->i_lock which ensures memory ordering. */ + inode_wake_up_bit(inode, __I_SYNC); } static bool inode_dirtied_after(struct inode *inode, unsigned long t) @@ -1512,17 +1513,25 @@ static int write_inode(struct inode *inode, struct writeback_control *wbc) */ void inode_wait_for_writeback(struct inode *inode) { - DEFINE_WAIT_BIT(wq, &inode->i_state, __I_SYNC); - wait_queue_head_t *wqh; + struct wait_bit_queue_entry wqe; + struct wait_queue_head *wq_head; + + assert_spin_locked(&inode->i_lock); + + if (!(inode->i_state & I_SYNC)) + return; - lockdep_assert_held(&inode->i_lock); - wqh = bit_waitqueue(&inode->i_state, __I_SYNC); - while (inode->i_state & I_SYNC) { + wq_head = inode_bit_waitqueue(&wqe, inode, __I_SYNC); + for (;;) { + prepare_to_wait_event(wq_head, &wqe.wq_entry, TASK_UNINTERRUPTIBLE); + /* Checking I_SYNC with inode->i_lock guarantees memory ordering. */ + if (!(inode->i_state & I_SYNC)) + break; spin_unlock(&inode->i_lock); - __wait_on_bit(wqh, &wq, bit_wait, - TASK_UNINTERRUPTIBLE); + schedule(); spin_lock(&inode->i_lock); } + finish_wait(wq_head, &wqe.wq_entry); } /* @@ -1533,16 +1542,20 @@ void inode_wait_for_writeback(struct inode *inode) static void inode_sleep_on_writeback(struct inode *inode) __releases(inode->i_lock) { - DEFINE_WAIT(wait); - wait_queue_head_t *wqh = bit_waitqueue(&inode->i_state, __I_SYNC); - int sleep; + struct wait_bit_queue_entry wqe; + struct wait_queue_head *wq_head; + bool sleep; + + assert_spin_locked(&inode->i_lock); - prepare_to_wait(wqh, &wait, TASK_UNINTERRUPTIBLE); - sleep = inode->i_state & I_SYNC; + wq_head = inode_bit_waitqueue(&wqe, inode, __I_SYNC); + prepare_to_wait_event(wq_head, &wqe.wq_entry, TASK_UNINTERRUPTIBLE); + /* Checking I_SYNC with inode->i_lock guarantees memory ordering. */ + sleep = !!(inode->i_state & I_SYNC); spin_unlock(&inode->i_lock); if (sleep) schedule(); - finish_wait(wqh, &wait); + finish_wait(wq_head, &wqe.wq_entry); } /* From patchwork Fri Aug 23 12:47:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Brauner X-Patchwork-Id: 13775101 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 1B14B185936 for ; Fri, 23 Aug 2024 12:48:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724417286; cv=none; b=j90uzyUVJzeu2dHiHaU9j1joYtjjeP/w9Y6SgK3kXY8SR+U3do+4gaozY341mzW3cpcuXOmWVKkEWrTp47pY/jw8vtB9NLoG9T4QLA1+EF3mtOe2mjDBtRjASoKKRyQN9Lhv16nKF+TrCwQYsuDzRagRCq8CkarRQjejnxmyDHk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724417286; c=relaxed/simple; bh=ZEdA1ZQhKBTXbibEMJ+tSrOron1bsRXVotsJkEwdcxk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jZKBQPpmghf8Oi0oo+DBt5U6VNfi1hx5pyZB+FPOIXpYB8uDxssyo61kos702v7KxGuuAQhfALaMZrLbaPrsOYEHtBSKOFcDG+7DLb83LjawzZWFgUQjogScObgiUd77IC/s0nOLNl12kbJ2V1ZFzQuMqoMjsjccT57emX5ob6A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=D7tYfyAz; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="D7tYfyAz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA3C4C4AF0B; Fri, 23 Aug 2024 12:48:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724417286; bh=ZEdA1ZQhKBTXbibEMJ+tSrOron1bsRXVotsJkEwdcxk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D7tYfyAzuBnF/r7EkQS4BiCTurgU8eHm5+TrX9CF6C759UpHMDOEAszamaatzOTMz SeIdmZvo+GJBmVOEvTHqGiFobo7J87+rMkC/5cMswdSBc/hz0HFNVpFUIyKJ83uR5x JrKEwE9tPGUEcJsLgi7BQ7mvti5DSPsq9gHCC5mHhc0JdcODD9QTUoDdzuEraMS5Kl bkLOTS3nLjuJILI+VpVUd/EkinpHzd42ABo5g6zHx/ZrHqoa7u9FoVSTRa2A/n3yZy D4oI9Sc191rrsD9w29a32ZJ/jB7dnkIzrirRUJkOhW3ijiBMS4p31zU4leAiPvQKzC wxKjl/+UmHzOg== From: Christian Brauner To: Linus Torvalds Cc: Christian Brauner , NeilBrown , Peter Zijlstra , Ingo Molnar , Jeff Layton , Jan Kara , linux-fsdevel@vger.kernel.org Subject: [PATCH v3 4/6] inode: port __I_NEW to var event Date: Fri, 23 Aug 2024 14:47:38 +0200 Message-ID: <20240823-work-i_state-v3-4-5cd5fd207a57@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240823-work-i_state-v3-0-5cd5fd207a57@kernel.org> References: <20240823-work-i_state-v3-0-5cd5fd207a57@kernel.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mailer: b4 0.15-dev-37811 X-Developer-Signature: v=1; a=openpgp-sha256; l=5569; i=brauner@kernel.org; h=from:subject:message-id; bh=ZEdA1ZQhKBTXbibEMJ+tSrOron1bsRXVotsJkEwdcxk=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMaSdaHl7nSltmlzL4h9mvQ+1nTpq/3S2Lt+zLW3jGsZgt ej2M2IPOkpZGMS4GGTFFFkc2k3C5ZbzVGw2ytSAmcPKBDKEgYtTACai6M7wP/Cjo92cDQ/mnN61 b/vGHZ7BXsynhAqK9Vnd9z27t1vGrIeR4UN1zTeG55+MFeILWeqt38RaPEpuqp1Tc35zuMvMZWa Z7AA= X-Developer-Key: i=brauner@kernel.org; a=openpgp; fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624 Port the __I_NEW mechanism to use the new var event mechanism. Signed-off-by: Christian Brauner --- I'm not fully convinced that READ_ONCE() in wait_on_inode() is sufficient when combined with smp_mb() before wake_up_var(). Maybe we need smp_store_release() on inode->i_state before smp_mb() and paired with smp_load_acquire() in wait_on_inode(). --- fs/bcachefs/fs.c | 10 ++++++---- fs/dcache.c | 7 ++++++- fs/inode.c | 32 ++++++++++++++++++++++++-------- include/linux/writeback.h | 3 ++- 4 files changed, 38 insertions(+), 14 deletions(-) diff --git a/fs/bcachefs/fs.c b/fs/bcachefs/fs.c index 94c392abef65..c0900c0c0f8a 100644 --- a/fs/bcachefs/fs.c +++ b/fs/bcachefs/fs.c @@ -1644,14 +1644,16 @@ void bch2_evict_subvolume_inodes(struct bch_fs *c, snapshot_id_list *s) break; } } else if (clean_pass && this_pass_clean) { - wait_queue_head_t *wq = bit_waitqueue(&inode->v.i_state, __I_NEW); - DEFINE_WAIT_BIT(wait, &inode->v.i_state, __I_NEW); + struct wait_bit_queue_entry wqe; + struct wait_queue_head *wq_head; - prepare_to_wait(wq, &wait.wq_entry, TASK_UNINTERRUPTIBLE); + wq_head = inode_bit_waitqueue(&wqe, &inode->v, __I_NEW); + prepare_to_wait_event(wq_head, &wqe.wq_entry, + TASK_UNINTERRUPTIBLE); mutex_unlock(&c->vfs_inodes_lock); schedule(); - finish_wait(wq, &wait.wq_entry); + finish_wait(wq_head, &wqe.wq_entry); goto again; } } diff --git a/fs/dcache.c b/fs/dcache.c index 1af75fa68638..894e38cdf4d0 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -1908,8 +1908,13 @@ void d_instantiate_new(struct dentry *entry, struct inode *inode) __d_instantiate(entry, inode); WARN_ON(!(inode->i_state & I_NEW)); inode->i_state &= ~I_NEW & ~I_CREATING; + /* + * Pairs with the barrier in prepare_to_wait_event() to make sure + * ___wait_var_event() either sees the bit cleared or + * waitqueue_active() check in wake_up_var() sees the waiter. + */ smp_mb(); - wake_up_bit(&inode->i_state, __I_NEW); + inode_wake_up_bit(inode, __I_NEW); spin_unlock(&inode->i_lock); } EXPORT_SYMBOL(d_instantiate_new); diff --git a/fs/inode.c b/fs/inode.c index 877c64a1bf63..37f20c7c2f72 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -734,7 +734,13 @@ static void evict(struct inode *inode) * used as an indicator whether blocking on it is safe. */ spin_lock(&inode->i_lock); - wake_up_bit(&inode->i_state, __I_NEW); + /* + * Pairs with the barrier in prepare_to_wait_event() to make sure + * ___wait_var_event() either sees the bit cleared or + * waitqueue_active() check in wake_up_var() sees the waiter. + */ + smp_mb(); + inode_wake_up_bit(inode, __I_NEW); BUG_ON(inode->i_state != (I_FREEING | I_CLEAR)); spin_unlock(&inode->i_lock); @@ -1142,8 +1148,13 @@ void unlock_new_inode(struct inode *inode) spin_lock(&inode->i_lock); WARN_ON(!(inode->i_state & I_NEW)); inode->i_state &= ~I_NEW & ~I_CREATING; + /* + * Pairs with the barrier in prepare_to_wait_event() to make sure + * ___wait_var_event() either sees the bit cleared or + * waitqueue_active() check in wake_up_var() sees the waiter. + */ smp_mb(); - wake_up_bit(&inode->i_state, __I_NEW); + inode_wake_up_bit(inode, __I_NEW); spin_unlock(&inode->i_lock); } EXPORT_SYMBOL(unlock_new_inode); @@ -1154,8 +1165,13 @@ void discard_new_inode(struct inode *inode) spin_lock(&inode->i_lock); WARN_ON(!(inode->i_state & I_NEW)); inode->i_state &= ~I_NEW; + /* + * Pairs with the barrier in prepare_to_wait_event() to make sure + * ___wait_var_event() either sees the bit cleared or + * waitqueue_active() check in wake_up_var() sees the waiter. + */ smp_mb(); - wake_up_bit(&inode->i_state, __I_NEW); + inode_wake_up_bit(inode, __I_NEW); spin_unlock(&inode->i_lock); iput(inode); } @@ -2344,8 +2360,8 @@ EXPORT_SYMBOL(inode_needs_sync); */ static void __wait_on_freeing_inode(struct inode *inode, bool is_inode_hash_locked) { - wait_queue_head_t *wq; - DEFINE_WAIT_BIT(wait, &inode->i_state, __I_NEW); + struct wait_bit_queue_entry wqe; + struct wait_queue_head *wq_head; /* * Handle racing against evict(), see that routine for more details. @@ -2356,14 +2372,14 @@ static void __wait_on_freeing_inode(struct inode *inode, bool is_inode_hash_lock return; } - wq = bit_waitqueue(&inode->i_state, __I_NEW); - prepare_to_wait(wq, &wait.wq_entry, TASK_UNINTERRUPTIBLE); + wq_head = inode_bit_waitqueue(&wqe, inode, __I_NEW); + prepare_to_wait_event(wq_head, &wqe.wq_entry, TASK_UNINTERRUPTIBLE); spin_unlock(&inode->i_lock); rcu_read_unlock(); if (is_inode_hash_locked) spin_unlock(&inode_hash_lock); schedule(); - finish_wait(wq, &wait.wq_entry); + finish_wait(wq_head, &wqe.wq_entry); if (is_inode_hash_locked) spin_lock(&inode_hash_lock); rcu_read_lock(); diff --git a/include/linux/writeback.h b/include/linux/writeback.h index 56b85841ae4c..8f651bb0a1a5 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h @@ -200,7 +200,8 @@ void inode_io_list_del(struct inode *inode); /* writeback.h requires fs.h; it, too, is not included from here. */ static inline void wait_on_inode(struct inode *inode) { - wait_on_bit(&inode->i_state, __I_NEW, TASK_UNINTERRUPTIBLE); + wait_var_event(inode_state_wait_address(inode, __I_NEW), + !(READ_ONCE(inode->i_state) & I_NEW)); } #ifdef CONFIG_CGROUP_WRITEBACK From patchwork Fri Aug 23 12:47:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Brauner X-Patchwork-Id: 13775102 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 2769A2E3EB for ; Fri, 23 Aug 2024 12:48:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724417289; cv=none; b=jpaymrdFWC1lbAA3rMxZL/QZ9i4MuXoI6ZSa2tUmJUnqBTuSBncDV39LoAgJRP19GBJdUSAKu3xLju9kmd8msQJSred0mku+pnZjiM3YL2a8U8mcYF/pfJehoX7La0tkC5+C9P6rTBzKwAPKWJz3QJEER2h031qT5lK6NUdUTY4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724417289; c=relaxed/simple; bh=7OLmDZCu75NasHW+5eIp0QUqNnOIcdBetyYXHQceP14=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=BmLrelXL2L6874X7qdwcGLi5yfVwQAGkMhm7rR/tj25bH4qz2HUZyqU7cN96msC76zvhmgg/I2rpRRCN36VmSIHsQ1diVrT9gg98p/pSJ83KhHTKm6qtw/qE0dnxyX7xzTjVKBmlg41QxPFOlDzsY1lMdRiDd+SdosLp2V9uZjc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WUG/NjTW; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WUG/NjTW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81A51C4AF0E; Fri, 23 Aug 2024 12:48:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724417288; bh=7OLmDZCu75NasHW+5eIp0QUqNnOIcdBetyYXHQceP14=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WUG/NjTWPKyIPAY/4nv5s0hUmDUwNQP5qufYfjcHxsu7VxZKjQjgpfd5bF6P6Nu4K mIMbTH1u6NU2nAfKKiC0iE9xqkgpplE5Fa0/mDWsJ/zSjUldqUDxGfPq1vT7WqLMQ9 AzzedHWdRbnUGw3F+6rylLhhUqLLcnWDuy2v2ARQv0lGONx51j3VLW2MdMuZCj+ofy X4H297XzHbcRgosQfLjMDW19eeBbp+BIOIu9i2yrU7SkygemxUtt5LWWfh/DJlZU+M teOGu/SZ+jUfJRNbjo5MWwtyuxU937/IFrIyJZvUbC+yQbivNXzvw1pMHYURXQCB0K O2yKh6I9cz8rw== From: Christian Brauner To: Linus Torvalds Cc: Christian Brauner , NeilBrown , Peter Zijlstra , Ingo Molnar , Jeff Layton , Jan Kara , linux-fsdevel@vger.kernel.org Subject: [PATCH v3 5/6] inode: port __I_LRU_ISOLATING to var event Date: Fri, 23 Aug 2024 14:47:39 +0200 Message-ID: <20240823-work-i_state-v3-5-5cd5fd207a57@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240823-work-i_state-v3-0-5cd5fd207a57@kernel.org> References: <20240823-work-i_state-v3-0-5cd5fd207a57@kernel.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mailer: b4 0.15-dev-37811 X-Developer-Signature: v=1; a=openpgp-sha256; l=1821; i=brauner@kernel.org; h=from:subject:message-id; bh=7OLmDZCu75NasHW+5eIp0QUqNnOIcdBetyYXHQceP14=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMaSdaHknvTD0asppsa6lLZpzXz2aeeS9++pHbS4/b4io7 NxidP7wto5SFgYxLgZZMUUWh3aTcLnlPBWbjTI1YOawMoEMYeDiFICJBAkxMmy642BVvcvYMrTv q8ze5UJ7JX/OZpVZJWZgzdRtIv7hazUjw+arDRzV7nP2LO94f1PQsTTty6WO1c8Z5614n2Rsf6S 8nhsA X-Developer-Key: i=brauner@kernel.org; a=openpgp; fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624 Port the __I_LRU_ISOLATING mechanism to use the new var event mechanism. Signed-off-by: Christian Brauner Reviewed-by: Jan Kara --- fs/inode.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/fs/inode.c b/fs/inode.c index 37f20c7c2f72..8fb8e4f9acc3 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -511,24 +511,35 @@ static void inode_unpin_lru_isolating(struct inode *inode) spin_lock(&inode->i_lock); WARN_ON(!(inode->i_state & I_LRU_ISOLATING)); inode->i_state &= ~I_LRU_ISOLATING; - smp_mb(); - wake_up_bit(&inode->i_state, __I_LRU_ISOLATING); + /* Called with inode->i_lock which ensures memory ordering. */ + inode_wake_up_bit(inode, __I_LRU_ISOLATING); spin_unlock(&inode->i_lock); } static void inode_wait_for_lru_isolating(struct inode *inode) { + struct wait_bit_queue_entry wqe; + struct wait_queue_head *wq_head; + lockdep_assert_held(&inode->i_lock); - if (inode->i_state & I_LRU_ISOLATING) { - DEFINE_WAIT_BIT(wq, &inode->i_state, __I_LRU_ISOLATING); - wait_queue_head_t *wqh; + if (!(inode->i_state & I_LRU_ISOLATING)) + return; - wqh = bit_waitqueue(&inode->i_state, __I_LRU_ISOLATING); + wq_head = inode_bit_waitqueue(&wqe, inode, __I_LRU_ISOLATING); + for (;;) { + prepare_to_wait_event(wq_head, &wqe.wq_entry, TASK_UNINTERRUPTIBLE); + /* + * Checking I_LRU_ISOLATING with inode->i_lock guarantees + * memory ordering. + */ + if (!(inode->i_state & I_LRU_ISOLATING)) + break; spin_unlock(&inode->i_lock); - __wait_on_bit(wqh, &wq, bit_wait, TASK_UNINTERRUPTIBLE); + schedule(); spin_lock(&inode->i_lock); - WARN_ON(inode->i_state & I_LRU_ISOLATING); } + finish_wait(wq_head, &wqe.wq_entry); + WARN_ON(inode->i_state & I_LRU_ISOLATING); } /** From patchwork Fri Aug 23 12:47:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Brauner X-Patchwork-Id: 13775103 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 AC6FB1849CB for ; Fri, 23 Aug 2024 12:48:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724417291; cv=none; b=FH6T0nFl/wuSyAG+PhOcMg/1jG2Fyee7ZiXQSg7oVSsqTv6XfLOOQGn0z6dIun/RjgRFglDOseSHX1dcucdvDDtg49sHtPGmE8DSiR0CnXbAXdvWxWhstlaRjMUPElHrg1SOa8DRb/K9aO0Y2l+btEUM2SXL7aPw8s9KKaPfg74= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724417291; c=relaxed/simple; bh=ZbnemhAZAnpW15/SNSfrTfr8p+y1+hp11Dudl3zOWlE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=BH3HYLI5gt8Y1ljv7Tq7IBJJdXNtFW/VfBMoQMGIq03lX5vp1N2PSSkvu5hQqmPHLCts4aKleGdBQwOeIqETP7h0x/sXO1gAM75NPjKZ/FZJ9tc0qaWqPCjwxjCnXpnvB4Eb05iQYrNo2/RSenjB4jmjfWXmTT3yNm3hJynj/gw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eOeou85u; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="eOeou85u" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 333BAC4AF0F; Fri, 23 Aug 2024 12:48:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724417291; bh=ZbnemhAZAnpW15/SNSfrTfr8p+y1+hp11Dudl3zOWlE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eOeou85uOjz/t3TGbPH3AoEjglXYluTo/xGkOQeyh8NCJvyRpbuuStOcChjt1uErl 3IEv6hy7dgglxp3RG+pZ2iWGUo5fj1Pghz8NrZMlCwVqqtPYOYa+kLGkcDSi7+tZEf o6oe2s+Tu3DcRMOMg4ZvWTVk6SRM/fFIf90zxjZRKLMraoOhS70PlO5lGmN7XxVF2h Z/sFf6x0mlbiyl4OOz7YJiYJWaXEvyrLywGGdTGz7j1lIVTmzNsxGhUv1GRi/adZFK Rami1MSKWFBQXNxe8g8tjYzHZW2hEhpICz6/oBabJTif94IgIoBQIFShGYszk1qewe JkzWelL2W5TQQ== From: Christian Brauner To: Linus Torvalds Cc: Christian Brauner , NeilBrown , Peter Zijlstra , Ingo Molnar , Jeff Layton , Jan Kara , linux-fsdevel@vger.kernel.org Subject: [PATCH v3 6/6] inode: make i_state a u32 Date: Fri, 23 Aug 2024 14:47:40 +0200 Message-ID: <20240823-work-i_state-v3-6-5cd5fd207a57@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240823-work-i_state-v3-0-5cd5fd207a57@kernel.org> References: <20240823-work-i_state-v3-0-5cd5fd207a57@kernel.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mailer: b4 0.15-dev-37811 X-Developer-Signature: v=1; a=openpgp-sha256; l=700; i=brauner@kernel.org; h=from:subject:message-id; bh=ZbnemhAZAnpW15/SNSfrTfr8p+y1+hp11Dudl3zOWlE=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMaSdaHl3cn6Xf6kTE+tWQY4uux9bfV8rdPa+qlt3VYXTo LT7xjTvjlIWBjEuBlkxRRaHdpNwueU8FZuNMjVg5rAygQxh4OIUgIn4szH89/5x6b4Rk0+PolRT l8i/h1GX2vie3lLblFz+g6n8eZ30J4b/gadXvdtrs7XxkmT12aM23YanfxyYp5sXG1hXNNn+9zk HdgA= X-Developer-Key: i=brauner@kernel.org; a=openpgp; fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624 Now that we use the wait var event mechanism make i_state a u32 and free up 4 bytes. This means we currently have two 4 byte holes in struct inode which we can pack. Signed-off-by: Christian Brauner Reviewed-by: Jan Kara --- include/linux/fs.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/linux/fs.h b/include/linux/fs.h index f257f8fad7d0..746ac60cef92 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -681,7 +681,8 @@ struct inode { #endif /* Misc */ - unsigned long i_state; + u32 i_state; + /* 32-bit hole */ struct rw_semaphore i_rwsem; unsigned long dirtied_when; /* jiffies of first dirtying */