Linux-ext4 Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] ext2: code cleanup for descriptor_loc()
@ 2019-11-15 22:49 Chengguang Xu
  2019-11-19 16:05 ` Jan Kara
  0 siblings, 1 reply; 2+ messages in thread
From: Chengguang Xu @ 2019-11-15 22:49 UTC (permalink / raw)
  To: jack; +Cc: linux-ext4, Chengguang Xu

Code cleanup by removing unnecessary variable
in descriptor_loc().

Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
---
 fs/ext2/super.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 30c630d73f0f..bef607d5db28 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -806,7 +806,6 @@ static unsigned long descriptor_loc(struct super_block *sb,
 {
 	struct ext2_sb_info *sbi = EXT2_SB(sb);
 	unsigned long bg, first_meta_bg;
-	int has_super = 0;
 	
 	first_meta_bg = le32_to_cpu(sbi->s_es->s_first_meta_bg);
 
@@ -814,10 +813,8 @@ static unsigned long descriptor_loc(struct super_block *sb,
 	    nr < first_meta_bg)
 		return (logic_sb_block + nr + 1);
 	bg = sbi->s_desc_per_block * nr;
-	if (ext2_bg_has_super(sb, bg))
-		has_super = 1;
 
-	return ext2_group_first_block_no(sb, bg) + has_super;
+	return ext2_group_first_block_no(sb, bg) + ext2_bg_has_super(sb, bg);
 }
 
 static int ext2_fill_super(struct super_block *sb, void *data, int silent)
-- 
2.21.0




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ext2: code cleanup for descriptor_loc()
  2019-11-15 22:49 [PATCH] ext2: code cleanup for descriptor_loc() Chengguang Xu
@ 2019-11-19 16:05 ` Jan Kara
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Kara @ 2019-11-19 16:05 UTC (permalink / raw)
  To: Chengguang Xu; +Cc: jack, linux-ext4

On Sat 16-11-19 06:49:00, Chengguang Xu wrote:
> Code cleanup by removing unnecessary variable
> in descriptor_loc().
> 
> Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>

Thanks! I've added the patch to my tree.

								Honza

> ---
>  fs/ext2/super.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/fs/ext2/super.c b/fs/ext2/super.c
> index 30c630d73f0f..bef607d5db28 100644
> --- a/fs/ext2/super.c
> +++ b/fs/ext2/super.c
> @@ -806,7 +806,6 @@ static unsigned long descriptor_loc(struct super_block *sb,
>  {
>  	struct ext2_sb_info *sbi = EXT2_SB(sb);
>  	unsigned long bg, first_meta_bg;
> -	int has_super = 0;
>  	
>  	first_meta_bg = le32_to_cpu(sbi->s_es->s_first_meta_bg);
>  
> @@ -814,10 +813,8 @@ static unsigned long descriptor_loc(struct super_block *sb,
>  	    nr < first_meta_bg)
>  		return (logic_sb_block + nr + 1);
>  	bg = sbi->s_desc_per_block * nr;
> -	if (ext2_bg_has_super(sb, bg))
> -		has_super = 1;
>  
> -	return ext2_group_first_block_no(sb, bg) + has_super;
> +	return ext2_group_first_block_no(sb, bg) + ext2_bg_has_super(sb, bg);
>  }
>  
>  static int ext2_fill_super(struct super_block *sb, void *data, int silent)
> -- 
> 2.21.0
> 
> 
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-15 22:49 [PATCH] ext2: code cleanup for descriptor_loc() Chengguang Xu
2019-11-19 16:05 ` Jan Kara

Linux-ext4 Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-ext4/0 linux-ext4/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-ext4 linux-ext4/ https://lore.kernel.org/linux-ext4 \
		linux-ext4@vger.kernel.org
	public-inbox-index linux-ext4

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-ext4


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git