All of lore.kernel.org
 help / color / mirror / Atom feed
From: Saiyam Doshi <saiyamdoshi.in@gmail.com>
To: valdis.kletnieks@vt.edu, gregkh@linuxfoundation.org
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: [PATCH] staging: exfat: use bdev_sync function directly where needed
Date: Wed, 2 Oct 2019 20:47:03 +0530	[thread overview]
Message-ID: <20191002151703.GA6594@SD> (raw)

fs_sync() is wrapper to bdev_sync(). When fs_sync is called with
non-zero argument, bdev_sync gets called.

Most instances of fs_sync is called with false and very few with
true. Refactor this and makes direct call to bdev_sync() where
needed and removes fs_sync definition.

Signed-off-by: Saiyam Doshi <saiyamdoshi.in@gmail.com>
---
 drivers/staging/exfat/exfat_super.c | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/exfat/exfat_super.c b/drivers/staging/exfat/exfat_super.c
index 229ecabe7a93..3d3b0f0eebdc 100644
--- a/drivers/staging/exfat/exfat_super.c
+++ b/drivers/staging/exfat/exfat_super.c
@@ -285,12 +285,6 @@ static const struct dentry_operations exfat_dentry_ops = {
 
 static DEFINE_SEMAPHORE(z_sem);
 
-static inline void fs_sync(struct super_block *sb, bool do_sync)
-{
-	if (do_sync)
-		bdev_sync(sb);
-}
-
 /*
  * If ->i_mode can't hold S_IWUGO (i.e. ATTR_RO), we use ->i_attrs to
  * save ATTR_RO instead of ->i_mode.
@@ -458,7 +452,6 @@ static int ffsUmountVol(struct super_block *sb)
 	/* acquire the lock for file system critical section */
 	down(&p_fs->v_sem);
 
-	fs_sync(sb, false);
 	fs_set_vol_flags(sb, VOL_CLEAN);
 
 	if (p_fs->vol_type == EXFAT) {
@@ -527,7 +520,9 @@ static int ffsSyncVol(struct super_block *sb, bool do_sync)
 	down(&p_fs->v_sem);
 
 	/* synchronize the file system */
-	fs_sync(sb, do_sync);
+	if (do_sync)
+		bdev_sync(sb);
+
 	fs_set_vol_flags(sb, VOL_CLEAN);
 
 	if (p_fs->dev_ejected)
@@ -667,7 +662,6 @@ static int ffsCreateFile(struct inode *inode, char *path, u8 mode,
 	ret = create_file(inode, &dir, &uni_name, mode, fid);
 
 #ifdef CONFIG_EXFAT_DELAYED_SYNC
-	fs_sync(sb, false);
 	fs_set_vol_flags(sb, VOL_CLEAN);
 #endif
 
@@ -1040,7 +1034,6 @@ static int ffsWriteFile(struct inode *inode, struct file_id_t *fid,
 	}
 
 #ifdef CONFIG_EXFAT_DELAYED_SYNC
-	fs_sync(sb, false);
 	fs_set_vol_flags(sb, VOL_CLEAN);
 #endif
 
@@ -1180,7 +1173,6 @@ static int ffsTruncateFile(struct inode *inode, u64 old_size, u64 new_size)
 		fid->rwoffset = fid->size;
 
 #ifdef CONFIG_EXFAT_DELAYED_SYNC
-	fs_sync(sb, false);
 	fs_set_vol_flags(sb, VOL_CLEAN);
 #endif
 
@@ -1328,7 +1320,6 @@ static int ffsMoveFile(struct inode *old_parent_inode, struct file_id_t *fid,
 	}
 out:
 #ifdef CONFIG_EXFAT_DELAYED_SYNC
-	fs_sync(sb, false);
 	fs_set_vol_flags(sb, VOL_CLEAN);
 #endif
 
@@ -1390,7 +1381,6 @@ static int ffsRemoveFile(struct inode *inode, struct file_id_t *fid)
 	fid->flags = (p_fs->vol_type == EXFAT) ? 0x03 : 0x01;
 
 #ifdef CONFIG_EXFAT_DELAYED_SYNC
-	fs_sync(sb, false);
 	fs_set_vol_flags(sb, VOL_CLEAN);
 #endif
 
@@ -1479,7 +1469,6 @@ static int ffsSetAttr(struct inode *inode, u32 attr)
 	}
 
 #ifdef CONFIG_EXFAT_DELAYED_SYNC
-	fs_sync(sb, false);
 	fs_set_vol_flags(sb, VOL_CLEAN);
 #endif
 
@@ -1917,7 +1906,6 @@ static int ffsCreateDir(struct inode *inode, char *path, struct file_id_t *fid)
 	ret = create_dir(inode, &dir, &uni_name, fid);
 
 #ifdef CONFIG_EXFAT_DELAYED_SYNC
-	fs_sync(sb, false);
 	fs_set_vol_flags(sb, VOL_CLEAN);
 #endif
 
@@ -2178,7 +2166,6 @@ static int ffsRemoveDir(struct inode *inode, struct file_id_t *fid)
 	fid->flags = (p_fs->vol_type == EXFAT) ? 0x03 : 0x01;
 
 #ifdef CONFIG_EXFAT_DELAYED_SYNC
-	fs_sync(sb, false);
 	fs_set_vol_flags(sb, VOL_CLEAN);
 #endif
 
-- 
2.20.1


             reply	other threads:[~2019-10-02 15:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-02 15:17 Saiyam Doshi [this message]
2019-10-02 19:04 ` [PATCH] staging: exfat: use bdev_sync function directly where needed Valdis Klētnieks
2019-10-03 11:46   ` Dan Carpenter
2019-10-03 11:48     ` Dan Carpenter
2019-10-03 11:13 ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191002151703.GA6594@SD \
    --to=saiyamdoshi.in@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=valdis.kletnieks@vt.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.