diff mbox series

btrfs: use BTRFS_DIR_START_INDEX at btrfs_create_new_inode()

Message ID ce76cc1a4fb3c2b4d6051c6d900286d6171885a3.1649862992.git.fdmanana@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs: use BTRFS_DIR_START_INDEX at btrfs_create_new_inode() | expand

Commit Message

Filipe Manana April 13, 2022, 3:20 p.m. UTC
From: Filipe Manana <fdmanana@suse.com>

We are still using the magic value of 2 at btrfs_create_new_inode(), but
there's now a constant for that, named BTRFS_DIR_START_INDEX, which was
introduced in commit 528ee697126fd ("btrfs: put initial index value of a
directory in a constant"). So change that to use the constant.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 fs/btrfs/inode.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Comments

Nikolay Borisov April 13, 2022, 3:22 p.m. UTC | #1
On 13.04.22 г. 18:20 ч., fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> We are still using the magic value of 2 at btrfs_create_new_inode(), but
> there's now a constant for that, named BTRFS_DIR_START_INDEX, which was
> introduced in commit 528ee697126fd ("btrfs: put initial index value of a
> directory in a constant"). So change that to use the constant.
> 
> Signed-off-by: Filipe Manana <fdmanana@suse.com>

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
David Sterba April 13, 2022, 4:11 p.m. UTC | #2
On Wed, Apr 13, 2022 at 04:20:21PM +0100, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> We are still using the magic value of 2 at btrfs_create_new_inode(), but
> there's now a constant for that, named BTRFS_DIR_START_INDEX, which was
> introduced in commit 528ee697126fd ("btrfs: put initial index value of a
> directory in a constant"). So change that to use the constant.
> 
> Signed-off-by: Filipe Manana <fdmanana@suse.com>

Added to misc-next, thanks.
diff mbox series

Patch

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 1911116974b1..620baf24c6bd 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -6238,12 +6238,8 @@  int btrfs_create_new_inode(struct btrfs_trans_handle *trans,
 		if (ret)
 			goto out;
 	}
-	/*
-	 * index_cnt is ignored for everything but a dir,
-	 * btrfs_set_inode_index_count has an explanation for the magic
-	 * number
-	 */
-	BTRFS_I(inode)->index_cnt = 2;
+	/* index_cnt is ignored for everything but a dir. */
+	BTRFS_I(inode)->index_cnt = BTRFS_DIR_START_INDEX;
 	BTRFS_I(inode)->generation = trans->transid;
 	inode->i_generation = BTRFS_I(inode)->generation;