Skip to contentSkip to conversation

ext4: rename journal_dev to s_journal_dev inside ext4_sb_info

PATCH Superseded brookxu 2 participants 2 messages Aug 7, 2020 – Aug 13, 2020 ext4 file system

lore
Share & tools
lore

brookxu

author
#0 lore raw

PATCH v2 1/2 ext4: rename journal_dev to s_journal_dev inside ext4_sb_info

Rename journal_dev to s_journal_dev inside ext4_sb_info, keep the naming rules consistent with other variables, which is convenient for code reading and writing.

---
 fs/ext4/ext4.h  |  2 +-
 fs/ext4/fsmap.c |  8 ++++----
 fs/ext4/super.c | 14 +++++++-------
 3 files changed, 12 insertions(+), 12 deletions(-)
fs/ext4/ext4.h +1 -1
index 68e0ebe..8ca9adf 100644
@@ -1463,7 +1463,7 @@ struct ext4_sb_info {
 	unsigned long s_commit_interval;
 	u32 s_max_batch_time;
 	u32 s_min_batch_time;
-	struct block_device *journal_bdev;
+	struct block_device *s_journal_bdev;
 #ifdef CONFIG_QUOTA
 	/* Names of quota files with journalled quota */
 	char __rcu *s_qf_names[EXT4_MAXQUOTAS];
fs/ext4/fsmap.c +4 -4
index dbccf46..005c0ae 100644
@@ -571,8 +571,8 @@ static bool ext4_getfsmap_is_valid_device(struct super_block *sb,
 	if (fm->fmr_device == 0 || fm->fmr_device == UINT_MAX ||
 	    fm->fmr_device == new_encode_dev(sb->s_bdev->bd_dev))
 		return true;
-	if (EXT4_SB(sb)->journal_bdev &&
-	    fm->fmr_device == new_encode_dev(EXT4_SB(sb)->journal_bdev->bd_dev))
+	if (EXT4_SB(sb)->s_journal_bdev &&
+	    fm->fmr_device == new_encode_dev(EXT4_SB(sb)->s_journal_bdev->bd_dev))
 		return true;
 	return false;
 }
@@ -642,9 +642,9 @@ int ext4_getfsmap(struct super_block *sb, struct ext4_fsmap_head *head,
 	memset(handlers, 0, sizeof(handlers));
 	handlers[0].gfd_dev = new_encode_dev(sb->s_bdev->bd_dev);
 	handlers[0].gfd_fn = ext4_getfsmap_datadev;
-	if (EXT4_SB(sb)->journal_bdev) {
+	if (EXT4_SB(sb)->s_journal_bdev) {
 		handlers[1].gfd_dev = new_encode_dev(
-				EXT4_SB(sb)->journal_bdev->bd_dev);
+				EXT4_SB(sb)->s_journal_bdev->bd_dev);
 		handlers[1].gfd_fn = ext4_getfsmap_logdev;
 	}
 
fs/ext4/super.c +7 -7
index 8ce61f3..f785aee7 100644
@@ -935,10 +935,10 @@ static void ext4_blkdev_put(struct block_device *bdev)
 static void ext4_blkdev_remove(struct ext4_sb_info *sbi)
 {
 	struct block_device *bdev;
-	bdev = sbi->journal_bdev;
+	bdev = sbi->s_journal_bdev;
 	if (bdev) {
 		ext4_blkdev_put(bdev);
-		sbi->journal_bdev = NULL;
+		sbi->s_journal_bdev = NULL;
 	}
 }
 
@@ -1069,14 +1069,14 @@ static void ext4_put_super(struct super_block *sb)
 
 	sync_blockdev(sb->s_bdev);
 	invalidate_bdev(sb->s_bdev);
-	if (sbi->journal_bdev && sbi->journal_bdev != sb->s_bdev) {
+	if (sbi->s_journal_bdev && sbi->s_journal_bdev != sb->s_bdev) {
 		/*
 		 * Invalidate the journal device's buffers.  We don't want them
 		 * floating about in memory - the physical journal device may
 		 * hotswapped, and it breaks the `ro-after' testing code.
 		 */
-		sync_blockdev(sbi->journal_bdev);
-		invalidate_bdev(sbi->journal_bdev);
+		sync_blockdev(sbi->s_journal_bdev);
+		invalidate_bdev(sbi->s_journal_bdev);
 		ext4_blkdev_remove(sbi);
 	}
 
@@ -3712,7 +3712,7 @@ int ext4_calculate_overhead(struct super_block *sb)
 	 * Add the internal journal blocks whether the journal has been
 	 * loaded or not
 	 */
-	if (sbi->s_journal && !sbi->journal_bdev)
+	if (sbi->s_journal && !sbi->s_journal_bdev)
 		overhead += EXT4_NUM_B2C(sbi, sbi->s_journal->j_maxlen);
 	else if (ext4_has_feature_journal(sb) && !sbi->s_journal && j_inum) {
 		/* j_inum for internal journal is non-zero */
@@ -5057,7 +5057,7 @@ static journal_t *ext4_get_dev_journal(struct super_block *sb,
 			be32_to_cpu(journal->j_superblock->s_nr_users));
 		goto out_journal;
 	}
-	EXT4_SB(sb)->journal_bdev = bdev;
+	EXT4_SB(sb)->s_journal_bdev = bdev;
 	ext4_init_journal_params(sb, journal);
 	return journal;
 
Signature · 1 line
1.8.3.1
Reviewed-by on v2 1/2
#1 lore raw
Quoted 5 lines · brookxu

Rename journal_dev to s_journal_dev inside ext4_sb_info, keep the naming rules consistent with other variables, which is convenient for code reading and writing.

It seems the author email and Signed-off-by emails are different and checkpatch complains. Highlighting for your FYI -

./scripts/checkpatch.pl 1.patch
WARNING: Missing Signed-off-by: line by nominal patch author 'brookxu <[email protected]>'

Other than that, threading ("--thread") on your patch series will help add proper headers in the email so that it could be seen as threaded emails.

Patch looks good to me. Please feel free to add,

Quoted 99 lines
---
  fs/ext4/ext4.h  |  2 +-
  fs/ext4/fsmap.c |  8 ++++----
  fs/ext4/super.c | 14 +++++++-------
  3 files changed, 12 insertions(+), 12 deletions(-)
fs/ext4/ext4.h +1 -1
index 68e0ebe..8ca9adf 100644
@@ -1463,7 +1463,7 @@ struct ext4_sb_info {
  	unsigned long s_commit_interval;
  	u32 s_max_batch_time;
  	u32 s_min_batch_time;
-	struct block_device *journal_bdev;
+	struct block_device *s_journal_bdev;
  #ifdef CONFIG_QUOTA
  	/* Names of quota files with journalled quota */
  	char __rcu *s_qf_names[EXT4_MAXQUOTAS];
fs/ext4/fsmap.c +4 -4
index dbccf46..005c0ae 100644
@@ -571,8 +571,8 @@ static bool ext4_getfsmap_is_valid_device(struct super_block *sb,
  	if (fm->fmr_device == 0 || fm->fmr_device == UINT_MAX ||
  	    fm->fmr_device == new_encode_dev(sb->s_bdev->bd_dev))
  		return true;
-	if (EXT4_SB(sb)->journal_bdev &&
-	    fm->fmr_device == new_encode_dev(EXT4_SB(sb)->journal_bdev->bd_dev))
+	if (EXT4_SB(sb)->s_journal_bdev &&
+	    fm->fmr_device == new_encode_dev(EXT4_SB(sb)->s_journal_bdev->bd_dev))
  		return true;
  	return false;
  }
@@ -642,9 +642,9 @@ int ext4_getfsmap(struct super_block *sb, struct ext4_fsmap_head *head,
  	memset(handlers, 0, sizeof(handlers));
  	handlers[0].gfd_dev = new_encode_dev(sb->s_bdev->bd_dev);
  	handlers[0].gfd_fn = ext4_getfsmap_datadev;
-	if (EXT4_SB(sb)->journal_bdev) {
+	if (EXT4_SB(sb)->s_journal_bdev) {
  		handlers[1].gfd_dev = new_encode_dev(
-				EXT4_SB(sb)->journal_bdev->bd_dev);
+				EXT4_SB(sb)->s_journal_bdev->bd_dev);
  		handlers[1].gfd_fn = ext4_getfsmap_logdev;
  	}
 
fs/ext4/super.c +7 -7
index 8ce61f3..f785aee7 100644
@@ -935,10 +935,10 @@ static void ext4_blkdev_put(struct block_device *bdev)
  static void ext4_blkdev_remove(struct ext4_sb_info *sbi)
  {
  	struct block_device *bdev;
-	bdev = sbi->journal_bdev;
+	bdev = sbi->s_journal_bdev;
  	if (bdev) {
  		ext4_blkdev_put(bdev);
-		sbi->journal_bdev = NULL;
+		sbi->s_journal_bdev = NULL;
  	}
  }
 
@@ -1069,14 +1069,14 @@ static void ext4_put_super(struct super_block *sb)
 
  	sync_blockdev(sb->s_bdev);
  	invalidate_bdev(sb->s_bdev);
-	if (sbi->journal_bdev && sbi->journal_bdev != sb->s_bdev) {
+	if (sbi->s_journal_bdev && sbi->s_journal_bdev != sb->s_bdev) {
  		/*
  		 * Invalidate the journal device's buffers.  We don't want them
  		 * floating about in memory - the physical journal device may
  		 * hotswapped, and it breaks the `ro-after' testing code.
  		 */
-		sync_blockdev(sbi->journal_bdev);
-		invalidate_bdev(sbi->journal_bdev);
+		sync_blockdev(sbi->s_journal_bdev);
+		invalidate_bdev(sbi->s_journal_bdev);
  		ext4_blkdev_remove(sbi);
  	}
 
@@ -3712,7 +3712,7 @@ int ext4_calculate_overhead(struct super_block *sb)
  	 * Add the internal journal blocks whether the journal has been
  	 * loaded or not
  	 */
-	if (sbi->s_journal && !sbi->journal_bdev)
+	if (sbi->s_journal && !sbi->s_journal_bdev)
  		overhead += EXT4_NUM_B2C(sbi, sbi->s_journal->j_maxlen);
  	else if (ext4_has_feature_journal(sb) && !sbi->s_journal && j_inum) {
  		/* j_inum for internal journal is non-zero */
@@ -5057,7 +5057,7 @@ static journal_t *ext4_get_dev_journal(struct super_block *sb,
  			be32_to_cpu(journal->j_superblock->s_nr_users));
  		goto out_journal;
  	}
-	EXT4_SB(sb)->journal_bdev = bdev;
+	EXT4_SB(sb)->s_journal_bdev = bdev;
  	ext4_init_journal_params(sb, journal);
  	return journal;