Patchwork [2/4] ext4: use sync_inode_metadata() when sync inode metadata

login
register
mail settings
Submitter Guo Chao
Date Nov. 30, 2012, 6:41 a.m.
Message ID <1354257706-6582-2-git-send-email-yan@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/202879/
State Accepted
Headers show

Comments

Guo Chao - Nov. 30, 2012, 6:41 a.m.
We have a dedicated interface to sync inode metadata.

Signed-off-by: Guo Chao <yan@linux.vnet.ibm.com>
---
 fs/ext4/fsync.c |    6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
Lukas Czerner - Nov. 30, 2012, 1:24 p.m.
On Fri, 30 Nov 2012, Guo Chao wrote:

> Date: Fri, 30 Nov 2012 14:41:44 +0800
> From: Guo Chao <yan@linux.vnet.ibm.com>
> To: tytso@mit.edu
> Cc: linux-ext4@vger.kernel.org
> Subject: [PATCH 2/4] ext4: use sync_inode_metadata() when sync inode metadata
> 
> We have a dedicated interface to sync inode metadata.
> 
> Signed-off-by: Guo Chao <yan@linux.vnet.ibm.com>
> ---
>  fs/ext4/fsync.c |    6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c
> index be1d89f..dfbc1fe 100644
> --- a/fs/ext4/fsync.c
> +++ b/fs/ext4/fsync.c
> @@ -44,7 +44,6 @@
>   */
>  static int ext4_sync_parent(struct inode *inode)
>  {
> -	struct writeback_control wbc;
>  	struct dentry *dentry = NULL;
>  	struct inode *next;
>  	int ret = 0;
> @@ -66,10 +65,7 @@ static int ext4_sync_parent(struct inode *inode)
>  		ret = sync_mapping_buffers(inode->i_mapping);
>  		if (ret)
>  			break;
> -		memset(&wbc, 0, sizeof(wbc));
> -		wbc.sync_mode = WB_SYNC_ALL;
> -		wbc.nr_to_write = 0;         /* only write out the inode */
> -		ret = sync_inode(inode, &wbc);
> +		ret = sync_inode_metadata(inode, 1);
>  		if (ret)
>  			break;
>  	}
> 

Makes sense.

Reviewed-by: Lukas Czerner <lczerner@redhat.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Theodore Ts'o - Dec. 3, 2012, 4:51 a.m.
On Fri, Nov 30, 2012 at 02:41:44PM +0800, Guo Chao wrote:
> We have a dedicated interface to sync inode metadata.
> 
> Signed-off-by: Guo Chao <yan@linux.vnet.ibm.com>

Thanks, applied.

						- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c
index be1d89f..dfbc1fe 100644
--- a/fs/ext4/fsync.c
+++ b/fs/ext4/fsync.c
@@ -44,7 +44,6 @@ 
  */
 static int ext4_sync_parent(struct inode *inode)
 {
-	struct writeback_control wbc;
 	struct dentry *dentry = NULL;
 	struct inode *next;
 	int ret = 0;
@@ -66,10 +65,7 @@  static int ext4_sync_parent(struct inode *inode)
 		ret = sync_mapping_buffers(inode->i_mapping);
 		if (ret)
 			break;
-		memset(&wbc, 0, sizeof(wbc));
-		wbc.sync_mode = WB_SYNC_ALL;
-		wbc.nr_to_write = 0;         /* only write out the inode */
-		ret = sync_inode(inode, &wbc);
+		ret = sync_inode_metadata(inode, 1);
 		if (ret)
 			break;
 	}