All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] exfat: change exfat_set_vol_flags() return type void.
@ 2020-07-15 13:50 youngjun
  2020-07-17  6:35 ` Tetsuhiro Kohada
  0 siblings, 1 reply; 2+ messages in thread
From: youngjun @ 2020-07-15 13:50 UTC (permalink / raw)
  To: Namjae Jeon, Sungjong Seo; +Cc: linux-fsdevel, linux-kernel, youngjun

exfat_set_vol_flags() always return 0.
So, change function return type as void.

Signed-off-by: youngjun <her0gyugyu@gmail.com>
---
 fs/exfat/exfat_fs.h |  2 +-
 fs/exfat/super.c    | 15 +++++++--------
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/fs/exfat/exfat_fs.h b/fs/exfat/exfat_fs.h
index 7579cd3bbadb..2130f62bf518 100644
--- a/fs/exfat/exfat_fs.h
+++ b/fs/exfat/exfat_fs.h
@@ -383,7 +383,7 @@ static inline int exfat_sector_to_cluster(struct exfat_sb_info *sbi,
 }
 
 /* super.c */
-int exfat_set_vol_flags(struct super_block *sb, unsigned short new_flag);
+void exfat_set_vol_flags(struct super_block *sb, unsigned short new_flag);
 
 /* fatent.c */
 #define exfat_get_next_cluster(sb, pclu) exfat_ent_get(sb, *(pclu), pclu)
diff --git a/fs/exfat/super.c b/fs/exfat/super.c
index 253a92460d52..dc05935cb88f 100644
--- a/fs/exfat/super.c
+++ b/fs/exfat/super.c
@@ -58,17 +58,16 @@ static void exfat_put_super(struct super_block *sb)
 static int exfat_sync_fs(struct super_block *sb, int wait)
 {
 	struct exfat_sb_info *sbi = EXFAT_SB(sb);
-	int err = 0;
 
 	/* If there are some dirty buffers in the bdev inode */
 	mutex_lock(&sbi->s_lock);
 	if (test_and_clear_bit(EXFAT_SB_DIRTY, &sbi->s_state)) {
 		sync_blockdev(sb->s_bdev);
-		if (exfat_set_vol_flags(sb, VOL_CLEAN))
-			err = -EIO;
+		exfat_set_vol_flags(sb, VOL_CLEAN);
+
 	}
 	mutex_unlock(&sbi->s_lock);
-	return err;
+	return 0;
 }
 
 static int exfat_statfs(struct dentry *dentry, struct kstatfs *buf)
@@ -98,7 +97,7 @@ static int exfat_statfs(struct dentry *dentry, struct kstatfs *buf)
 	return 0;
 }
 
-int exfat_set_vol_flags(struct super_block *sb, unsigned short new_flag)
+void exfat_set_vol_flags(struct super_block *sb, unsigned short new_flag)
 {
 	struct exfat_sb_info *sbi = EXFAT_SB(sb);
 	struct boot_sector *p_boot = (struct boot_sector *)sbi->boot_bh->b_data;
@@ -106,7 +105,7 @@ int exfat_set_vol_flags(struct super_block *sb, unsigned short new_flag)
 
 	/* flags are not changed */
 	if (sbi->vol_flag == new_flag)
-		return 0;
+		return;
 
 	sbi->vol_flag = new_flag;
 
@@ -114,7 +113,7 @@ int exfat_set_vol_flags(struct super_block *sb, unsigned short new_flag)
 	 * if this volume has been mounted with read-only
 	 */
 	if (sb_rdonly(sb))
-		return 0;
+		return;
 
 	p_boot->vol_flags = cpu_to_le16(new_flag);
 
@@ -128,7 +127,7 @@ int exfat_set_vol_flags(struct super_block *sb, unsigned short new_flag)
 
 	if (sync)
 		sync_dirty_buffer(sbi->boot_bh);
-	return 0;
+	return;
 }
 
 static int exfat_show_options(struct seq_file *m, struct dentry *root)
-- 
2.17.1


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

* Re: [PATCH] exfat: change exfat_set_vol_flags() return type void.
  2020-07-15 13:50 [PATCH] exfat: change exfat_set_vol_flags() return type void youngjun
@ 2020-07-17  6:35 ` Tetsuhiro Kohada
  0 siblings, 0 replies; 2+ messages in thread
From: Tetsuhiro Kohada @ 2020-07-17  6:35 UTC (permalink / raw)
  To: youngjun, Namjae Jeon, Sungjong Seo; +Cc: linux-fsdevel, linux-kernel

On 2020/07/15 22:50, youngjun wrote:
> exfat_set_vol_flags() always return 0.
> So, change function return type as void.

On the contrary, I think it should be fixed to return an appropriate error.


> @@ -114,7 +113,7 @@ int exfat_set_vol_flags(struct super_block *sb, unsigned short new_flag)
>   	 * if this volume has been mounted with read-only
>   	 */
>   	if (sb_rdonly(sb))
> -		return 0;
> +		return;

Some other FileSystems return -EROFS.
exfat-fs may also need to return it.
(If so, the caller will also need to be modified)


>   	p_boot->vol_flags = cpu_to_le16(new_flag);
>   
> @@ -128,7 +127,7 @@ int exfat_set_vol_flags(struct super_block *sb, unsigned short new_flag)
>   
>   	if (sync)
>   		sync_dirty_buffer(sbi->boot_bh);
> -	return 0;
> +	return;

Shouldn't the execution result be returned when sync_dirty_buffer() is executed?


BR
---
Tetsuhiro Kohada <kohada.t2@gmail.com>

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

end of thread, other threads:[~2020-07-17  6:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-15 13:50 [PATCH] exfat: change exfat_set_vol_flags() return type void youngjun
2020-07-17  6:35 ` Tetsuhiro Kohada

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.