diff mbox

[11/24] ecryptfs: Convert to separately allocated bdi

Message ID 20170202173422.3240-12-jack@suse.cz (mailing list archive)
State New, archived
Headers show

Commit Message

Jan Kara Feb. 2, 2017, 5:34 p.m. UTC
Allocate struct backing_dev_info separately instead of embedding it
inside the superblock. This unifies handling of bdi among users.

CC: Tyler Hicks <tyhicks@canonical.com>
CC: ecryptfs@vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/ecryptfs/ecryptfs_kernel.h | 1 -
 fs/ecryptfs/main.c            | 4 +---
 2 files changed, 1 insertion(+), 4 deletions(-)

Comments

Tyler Hicks Feb. 3, 2017, 11:54 p.m. UTC | #1
On 02/02/2017 11:34 AM, Jan Kara wrote:
> Allocate struct backing_dev_info separately instead of embedding it
> inside the superblock. This unifies handling of bdi among users.
> 
> CC: Tyler Hicks <tyhicks@canonical.com>

Looks fine to me.

Acked-by: Tyler Hicks <tyhicks@canonical.com>

> CC: ecryptfs@vger.kernel.org
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
>  fs/ecryptfs/ecryptfs_kernel.h | 1 -
>  fs/ecryptfs/main.c            | 4 +---
>  2 files changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h
> index 599a29237cfe..e93444a4c4b1 100644
> --- a/fs/ecryptfs/ecryptfs_kernel.h
> +++ b/fs/ecryptfs/ecryptfs_kernel.h
> @@ -349,7 +349,6 @@ struct ecryptfs_mount_crypt_stat {
>  struct ecryptfs_sb_info {
>  	struct super_block *wsi_sb;
>  	struct ecryptfs_mount_crypt_stat mount_crypt_stat;
> -	struct backing_dev_info bdi;
>  };
>  
>  /* file private data. */
> diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
> index 151872dcc1f4..9014479d0160 100644
> --- a/fs/ecryptfs/main.c
> +++ b/fs/ecryptfs/main.c
> @@ -519,12 +519,11 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags
>  		goto out;
>  	}
>  
> -	rc = bdi_setup_and_register(&sbi->bdi, "ecryptfs");
> +	rc = super_setup_bdi(s);
>  	if (rc)
>  		goto out1;
>  
>  	ecryptfs_set_superblock_private(s, sbi);
> -	s->s_bdi = &sbi->bdi;
>  
>  	/* ->kill_sb() will take care of sbi after that point */
>  	sbi = NULL;
> @@ -633,7 +632,6 @@ static void ecryptfs_kill_block_super(struct super_block *sb)
>  	if (!sb_info)
>  		return;
>  	ecryptfs_destroy_mount_crypt_stat(&sb_info->mount_crypt_stat);
> -	bdi_destroy(&sb_info->bdi);
>  	kmem_cache_free(ecryptfs_sb_info_cache, sb_info);
>  }
>  
>
diff mbox

Patch

diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h
index 599a29237cfe..e93444a4c4b1 100644
--- a/fs/ecryptfs/ecryptfs_kernel.h
+++ b/fs/ecryptfs/ecryptfs_kernel.h
@@ -349,7 +349,6 @@  struct ecryptfs_mount_crypt_stat {
 struct ecryptfs_sb_info {
 	struct super_block *wsi_sb;
 	struct ecryptfs_mount_crypt_stat mount_crypt_stat;
-	struct backing_dev_info bdi;
 };
 
 /* file private data. */
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index 151872dcc1f4..9014479d0160 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -519,12 +519,11 @@  static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags
 		goto out;
 	}
 
-	rc = bdi_setup_and_register(&sbi->bdi, "ecryptfs");
+	rc = super_setup_bdi(s);
 	if (rc)
 		goto out1;
 
 	ecryptfs_set_superblock_private(s, sbi);
-	s->s_bdi = &sbi->bdi;
 
 	/* ->kill_sb() will take care of sbi after that point */
 	sbi = NULL;
@@ -633,7 +632,6 @@  static void ecryptfs_kill_block_super(struct super_block *sb)
 	if (!sb_info)
 		return;
 	ecryptfs_destroy_mount_crypt_stat(&sb_info->mount_crypt_stat);
-	bdi_destroy(&sb_info->bdi);
 	kmem_cache_free(ecryptfs_sb_info_cache, sb_info);
 }