From: Jan Kara <jack@suse.cz> Date: 2017-02-02 17:41:11
Hello,
this patch series converts all embedded occurences of struct backing_dev_info
to use standalone dynamically allocated structures. This makes bdi handling
unified across all bdi users and generally removes some boilerplate code from
filesystems setting up their own bdi. It also allows us to remove some code
from generic bdi implementation.
The patches were only compile-tested for most filesystems (I've tested
mounting only for NFS & btrfs) so fs maintainers please have a look whether
the changes look sound to you.
This series is based on top of bdi fixes that were merged into linux-block
git tree.
Honza
From: Jan Kara <jack@suse.cz> Date: 2017-02-02 17:35:58
Add function that registers bdi and takes va_list instead of variable
number of arguments.
Signed-off-by: Jan Kara <jack@suse.cz>
---
include/linux/backing-dev.h | 2 ++
mm/backing-dev.c | 20 +++++++++++++++-----
2 files changed, 17 insertions(+), 5 deletions(-)
@@ -824,18 +824,15 @@ struct backing_dev_info *bdi_alloc(gfp_t gfp_mask)}EXPORT_SYMBOL(bdi_alloc);-intbdi_register(structbacking_dev_info*bdi,structdevice*parent,-constchar*fmt,...)+intbdi_register_va(structbacking_dev_info*bdi,structdevice*parent,+constchar*fmt,va_listargs){-va_listargs;structdevice*dev;if(bdi->dev)/* The driver needs to use separate queues per device */return0;-va_start(args,fmt);dev=device_create_vargs(bdi_class,parent,MKDEV(0,0),bdi,fmt,args);-va_end(args);if(IS_ERR(dev))returnPTR_ERR(dev);
From: Jan Kara <jack@suse.cz> Date: 2017-02-02 17:35:59
So far we just relied on block device to hold a bdi reference for us
while the filesystem is mounted. While that works perfectly fine, it is
a bit awkward that we have a pointer to a refcounted structure in the
superblock without proper reference. So make s_bdi hold a proper
reference to block device's BDI. No filesystem using mount_bdev()
actually changes s_bdi so this is safe and will make bdev filesystems
work the same way as filesystems needing to set up their private bdi.
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/super.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
@@ -938,25 +930,23 @@ static int ceph_compare_super(struct super_block *sb, void *data)*/staticatomic_long_tbdi_seq=ATOMIC_LONG_INIT(0);-staticintceph_register_bdi(structsuper_block*sb,-structceph_fs_client*fsc)+staticintceph_setup_bdi(structsuper_block*sb,structceph_fs_client*fsc){interr;+err=super_setup_bdi_name(sb,"ceph-%ld",+atomic_long_inc_return(&bdi_seq));+if(err)+returnerr;+/* set ra_pages based on rasize mount option? */if(fsc->mount_options->rasize>=PAGE_SIZE)-fsc->backing_dev_info.ra_pages=+sb->s_bdi->ra_pages=(fsc->mount_options->rasize+PAGE_SIZE-1)>>PAGE_SHIFT;else-fsc->backing_dev_info.ra_pages=-VM_MAX_READAHEAD*1024/PAGE_SIZE;--err=bdi_register(&fsc->backing_dev_info,NULL,"ceph-%ld",-atomic_long_inc_return(&bdi_seq));-if(!err)-sb->s_bdi=&fsc->backing_dev_info;-returnerr;+sb->s_bdi->ra_pages=VM_MAX_READAHEAD*1024/PAGE_SIZE;+return0;}staticstructdentry*ceph_mount(structfile_system_type*fs_type,
@@ -1011,7 +1001,7 @@ static struct dentry *ceph_mount(struct file_system_type *fs_type,dout("get_sb got existing client %p\n",fsc);}else{dout("get_sb using new client %p\n",fsc);-err=ceph_register_bdi(sb,fsc);+err=ceph_setup_bdi(sb,fsc);if(err<0){res=ERR_PTR(err);gotoout_splat;
From: Jan Kara <jack@suse.cz> Date: 2017-02-02 17:36:01
It is not used anywhere.
CC: Mike Marshall <hubcap@omnibond.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/orangefs/inode.c | 6 ------
fs/orangefs/orangefs-kernel.h | 1 -
fs/orangefs/orangefs-mod.c | 12 +-----------
3 files changed, 1 insertion(+), 18 deletions(-)
@@ -80,11 +80,6 @@ static int __init orangefs_init(void)intret=-1;__u32i=0;-ret=bdi_init(&orangefs_backing_dev_info);--if(ret)-returnret;-if(op_timeout_secs<0)op_timeout_secs=0;
@@ -94,7 +89,7 @@ static int __init orangefs_init(void)/* initialize global book keeping data structures */ret=op_cache_initialize();if(ret<0)-gotoerr;+gotoout;ret=orangefs_inode_cache_initialize();if(ret<0)
@@ -181,9 +176,6 @@ static int __init orangefs_init(void)cleanup_op:op_cache_finalize();-err:-bdi_destroy(&orangefs_backing_dev_info);-out:returnret;}
@@ -519,12 +519,11 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flagsgotoout;}-rc=bdi_setup_and_register(&sbi->bdi,"ecryptfs");+rc=super_setup_bdi(s);if(rc)gotoout1;ecryptfs_set_superblock_private(s,sbi);-s->s_bdi=&sbi->bdi;/* ->kill_sb() will take care of sbi after that point */sbi=NULL;
@@ -1267,9 +1267,6 @@ struct mm_struct;/* sb->s_iflags to limit user namespace mounts */#define SB_I_USERNS_VISIBLE 0x00000010 /* fstype already mounted */-/* Temporary flag until all filesystems are converted to dynamic bdis */-#define SB_I_DYNBDI 0x00000100-/* Possible states of 'frozen' field */enum{SB_UNFROZEN=0,/* FS is unfrozen */
@@ -114,7 +114,6 @@ struct v9fs_session_info {kuid_tuid;/* if ACCESS_SINGLE, the uid that has access */structp9_client*clnt;/* 9p client */structlist_headslist;/* list of sessions registered with v9fs */-structbacking_dev_infobdi;structrw_semaphorerename_sem;};
@@ -1810,21 +1810,6 @@ static int btrfs_congested_fn(void *congested_data, int bdi_bits)returnret;}-staticintsetup_bdi(structbtrfs_fs_info*info,structbacking_dev_info*bdi)-{-interr;--err=bdi_setup_and_register(bdi,"btrfs");-if(err)-returnerr;--bdi->ra_pages=VM_MAX_READAHEAD*1024/PAGE_SIZE;-bdi->congested_fn=btrfs_congested_fn;-bdi->congested_data=info;-bdi->capabilities|=BDI_CAP_CGROUP_WRITEBACK;-return0;-}-/**calledbythekthreadhelperfunctionstofinallycallthebioend_io*functions.Thisiswherereadchecksumverificationactuallyhappens
@@ -2598,16 +2583,10 @@ int open_ctree(struct super_block *sb,gotofail;}-ret=setup_bdi(fs_info,&fs_info->bdi);-if(ret){-err=ret;-gotofail_srcu;-}-ret=percpu_counter_init(&fs_info->dirty_metadata_bytes,0,GFP_KERNEL);if(ret){err=ret;-gotofail_bdi;+gotofail_srcu;}fs_info->dirty_metadata_batch=PAGE_SIZE*(1+ilog2(nr_cpu_ids));
@@ -2715,7 +2694,6 @@ int open_ctree(struct super_block *sb,sb->s_blocksize=4096;sb->s_blocksize_bits=blksize_bits(4096);-sb->s_bdi=&fs_info->bdi;btrfs_init_btree_inode(fs_info);
@@ -2912,9 +2890,12 @@ int open_ctree(struct super_block *sb,gotofail_sb_buffer;}-fs_info->bdi.ra_pages*=btrfs_super_num_devices(disk_super);-fs_info->bdi.ra_pages=max(fs_info->bdi.ra_pages,-SZ_4M/PAGE_SIZE);+sb->s_bdi->congested_fn=btrfs_congested_fn;+sb->s_bdi->congested_data=fs_info;+sb->s_bdi->capabilities|=BDI_CAP_CGROUP_WRITEBACK;+sb->s_bdi->ra_pages=VM_MAX_READAHEAD*1024/PAGE_SIZE;+sb->s_bdi->ra_pages*=btrfs_super_num_devices(disk_super);+sb->s_bdi->ra_pages=max(sb->s_bdi->ra_pages,SZ_4M/PAGE_SIZE);sb->s_blocksize=sectorsize;sb->s_blocksize_bits=blksize_bits(sectorsize);
@@ -3282,8 +3263,6 @@ int open_ctree(struct super_block *sb,percpu_counter_destroy(&fs_info->delalloc_bytes);fail_dirty_metadata_bytes:percpu_counter_destroy(&fs_info->dirty_metadata_bytes);-fail_bdi:-bdi_destroy(&fs_info->bdi);fail_srcu:cleanup_srcu_struct(&fs_info->subvol_srcu);fail:
@@ -631,9 +631,6 @@ struct fuse_conn {/** Negotiated minor version */unsignedminor;-/** Backing dev info */-structbacking_dev_infobdi;-/** Entry on the fuse_conn_list */structlist_headentry;
@@ -183,10 +183,6 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent)gotounlock_out;}-error=bdi_setup_and_register(&vc->bdi,"coda");-if(error)-gotounlock_out;-vc->vc_sb=sb;mutex_unlock(&vc->vc_mutex);
@@ -197,7 +193,10 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent)sb->s_magic=CODA_SUPER_MAGIC;sb->s_op=&coda_super_operations;sb->s_d_op=&coda_dentry_operations;-sb->s_bdi=&vc->bdi;++error=super_setup_bdi(sb);+if(error)+gotoerror;/* get root fid from Venus: this needs the root inode */error=venus_rootfid(sb,&fid);
@@ -228,7 +227,6 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent)error:mutex_lock(&vc->vc_mutex);-bdi_destroy(&vc->bdi);vc->vc_sb=NULL;sb->s_fs_info=NULL;unlock_out:
@@ -310,7 +310,6 @@ struct afs_volume {unsignedshortrjservers;/* number of servers discarded due to -ENOMEDIUM */structafs_server*servers[8];/* servers on which volume resides (ordered) */structrw_semaphoreserver_sem;/* lock for accessing current server */-structbacking_dev_infobdi;};/*
@@ -106,10 +106,6 @@ struct afs_volume *afs_volume_lookup(struct afs_mount_params *params)volume->cell=params->cell;volume->vid=vlocation->vldb.vid[params->type];-ret=bdi_setup_and_register(&volume->bdi,"afs");-if(ret)-gotoerror_bdi;-init_rwsem(&volume->server_sem);/* look up all the applicable server records */
@@ -68,7 +68,6 @@ struct cifs_sb_info {umode_tmnt_dir_mode;unsignedintmnt_cifs_flags;char*mountdata;/* options received at mount time or via DFS refs */-structbacking_dev_infobdi;structdelayed_workprune_tlinks;structrcu_headrcu;char*prepath;
From: Jan Kara <jack@suse.cz> Date: 2017-02-02 17:36:04
Similarly to set_bdev_super() GFS2 just used block device reference to
bdi. Convert it to properly getting bdi reference. The reference will
get automatically dropped on superblock destruction.
CC: Steven Whitehouse <redacted>
CC: Bob Peterson <redacted>
CC: cluster-devel@redhat.com
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/gfs2/ops_fstype.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
From: Jan Kara <jack@suse.cz> Date: 2017-02-02 17:36:04
Allocate struct backing_dev_info separately instead of embedding it
inside the superblock. This unifies handling of bdi among users.
CC: Petr Vandrovec <redacted>
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/ncpfs/inode.c | 8 ++------
fs/ncpfs/ncp_fs_sb.h | 1 -
2 files changed, 2 insertions(+), 7 deletions(-)
From: Jan Kara <jack@suse.cz> Date: 2017-02-02 17:36:04
Now that all backing_dev_info structure are allocated separately, we can
drop some unused functions.
Signed-off-by: Jan Kara <jack@suse.cz>
---
include/linux/backing-dev.h | 5 -----
mm/backing-dev.c | 54 +++++----------------------------------------
2 files changed, 5 insertions(+), 54 deletions(-)
From: Jan Kara <jack@suse.cz> Date: 2017-02-02 17:36:04
MTD already allocates backing_dev_info dynamically. Convert it to use
generic infrastructure for this including proper refcounting. We drop
mtd->backing_dev_info as its only use was to pass mtd_bdi pointer from
one file into another and if we wanted to keep that in a clean way, we'd
have to make mtd hold and drop bdi reference as needed which seems
pointless for passing one global pointer...
CC: David Woodhouse <dwmw2@infradead.org>
CC: Brian Norris <computersforpeace@gmail.com>
CC: linux-mtd@lists.infradead.org
Signed-off-by: Jan Kara <jack@suse.cz>
---
drivers/mtd/mtdcore.c | 23 ++++++++++++-----------
drivers/mtd/mtdsuper.c | 7 ++++++-
include/linux/mtd/mtd.h | 5 -----
3 files changed, 18 insertions(+), 17 deletions(-)
@@ -332,11 +332,6 @@ struct mtd_info {int(*_get_device)(structmtd_info*mtd);void(*_put_device)(structmtd_info*mtd);-/* Backing device capabilities for this device-*-providesmmapcapabilities-*/-structbacking_dev_info*backing_dev_info;-structnotifier_blockreboot_notifier;/* default mode before reboot *//* ECC status information */
From: Jan Kara <jack@suse.cz> Date: 2017-02-02 17:36:05
Most users will want to unregister bdi when dropping last reference to a
bdi. Only a few users (like block devices) want to play more complex
tricks with bdi registration and unregistration. So unregister bdi when
the last reference to bdi is dropped and just make sure we don't
unregister the bdi the second time if it is already unregistered.
Signed-off-by: Jan Kara <jack@suse.cz>
---
include/linux/backing-dev-defs.h | 3 ++-
mm/backing-dev.c | 10 ++++++++++
2 files changed, 12 insertions(+), 1 deletion(-)
@@ -897,6 +898,14 @@ static void bdi_remove_from_list(struct backing_dev_info *bdi)voidbdi_unregister(structbacking_dev_info*bdi){+spin_lock_bh(&bdi_lock);+if(!bdi->registered){+spin_unlock_bh(&bdi_lock);+return;+}+bdi->registered=0;+spin_unlock_bh(&bdi_lock);+/* make sure nobody finds us on the bdi_list anymore */bdi_remove_from_list(bdi);wb_shutdown(&bdi->wb);
@@ -809,8 +808,12 @@ static int exofs_fill_super(struct super_block *sb, void *data, int silent)__sbi_read_stats(sbi);/* set up operation vectors */-sbi->bdi.ra_pages=__ra_pages(&sbi->layout);-sb->s_bdi=&sbi->bdi;+ret=super_setup_bdi(sb);+if(ret){+EXOFS_DBGMSG("Failed to super_setup_bdi\n");+gotofree_sbi;+}+sb->s_bdi->ra_pages=__ra_pages(&sbi->layout);sb->s_fs_info=sbi;sb->s_op=&exofs_sops;sb->s_export_op=&exofs_export_ops;
@@ -836,14 +839,6 @@ static int exofs_fill_super(struct super_block *sb, void *data, int silent)gotofree_sbi;}-ret=bdi_setup_and_register(&sbi->bdi,"exofs");-if(ret){-EXOFS_DBGMSG("Failed to bdi_setup_and_register\n");-dput(sb->s_root);-sb->s_root=NULL;-gotofree_sbi;-}-exofs_sysfs_dbg_print();_exofs_print_device("Mounting",opts->dev_name,ore_comp_dev(&sbi->oc,0),
From: Jan Kara <jack@suse.cz> Date: 2017-02-02 17:36:05
Similarly to set_bdev_super() NILFS2 just used block device reference to
bdi. Convert it to properly getting bdi reference. The reference will
get automatically dropped on superblock destruction.
CC: Ryusuke Konishi <redacted>
CC: linux-nilfs@vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/nilfs2/super.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
@@ -143,7 +143,7 @@ struct backing_dev_info {congested_fn*congested_fn;/* Function pointer if device is md/dm */void*congested_data;/* Pointer to aux data for congested func */-char*name;+constchar*name;structkrefrefcnt;/* Reference counter for the structure */unsignedintregistered:1;/* Is bdi registered? */
@@ -1267,6 +1267,9 @@ struct mm_struct;/* sb->s_iflags to limit user namespace mounts */#define SB_I_USERNS_VISIBLE 0x00000010 /* fstype already mounted */+/* Temporary flag until all filesystems are converted to dynamic bdis */+#define SB_I_DYNBDI 0x00000100+/* Possible states of 'frozen' field */enum{SB_UNFROZEN=0,/* FS is unfrozen */
@@ -2103,6 +2106,9 @@ extern int vfs_ustat(dev_t, struct kstatfs *);externintfreeze_super(structsuper_block*super);externintthaw_super(structsuper_block*super);externboolour_mnt(structvfsmount*mnt);+extern__printf(2,3)+intsuper_setup_bdi_name(structsuper_block*sb,char*fmt,...);+externintsuper_setup_bdi(structsuper_block*sb);externintcurrent_umask(void);
From: Jan Kara <jack@suse.cz> Date: 2017-02-02 17:41:26
Provide bdi_alloc() forsimple allocation of a BDI that can be used by
filesystems that don't need anything fancy. We use this function when
converting filesystems from embedded struct backing_dev_info into a
dynamically allocated one.
Signed-off-by: Jan Kara <jack@suse.cz>
---
include/linux/backing-dev.h | 1 +
mm/backing-dev.c | 15 +++++++++++++++
2 files changed, 16 insertions(+)
Hi,
On Thu, Feb 02, 2017 at 06:34:02PM +0100, Jan Kara wrote:
Provide helper functions for setting up dynamically allocated
backing_dev_info structures for filesystems and cleaning them up on
superblock destruction.
Just one concern, will this cause problems for multiple superblock cases
like nfs with nosharecache?
Thanks,
-liubo
@@ -143,7 +143,7 @@ struct backing_dev_info {congested_fn*congested_fn;/* Function pointer if device is md/dm */void*congested_data;/* Pointer to aux data for congested func */-char*name;+constchar*name;structkrefrefcnt;/* Reference counter for the structure */unsignedintregistered:1;/* Is bdi registered? */
@@ -1267,6 +1267,9 @@ struct mm_struct;/* sb->s_iflags to limit user namespace mounts */#define SB_I_USERNS_VISIBLE 0x00000010 /* fstype already mounted */+/* Temporary flag until all filesystems are converted to dynamic bdis */+#define SB_I_DYNBDI 0x00000100+/* Possible states of 'frozen' field */enum{SB_UNFROZEN=0,/* FS is unfrozen */
@@ -2103,6 +2106,9 @@ extern int vfs_ustat(dev_t, struct kstatfs *);externintfreeze_super(structsuper_block*super);externintthaw_super(structsuper_block*super);externboolour_mnt(structvfsmount*mnt);+extern__printf(2,3)+intsuper_setup_bdi_name(structsuper_block*sb,char*fmt,...);+externintsuper_setup_bdi(structsuper_block*sb);externintcurrent_umask(void);
From: Richard Weinberger <richard@nod.at> Date: 2017-02-02 20:34:56
Jan,
Am 02.02.2017 um 18:34 schrieb Jan Kara:
Allocate struct backing_dev_info separately instead of embedding it
inside the superblock. This unifies handling of bdi among users.
CC: Richard Weinberger <richard@nod.at>
CC: Artem Bityutskiy <dedekind1@gmail.com>
CC: Adrian Hunter <adrian.hunter@intel.com>
CC: linux-mtd@lists.infradead.org
Signed-off-by: Jan Kara <jack@suse.cz>
Is this series available at some git tree, please?
Thanks,
//richard
From: Jan Kara <jack@suse.cz> Date: 2017-02-03 13:45:52
On Thu 02-02-17 21:34:32, Richard Weinberger wrote:
Jan,
Am 02.02.2017 um 18:34 schrieb Jan Kara:
quoted
Allocate struct backing_dev_info separately instead of embedding it
inside the superblock. This unifies handling of bdi among users.
CC: Richard Weinberger <richard@nod.at>
CC: Artem Bityutskiy <dedekind1@gmail.com>
CC: Adrian Hunter <adrian.hunter@intel.com>
CC: linux-mtd@lists.infradead.org
Signed-off-by: Jan Kara <jack@suse.cz>
Is this series available at some git tree, please?
I've pushed it out to:
git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs.git bdi
Honza
--
Jan Kara [off-list ref]
SUSE Labs, CR
From: Jan Kara <jack@suse.cz> Date: 2017-02-03 13:50:50
On Thu 02-02-17 11:28:27, Liu Bo wrote:
Hi,
On Thu, Feb 02, 2017 at 06:34:02PM +0100, Jan Kara wrote:
quoted
Provide helper functions for setting up dynamically allocated
backing_dev_info structures for filesystems and cleaning them up on
superblock destruction.
Just one concern, will this cause problems for multiple superblock cases
like nfs with nosharecache?
Can you ellaborate a bit? I've looked for a while what nfs with
nosharecache does but I didn't see how it would influence anything with
bdis...
Honza
--
Jan Kara [off-list ref]
SUSE Labs, CR
On Fri, Feb 03, 2017 at 02:50:42PM +0100, Jan Kara wrote:
On Thu 02-02-17 11:28:27, Liu Bo wrote:
quoted
Hi,
On Thu, Feb 02, 2017 at 06:34:02PM +0100, Jan Kara wrote:
quoted
Provide helper functions for setting up dynamically allocated
backing_dev_info structures for filesystems and cleaning them up on
superblock destruction.
Just one concern, will this cause problems for multiple superblock cases
like nfs with nosharecache?
Can you ellaborate a bit? I've looked for a while what nfs with
nosharecache does but I didn't see how it would influence anything with
bdis...
Oh, I missed that bdi_seq was static, then it should be fine.
(I was worried about that nfs with nosharecache would have multiple
superblocks and if each superblock has a bdi using the same bdi name,
nfs-xx.)
Thanks for the reply.
Thanks,
-liubo
@@ -1810,21 +1810,6 @@ static int btrfs_congested_fn(void *congested_data, int bdi_bits)returnret;}-staticintsetup_bdi(structbtrfs_fs_info*info,structbacking_dev_info*bdi)-{-interr;--err=bdi_setup_and_register(bdi,"btrfs");-if(err)-returnerr;--bdi->ra_pages=VM_MAX_READAHEAD*1024/PAGE_SIZE;-bdi->congested_fn=btrfs_congested_fn;-bdi->congested_data=info;-bdi->capabilities|=BDI_CAP_CGROUP_WRITEBACK;-return0;-}-/**calledbythekthreadhelperfunctionstofinallycallthebioend_io*functions.Thisiswherereadchecksumverificationactuallyhappens
@@ -2598,16 +2583,10 @@ int open_ctree(struct super_block *sb,gotofail;}-ret=setup_bdi(fs_info,&fs_info->bdi);-if(ret){-err=ret;-gotofail_srcu;-}-ret=percpu_counter_init(&fs_info->dirty_metadata_bytes,0,GFP_KERNEL);if(ret){err=ret;-gotofail_bdi;+gotofail_srcu;}fs_info->dirty_metadata_batch=PAGE_SIZE*(1+ilog2(nr_cpu_ids));
@@ -2715,7 +2694,6 @@ int open_ctree(struct super_block *sb,sb->s_blocksize=4096;sb->s_blocksize_bits=blksize_bits(4096);-sb->s_bdi=&fs_info->bdi;btrfs_init_btree_inode(fs_info);
@@ -2912,9 +2890,12 @@ int open_ctree(struct super_block *sb,gotofail_sb_buffer;}-fs_info->bdi.ra_pages*=btrfs_super_num_devices(disk_super);-fs_info->bdi.ra_pages=max(fs_info->bdi.ra_pages,-SZ_4M/PAGE_SIZE);+sb->s_bdi->congested_fn=btrfs_congested_fn;+sb->s_bdi->congested_data=fs_info;+sb->s_bdi->capabilities|=BDI_CAP_CGROUP_WRITEBACK;+sb->s_bdi->ra_pages=VM_MAX_READAHEAD*1024/PAGE_SIZE;+sb->s_bdi->ra_pages*=btrfs_super_num_devices(disk_super);+sb->s_bdi->ra_pages=max(sb->s_bdi->ra_pages,SZ_4M/PAGE_SIZE);sb->s_blocksize=sectorsize;sb->s_blocksize_bits=blksize_bits(sectorsize);
@@ -3282,8 +3263,6 @@ int open_ctree(struct super_block *sb,percpu_counter_destroy(&fs_info->delalloc_bytes);fail_dirty_metadata_bytes:percpu_counter_destroy(&fs_info->dirty_metadata_bytes);-fail_bdi:-bdi_destroy(&fs_info->bdi);fail_srcu:cleanup_srcu_struct(&fs_info->subvol_srcu);fail:
--
2.10.2
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Allocate struct backing_dev_info separately instead of embedding it
inside the superblock. This unifies handling of bdi among users.
CC: Tyler Hicks <redacted>
Looks fine to me.
Acked-by: Tyler Hicks <redacted>
@@ -519,12 +519,11 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flagsgotoout;}-rc=bdi_setup_and_register(&sbi->bdi,"ecryptfs");+rc=super_setup_bdi(s);if(rc)gotoout1;ecryptfs_set_superblock_private(s,sbi);-s->s_bdi=&sbi->bdi;/* ->kill_sb() will take care of sbi after that point */sbi=NULL;
@@ -631,9 +631,6 @@ struct fuse_conn {/** Negotiated minor version */unsignedminor;-/** Backing dev info */-structbacking_dev_infobdi;-/** Entry on the fuse_conn_list */structlist_headentry;
@@ -631,9 +631,6 @@ struct fuse_conn {/** Negotiated minor version */unsignedminor;-/** Backing dev info */-structbacking_dev_infobdi;-/** Entry on the fuse_conn_list */structlist_headentry;
From: Dilger, Andreas <hidden> Date: 2017-02-08 00:44:31
On Feb 2, 2017, at 10:34, Jan Kara [off-list ref] wrote:
Allocate struct backing_dev_info separately instead of embedding it
inside superblock. This unifies handling of bdi among users.
CC: Oleg Drokin <redacted>
CC: Andreas Dilger <redacted>
CC: James Simmons <redacted>
CC: lustre-devel@lists.lustre.org
Signed-off-by: Jan Kara <jack@suse.cz>
congested_fn *congested_fn; /* Function pointer if device is md/dm */
void *congested_data; /* Pointer to aux data for congested func */
- char *name;
+ const char *name;
struct kref refcnt; /* Reference counter for the structure */
unsigned int registered:1; /* Is bdi registered? */
/* sb->s_iflags to limit user namespace mounts */
#define SB_I_USERNS_VISIBLE 0x00000010 /* fstype already mounted */
+/* Temporary flag until all filesystems are converted to dynamic bdis */
+#define SB_I_DYNBDI 0x00000100
+
/* Possible states of 'frozen' field */
enum {
SB_UNFROZEN = 0, /* FS is unfrozen */
@@ -2103,6 +2106,9 @@ extern int vfs_ustat(dev_t, struct kstatfs *);
extern int freeze_super(struct super_block *super);
extern int thaw_super(struct super_block *super);
extern bool our_mnt(struct vfsmount *mnt);
+extern __printf(2, 3)
+int super_setup_bdi_name(struct super_block *sb, char *fmt, ...);
+extern int super_setup_bdi(struct super_block *sb);
extern int current_umask(void);
--
2.10.2
_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
Cheers, Andreas
--
Andreas Dilger
Lustre Principal Architect
Intel Corporation
@@ -2019,29 +2018,23 @@ static int ubifs_fill_super(struct super_block *sb, void *data, int silent)gotoout;}+err=ubifs_parse_options(c,data,0);+if(err)+gotoout_close;+/**UBIFSprovides'backing_dev_info'inordertodisableread-ahead.For*UBIFS,I/Oisnotdeferred,itisdoneimmediatelyinreadpage,*whichmeanstheuserwouldhavetowaitnotjustfortheirownI/O*buttheread-aheadI/Oaswelli.e.completelypointless.*-*Read-aheadwillbedisabledbecause@c->bdi.ra_pagesis0.+*Read-aheadwillbedisabledbecause@sb->s_bdi->ra_pagesis0.*/-c->bdi.name="ubifs",-c->bdi.capabilities=0;
So ->capabilities is now zero by default since you use __GFP_ZERO in
bdi_alloc().
At least for UBIFS I'll add a comment on this, otherwise it is not so
clear that UBIFS wants a BDI with no capabilities and how it achieves that.
Acked-by: Richard Weinberger <richard@nod.at>
Thanks,
//richard
From: David Sterba <hidden> Date: 2017-02-08 18:13:42
On Thu, Feb 02, 2017 at 06:34:06PM +0100, Jan Kara wrote:
Allocate struct backing_dev_info separately instead of embedding it
inside superblock. This unifies handling of bdi among users.
CC: Chris Mason <redacted>
CC: Josef Bacik <redacted>
CC: David Sterba <dsterba@suse.com>
CC: linux-btrfs@vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
@@ -2019,29 +2018,23 @@ static int ubifs_fill_super(struct super_block *sb, void *data, int silent)gotoout;}+err=ubifs_parse_options(c,data,0);+if(err)+gotoout_close;+/**UBIFSprovides'backing_dev_info'inordertodisableread-ahead.For*UBIFS,I/Oisnotdeferred,itisdoneimmediatelyinreadpage,*whichmeanstheuserwouldhavetowaitnotjustfortheirownI/O*buttheread-aheadI/Oaswelli.e.completelypointless.*-*Read-aheadwillbedisabledbecause@c->bdi.ra_pagesis0.+*Read-aheadwillbedisabledbecause@sb->s_bdi->ra_pagesis0.*/-c->bdi.name="ubifs",-c->bdi.capabilities=0;
So ->capabilities is now zero by default since you use __GFP_ZERO in
bdi_alloc().
At least for UBIFS I'll add a comment on this, otherwise it is not so
clear that UBIFS wants a BDI with no capabilities and how it achieves that.
OK, I've modified the comment to:
* Read-ahead will be disabled because @sb->s_bdi->ra_pages is 0. Also
* @sb->s_bdi->capabilities are initialized to 0 so there won't be any
* writeback happening.
*/
Acked-by: Richard Weinberger <richard@nod.at>
Thanks.
Honza
--
Jan Kara [off-list ref]
SUSE Labs, CR
Allocate struct backing_dev_info separately instead of embedding it
inside the superblock. This unifies handling of bdi among users.
CC: Boaz Harrosh <redacted>
CC: Benny Halevy <redacted>
CC: osd-dev@open-osd.org
ACK-by: Boaz Harrosh [off-list ref]
Looks fine thanks
quoted hunk
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/exofs/exofs.h | 1 -
fs/exofs/super.c | 17 ++++++-----------
2 files changed, 6 insertions(+), 12 deletions(-)
@@ -809,8 +808,12 @@ static int exofs_fill_super(struct super_block *sb, void *data, int silent)__sbi_read_stats(sbi);/* set up operation vectors */-sbi->bdi.ra_pages=__ra_pages(&sbi->layout);-sb->s_bdi=&sbi->bdi;+ret=super_setup_bdi(sb);+if(ret){+EXOFS_DBGMSG("Failed to super_setup_bdi\n");+gotofree_sbi;+}+sb->s_bdi->ra_pages=__ra_pages(&sbi->layout);sb->s_fs_info=sbi;sb->s_op=&exofs_sops;sb->s_export_op=&exofs_export_ops;
@@ -836,14 +839,6 @@ static int exofs_fill_super(struct super_block *sb, void *data, int silent)gotofree_sbi;}-ret=bdi_setup_and_register(&sbi->bdi,"exofs");-if(ret){-EXOFS_DBGMSG("Failed to bdi_setup_and_register\n");-dput(sb->s_root);-sb->s_root=NULL;-gotofree_sbi;-}-exofs_sysfs_dbg_print();_exofs_print_device("Mounting",opts->dev_name,ore_comp_dev(&sbi->oc,0),
So far we just relied on block device to hold a bdi reference for us
while the filesystem is mounted. While that works perfectly fine, it is
a bit awkward that we have a pointer to a refcounted structure in the
superblock without proper reference. So make s_bdi hold a proper
reference to block device's BDI. No filesystem using mount_bdev()
actually changes s_bdi so this is safe and will make bdev filesystems
work the same way as filesystems needing to set up their private bdi.
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/super.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
Question: So I have an FS that uses mount_bdev but than goes and overrides sb->s_bdev
in ->fill_super() anyway. This is because of two reasons. One because I have many
more devices. (like btrfs I'm moulti-dev) but I like to use mount_bdev because of the
somewhat delicate handling of automatic bind-mounts.
For me it is a bigger hack to get the ref-counting and bind-mounts locking correctly
then to bdi_put and say the new super_setup_bdi(sb) in fill_super. Would you expect
problems?
Thanks for any help
Boaz
From: Richard Weinberger <richard@nod.at> Date: 2017-02-09 14:56:36
Am 09.02.2017 um 13:17 schrieb Jan Kara:
quoted
So ->capabilities is now zero by default since you use __GFP_ZERO in
bdi_alloc().
At least for UBIFS I'll add a comment on this, otherwise it is not so
clear that UBIFS wants a BDI with no capabilities and how it achieves that.
OK, I've modified the comment to:
* Read-ahead will be disabled because @sb->s_bdi->ra_pages is 0. Also
* @sb->s_bdi->capabilities are initialized to 0 so there won't be any
* writeback happening.
*/
From: Jan Kara <jack@suse.cz> Date: 2017-02-09 15:54:03
On Thu 09-02-17 16:36:13, Boaz Harrosh wrote:
On 02/02/2017 07:34 PM, Jan Kara wrote:
quoted
So far we just relied on block device to hold a bdi reference for us
while the filesystem is mounted. While that works perfectly fine, it is
a bit awkward that we have a pointer to a refcounted structure in the
superblock without proper reference. So make s_bdi hold a proper
reference to block device's BDI. No filesystem using mount_bdev()
actually changes s_bdi so this is safe and will make bdev filesystems
work the same way as filesystems needing to set up their private bdi.
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/super.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
Question: So I have an FS that uses mount_bdev but than goes and
overrides sb->s_bdev in ->fill_super() anyway. This is because of two
reasons. One because I have many more devices. (like btrfs I'm
moulti-dev) but I like to use mount_bdev because of the somewhat delicate
handling of automatic bind-mounts.
For me it is a bigger hack to get the ref-counting and bind-mounts
locking correctly then to bdi_put and say the new super_setup_bdi(sb) in
fill_super. Would you expect problems?
No, that should work just fine.
Honza
--
Jan Kara [off-list ref]
SUSE Labs, CR