convert block layer to bioset_init()/mempool_init()
Subsystems (9)
cover convert block layer to bioset_init()/mempool_init()
Jens - this series does the rest of the conversions that Christoph wanted, and drops bioset_create().
Only lightly tested, but the changes are pretty mechanical. Based on your for-next tree.
It's also in the for-jens branch at https://evilpiepirate.org/git/bcachefs.git
Kent Overstreet (12):
block: convert bounce, q->bio_split to bioset_init()/mempool_init()
drbd: convert to bioset_init()/mempool_init()
pktcdvd: convert to bioset_init()/mempool_init()
lightnvm: convert to bioset_init()/mempool_init()
bcache: convert to bioset_init()/mempool_init()
md: convert to bioset_init()/mempool_init()
dm: convert to bioset_init()/mempool_init()
target: convert to bioset_init()/mempool_init()
fs: convert block_dev.c to bioset_init()
btrfs: convert to bioset_init()/mempool_init()
xfs: convert to bioset_init()/mempool_init()
block: Drop bioset_create()
block/bio.c | 61 +++++------------------ block/blk-core.c | 7 +-- block/blk-merge.c | 8 +-- block/blk-sysfs.c | 3 +- block/bounce.c | 47 +++++++++--------- drivers/block/drbd/drbd_bitmap.c | 4 +- drivers/block/drbd/drbd_int.h | 10 ++-- drivers/block/drbd/drbd_main.c | 71 ++++++++++----------------- drivers/block/drbd/drbd_receiver.c | 6 +-- drivers/block/drbd/drbd_req.c | 4 +- drivers/block/drbd/drbd_req.h | 2 +- drivers/block/pktcdvd.c | 50 +++++++++---------- drivers/lightnvm/pblk-core.c | 30 ++++++------ drivers/lightnvm/pblk-init.c | 72 +++++++++++++-------------- drivers/lightnvm/pblk-read.c | 4 +- drivers/lightnvm/pblk-recovery.c | 2 +- drivers/lightnvm/pblk-write.c | 8 +-- drivers/lightnvm/pblk.h | 14 +++--- drivers/md/bcache/bcache.h | 10 ++-- drivers/md/bcache/bset.c | 13 ++--- drivers/md/bcache/bset.h | 2 +- drivers/md/bcache/btree.c | 4 +- drivers/md/bcache/io.c | 4 +- drivers/md/bcache/request.c | 18 +++---- drivers/md/bcache/super.c | 38 ++++++--------- drivers/md/dm-bio-prison-v1.c | 13 ++--- drivers/md/dm-bio-prison-v2.c | 13 ++--- drivers/md/dm-cache-target.c | 25 +++++----- drivers/md/dm-core.h | 4 +- drivers/md/dm-crypt.c | 60 +++++++++++------------ drivers/md/dm-integrity.c | 15 +++--- drivers/md/dm-io.c | 29 +++++------ drivers/md/dm-kcopyd.c | 22 +++++---- drivers/md/dm-log-userspace-base.c | 19 ++++---- drivers/md/dm-region-hash.c | 23 ++++----- drivers/md/dm-rq.c | 2 +- drivers/md/dm-snap.c | 17 +++---- drivers/md/dm-thin.c | 32 ++++++------ drivers/md/dm-verity-fec.c | 55 +++++++++++---------- drivers/md/dm-verity-fec.h | 8 +-- drivers/md/dm-zoned-target.c | 13 +++-- drivers/md/dm.c | 55 +++++++++------------ drivers/md/md-faulty.c | 2 +- drivers/md/md-linear.c | 2 +- drivers/md/md-multipath.c | 17 ++++--- drivers/md/md-multipath.h | 2 +- drivers/md/md.c | 61 +++++++++-------------- drivers/md/md.h | 4 +- drivers/md/raid0.c | 5 +- drivers/md/raid1.c | 76 ++++++++++++++--------------- drivers/md/raid1.h | 6 +-- drivers/md/raid10.c | 60 +++++++++++------------ drivers/md/raid10.h | 6 +-- drivers/md/raid5-cache.c | 43 ++++++++-------- drivers/md/raid5-ppl.c | 42 +++++++--------- drivers/md/raid5.c | 12 ++--- drivers/md/raid5.h | 2 +- drivers/target/target_core_iblock.c | 14 +++--- drivers/target/target_core_iblock.h | 2 +- fs/block_dev.c | 9 ++-- fs/btrfs/extent_io.c | 25 +++++----- fs/xfs/xfs_aops.c | 2 +- fs/xfs/xfs_aops.h | 2 +- fs/xfs/xfs_super.c | 11 ++--- include/linux/bio.h | 11 +++-- include/linux/blkdev.h | 2 +- include/linux/pktcdvd.h | 2 +- 67 files changed, 606 insertions(+), 711 deletions(-)
Signature · 1 line
2.17.0
PATCH 1/12 block: convert bounce, q->bio_split to bioset_init()/mempool_init()
--- block/blk-core.c | 7 ++++--- block/blk-merge.c | 8 +++---- block/blk-sysfs.c | 3 +-- block/bounce.c | 47 ++++++++++++++++++++++-------------------- drivers/md/dm.c | 2 +- include/linux/bio.h | 5 +++++ include/linux/blkdev.h | 2 +- 7 files changed, 41 insertions(+), 33 deletions(-)
block/blk-core.c +4 -3
@@ -998,6 +998,7 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id, spinlock_t *lock) {struct request_queue *q; +int ret; q =kmem_cache_alloc_node (blk_requestq_cachep, gfp_mask | __GFP_ZERO, node_id);
@@ -1008,8 +1009,8 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id,if (q->id <0 ) goto fail_q; - q->bio_split =bioset_create (BIO_POOL_SIZE ,0 ,BIOSET_NEED_BVECS ); -if (!q->bio_split) + ret =bioset_init (&q->bio_split,BIO_POOL_SIZE ,0 ,BIOSET_NEED_BVECS ); +if (ret) goto fail_id; q->backing_dev_info =bdi_alloc_node (gfp_mask, node_id);
@@ -1081,7 +1082,7 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id, fail_stats:bdi_put (q->backing_dev_info); fail_split: -bioset_free (q->bio_split); +bioset_exit (&q->bio_split); fail_id:ida_simple_remove (&blk_queue_ida, q->id); fail_q:
block/blk-merge.c +4 -4
@@ -188,16 +188,16 @@ void blk_queue_split(struct request_queue *q, struct bio **bio)switch (bio_op (*bio)) {case REQ_OP_DISCARD :case REQ_OP_SECURE_ERASE : - split =blk_bio_discard_split (q, *bio, q->bio_split, &nsegs); + split =blk_bio_discard_split (q, *bio, &q->bio_split, &nsegs);break ;case REQ_OP_WRITE_ZEROES : - split =blk_bio_write_zeroes_split (q, *bio, q->bio_split, &nsegs); + split =blk_bio_write_zeroes_split (q, *bio, &q->bio_split, &nsegs);break ;case REQ_OP_WRITE_SAME : - split =blk_bio_write_same_split (q, *bio, q->bio_split, &nsegs); + split =blk_bio_write_same_split (q, *bio, &q->bio_split, &nsegs);break ;default : - split =blk_bio_segment_split (q, *bio, q->bio_split, &nsegs); + split =blk_bio_segment_split (q, *bio, &q->bio_split, &nsegs);break ; }
block/blk-sysfs.c +1 -2
@@ -824,8 +824,7 @@ static void __blk_release_queue(struct work_struct *work)if (q->mq_ops)blk_mq_debugfs_unregister (q); -if (q->bio_split) -bioset_free (q->bio_split); +bioset_exit (&q->bio_split);ida_simple_remove (&blk_queue_ida, q->id);call_rcu (&q->rcu_head, blk_free_queue_rcu);
block/bounce.c +25 -22
120 lines not on this page · raw message
drivers/md/dm.c +1 -1
@@ -1582,7 +1582,7 @@ static blk_qc_t __split_and_process_bio(struct mapped_device *md,* won't be affected by this reassignment. */ struct bio *b =bio_clone_bioset (bio,GFP_NOIO , - md->queue->bio_split); + &md->queue->bio_split); ci.io->orig_bio = b;bio_advance (bio, (bio_sectors (bio) - ci.sector_count) <<9 );bio_chain (b, bio);
include/linux/bio.h +5 -0
@@ -760,6 +760,11 @@ struct biovec_slab {struct kmem_cache *slab; }; +static inline bool bioset_initialized (struct bio_set *bs) +{ +return bs->bio_slab !=NULL ; +} +/* * a small number of entries is fine, not going to be performance critical. * basically we just need to survive
include/linux/blkdev.h +1 -1
@@ -664,7 +664,7 @@ struct request_queue {struct blk_mq_tag_set *tag_set;struct list_head tag_set_list; -struct bio_set *bio_split; +struct bio_set bio_split;#ifdef CONFIG_BLK_DEBUG_FS struct dentry *debugfs_dir;
Signature · 1 line
2.17.0
PATCH 2/12 drbd: convert to bioset_init()/mempool_init()
In reply to Kent Overstreet--- drivers/block/drbd/drbd_bitmap.c | 4 +- drivers/block/drbd/drbd_int.h | 10 ++--- drivers/block/drbd/drbd_main.c | 71 +++++++++++------------------- drivers/block/drbd/drbd_receiver.c | 6 +-- drivers/block/drbd/drbd_req.c | 4 +- drivers/block/drbd/drbd_req.h | 2 +- 6 files changed, 38 insertions(+), 59 deletions(-)
drivers/block/drbd/drbd_bitmap.c +2 -2
@@ -977,7 +977,7 @@ static void drbd_bm_endio(struct bio *bio)bm_page_unlock_io (device, idx);if (ctx->flags &BM_AIO_COPY_PAGES ) -mempool_free (bio->bi_io_vec[0 ].bv_page, drbd_md_io_page_pool); +mempool_free (bio->bi_io_vec[0 ].bv_page, &drbd_md_io_page_pool);bio_put (bio);
@@ -1014,7 +1014,7 @@ static void bm_page_io_async(struct drbd_bm_aio_ctx *ctx, int page_nr) __must_hobm_set_page_unchanged (b->bm_pages[page_nr]);if (ctx->flags &BM_AIO_COPY_PAGES ) { - page =mempool_alloc (drbd_md_io_page_pool, + page =mempool_alloc (&drbd_md_io_page_pool,GFP_NOIO | __GFP_HIGHMEM);copy_highpage (page, b->bm_pages[page_nr]);bm_store_page_idx (page, page_nr);
drivers/block/drbd/drbd_int.h +5 -5
@@ -1405,8 +1405,8 @@ extern struct kmem_cache *drbd_request_cache;extern struct kmem_cache *drbd_ee_cache;/* peer requests */ extern struct kmem_cache *drbd_bm_ext_cache;/* bitmap extents */ extern struct kmem_cache *drbd_al_ext_cache;/* activity log extents */ -extern mempool_t *drbd_request_mempool; -extern mempool_t *drbd_ee_mempool; +extern mempool_t drbd_request_mempool; +extern mempool_t drbd_ee_mempool;/* drbd's page pool, used to buffer data received from the peer, * or data requested by the peer.
@@ -1432,16 +1432,16 @@ extern wait_queue_head_t drbd_pp_wait;* 128 should be plenty, currently we probably can get away with as few as 1. */ #define DRBD_MIN_POOL_PAGES 128 -extern mempool_t *drbd_md_io_page_pool; +extern mempool_t drbd_md_io_page_pool;/* We also need to make sure we get a bio * when we need it for housekeeping purposes */ -extern struct bio_set *drbd_md_io_bio_set; +extern struct bio_set drbd_md_io_bio_set;/* to allocate from that set */ extern struct bio *bio_alloc_drbd (gfp_t gfp_mask);/* And a bio_set for cloning */ -extern struct bio_set *drbd_io_bio_set; +extern struct bio_set drbd_io_bio_set;extern struct mutex resources_mutex;
drivers/block/drbd/drbd_main.c +25 -46
117 lines not on this page · raw message
drivers/block/drbd/drbd_receiver.c +3 -3
@@ -378,7 +378,7 @@ drbd_alloc_peer_req(struct drbd_peer_device *peer_device, u64 id, sector_t sectoif (drbd_insert_fault (device,DRBD_FAULT_AL_EE ))return NULL ; - peer_req =mempool_alloc (drbd_ee_mempool, gfp_mask & ~__GFP_HIGHMEM); + peer_req =mempool_alloc (&drbd_ee_mempool, gfp_mask & ~__GFP_HIGHMEM);if (!peer_req) {if (!(gfp_mask & __GFP_NOWARN))drbd_err (device,"%s: allocation failed\n" , __func__);
@@ -409,7 +409,7 @@ drbd_alloc_peer_req(struct drbd_peer_device *peer_device, u64 id, sector_t sectoreturn peer_req; fail: -mempool_free (peer_req, drbd_ee_mempool); +mempool_free (peer_req, &drbd_ee_mempool);return NULL ; }
@@ -426,7 +426,7 @@ void __drbd_free_peer_req(struct drbd_device *device, struct drbd_peer_request * peer_req->flags &= ~EE_CALL_AL_COMPLETE_IO ;drbd_al_complete_io (device, &peer_req->i); } -mempool_free (peer_req, drbd_ee_mempool); +mempool_free (peer_req, &drbd_ee_mempool); }int drbd_free_peer_reqs (struct drbd_device *device,struct list_head *list)
drivers/block/drbd/drbd_req.c +2 -2
@@ -55,7 +55,7 @@ static struct drbd_request *drbd_req_new(struct drbd_device *device, struct bio {struct drbd_request *req; - req =mempool_alloc (drbd_request_mempool,GFP_NOIO ); + req =mempool_alloc (&drbd_request_mempool,GFP_NOIO );if (!req)return NULL ;memset (req,0 ,sizeof (*req));
@@ -184,7 +184,7 @@ void drbd_req_destroy(struct kref *kref) } } -mempool_free (req, drbd_request_mempool); +mempool_free (req, &drbd_request_mempool); }static void wake_all_senders (struct drbd_connection *connection)
drivers/block/drbd/drbd_req.h +1 -1
@@ -269,7 +269,7 @@ enum drbd_req_state_bits {static inline void drbd_req_make_private_bio (struct drbd_request *req,struct bio *bio_src) {struct bio *bio; - bio =bio_clone_fast (bio_src,GFP_NOIO , drbd_io_bio_set); + bio =bio_clone_fast (bio_src,GFP_NOIO , &drbd_io_bio_set); req->private_bio = bio;
Signature · 1 line
2.17.0
PATCH 3/12 pktcdvd: convert to bioset_init()/mempool_init()
In reply to Kent Overstreet--- drivers/block/pktcdvd.c | 50 ++++++++++++++++++++--------------------- include/linux/pktcdvd.h | 2 +- 2 files changed, 26 insertions(+), 26 deletions(-)
drivers/block/pktcdvd.c +25 -25
@@ -97,8 +97,8 @@ static int pktdev_major;static int write_congestion_on =PKT_WRITE_CONGESTION_ON ;static int write_congestion_off =PKT_WRITE_CONGESTION_OFF ;static struct mutex ctl_mutex;/* Serialize open/close/setup/teardown */ -static mempool_t *psd_pool; -static struct bio_set *pkt_bio_set; +static mempool_t psd_pool; +static struct bio_set pkt_bio_set;static struct class *class_pktcdvd =NULL ;/* /sys/class/pktcdvd */ static struct dentry *pkt_debugfs_root =NULL ;/* /sys/kernel/debug/pktcdvd */
@@ -631,7 +631,7 @@ static inline struct pkt_rb_node *pkt_rbtree_next(struct pkt_rb_node *node)static void pkt_rbtree_erase (struct pktcdvd_device *pd,struct pkt_rb_node *node) {rb_erase (&node->rb_node, &pd->bio_queue); -mempool_free (node, pd->rb_pool); +mempool_free (node, &pd->rb_pool); pd->bio_queue_size--;BUG_ON (pd->bio_queue_size <0 ); }
@@ -2303,14 +2303,14 @@ static void pkt_end_io_read_cloned(struct bio *bio) psd->bio->bi_status = bio->bi_status;bio_put (bio);bio_endio (psd->bio); -mempool_free (psd, psd_pool); +mempool_free (psd, &psd_pool);pkt_bio_finished (pd); }static void pkt_make_request_read (struct pktcdvd_device *pd,struct bio *bio) { -struct bio *cloned_bio =bio_clone_fast (bio,GFP_NOIO , pkt_bio_set); -struct packet_stacked_data *psd =mempool_alloc (psd_pool,GFP_NOIO ); +struct bio *cloned_bio =bio_clone_fast (bio,GFP_NOIO , &pkt_bio_set); +struct packet_stacked_data *psd =mempool_alloc (&psd_pool,GFP_NOIO ); psd->pd = pd; psd->bio = bio;
@@ -2381,7 +2381,7 @@ static void pkt_make_request_write(struct request_queue *q, struct bio *bio)/* * No matching packet found. Store the bio in the work queue. */ - node =mempool_alloc (pd->rb_pool,GFP_NOIO ); + node =mempool_alloc (&pd->rb_pool,GFP_NOIO ); node->bio = bio;spin_lock (&pd->lock);BUG_ON (pd->bio_queue_size <0 );
@@ -2451,7 +2451,7 @@ static blk_qc_t pkt_make_request(struct request_queue *q, struct bio *bio) split =bio_split (bio, last_zone - bio->bi_iter.bi_sector, -GFP_NOIO , pkt_bio_set); +GFP_NOIO , &pkt_bio_set);bio_chain (split, bio); }else { split = bio;
@@ -2707,9 +2707,9 @@ static int pkt_setup_dev(dev_t dev, dev_t* pkt_dev)if (!pd) goto out_mutex; - pd->rb_pool =mempool_create_kmalloc_pool (PKT_RB_POOL_SIZE , -sizeof (struct pkt_rb_node )); -if (!pd->rb_pool) + ret =mempool_init_kmalloc_pool (&pd->rb_pool,PKT_RB_POOL_SIZE , +sizeof (struct pkt_rb_node )); +if (ret) goto out_mem;INIT_LIST_HEAD (&pd->cdrw.pkt_free_list);
@@ -2766,7 +2766,7 @@ static int pkt_setup_dev(dev_t dev, dev_t* pkt_dev) out_mem2:put_disk (disk); out_mem: -mempool_destroy (pd->rb_pool); +mempool_exit (&pd->rb_pool);kfree (pd); out_mutex:mutex_unlock (&ctl_mutex);
@@ -2817,7 +2817,7 @@ static int pkt_remove_dev(dev_t pkt_dev)blk_cleanup_queue (pd->disk->queue);put_disk (pd->disk); -mempool_destroy (pd->rb_pool); +mempool_exit (&pd->rb_pool);kfree (pd);/* This is safe: open() is still holding a reference. */
@@ -2914,14 +2914,14 @@ static int __init pkt_init(void)mutex_init (&ctl_mutex); - psd_pool =mempool_create_kmalloc_pool (PSD_POOL_SIZE , -sizeof (struct packet_stacked_data )); -if (!psd_pool) -return -ENOMEM ; - pkt_bio_set =bioset_create (BIO_POOL_SIZE ,0 ,0 ); -if (!pkt_bio_set) { -mempool_destroy (psd_pool); -return -ENOMEM ; + ret =mempool_init_kmalloc_pool (&psd_pool,PSD_POOL_SIZE , +sizeof (struct packet_stacked_data )); +if (ret) +return ret; + ret =bioset_init (&pkt_bio_set,BIO_POOL_SIZE ,0 ,0 ); +if (ret) { +mempool_exit (&psd_pool); +return ret; } ret =register_blkdev (pktdev_major,DRIVER_NAME );
@@ -2954,8 +2954,8 @@ static int __init pkt_init(void) out:unregister_blkdev (pktdev_major,DRIVER_NAME ); out2: -mempool_destroy (psd_pool); -bioset_free (pkt_bio_set); +mempool_exit (&psd_pool); +bioset_exit (&pkt_bio_set);return ret; }
@@ -2968,8 +2968,8 @@ static void __exit pkt_exit(void)pkt_sysfs_cleanup ();unregister_blkdev (pktdev_major,DRIVER_NAME ); -mempool_destroy (psd_pool); -bioset_free (pkt_bio_set); +mempool_exit (&psd_pool); +bioset_exit (&pkt_bio_set); }MODULE_DESCRIPTION ("Packet writing layer for CD/DVD drives" );
include/linux/pktcdvd.h +1 -1
@@ -186,7 +186,7 @@ struct pktcdvd_devicesector_t current_sector;/* Keep track of where the elevator is */ atomic_t scan_queue;/* Set to non-zero when pkt_handle_queue */ /* needs to be run. */ -mempool_t *rb_pool;/* mempool for pkt_rb_node allocations */ +mempool_t rb_pool;/* mempool for pkt_rb_node allocations */ struct packet_iosched iosched;struct gendisk *disk;
Signature · 1 line
2.17.0
PATCH 4/12 lightnvm: convert to bioset_init()/mempool_init()
In reply to Kent Overstreet--- drivers/lightnvm/pblk-core.c | 30 ++++++------- drivers/lightnvm/pblk-init.c | 72 ++++++++++++++++---------------- drivers/lightnvm/pblk-read.c | 4 +- drivers/lightnvm/pblk-recovery.c | 2 +- drivers/lightnvm/pblk-write.c | 8 ++-- drivers/lightnvm/pblk.h | 14 +++---- 6 files changed, 65 insertions(+), 65 deletions(-)
drivers/lightnvm/pblk-core.c +15 -15
@@ -40,7 +40,7 @@ static void pblk_line_mark_bb(struct work_struct *work) }kfree (ppa); -mempool_free (line_ws, pblk->gen_ws_pool); +mempool_free (line_ws, &pblk->gen_ws_pool); } static void pblk_mark_bb(struct pblk *pblk, struct pblk_line *line,
@@ -102,7 +102,7 @@ static void pblk_end_io_erase(struct nvm_rq *rqd)struct pblk *pblk = rqd->private;__pblk_end_io_erase (pblk, rqd); -mempool_free (rqd, pblk->e_rq_pool); +mempool_free (rqd, &pblk->e_rq_pool); }/*
@@ -237,15 +237,15 @@ struct nvm_rq *pblk_alloc_rqd(struct pblk *pblk, int type)switch (type) {case PBLK_WRITE :case PBLK_WRITE_INT : - pool = pblk->w_rq_pool; + pool = &pblk->w_rq_pool; rq_size = pblk_w_rq_size;break ;case PBLK_READ : - pool = pblk->r_rq_pool; + pool = &pblk->r_rq_pool; rq_size = pblk_g_rq_size;break ;default : - pool = pblk->e_rq_pool; + pool = &pblk->e_rq_pool; rq_size = pblk_g_rq_size; }
@@ -265,13 +265,13 @@ void pblk_free_rqd(struct pblk *pblk, struct nvm_rq *rqd, int type)case PBLK_WRITE :kfree (((struct pblk_c_ctx *)nvm_rq_to_pdu (rqd))->lun_bitmap);case PBLK_WRITE_INT : - pool = pblk->w_rq_pool; + pool = &pblk->w_rq_pool;break ;case PBLK_READ : - pool = pblk->r_rq_pool; + pool = &pblk->r_rq_pool;break ;case PBLK_ERASE : - pool = pblk->e_rq_pool; + pool = &pblk->e_rq_pool;break ;default :pr_err ("pblk: trying to free unknown rqd type\n" );
@@ -292,7 +292,7 @@ void pblk_bio_free_pages(struct pblk *pblk, struct bio *bio, int off,for (i = off; i < nr_pages + off; i++) { bv = bio->bi_io_vec[i]; -mempool_free (bv.bv_page, pblk->page_bio_pool); +mempool_free (bv.bv_page, &pblk->page_bio_pool); } }
@@ -304,12 +304,12 @@ int pblk_bio_add_pages(struct pblk *pblk, struct bio *bio, gfp_t flags,int i, ret;for (i =0 ; i < nr_pages; i++) { - page =mempool_alloc (pblk->page_bio_pool, flags); + page =mempool_alloc (&pblk->page_bio_pool, flags); ret =bio_add_pc_page (q, bio, page,PBLK_EXPOSED_PAGE_SIZE ,0 );if (ret !=PBLK_EXPOSED_PAGE_SIZE ) {pr_err ("pblk: could not add page to bio\n" ); -mempool_free (page, pblk->page_bio_pool); +mempool_free (page, &pblk->page_bio_pool); goto err; } }
@@ -1593,7 +1593,7 @@ static void pblk_line_put_ws(struct work_struct *work)struct pblk_line *line = line_put_ws->line;__pblk_line_put (pblk, line); -mempool_free (line_put_ws, pblk->gen_ws_pool); +mempool_free (line_put_ws, &pblk->gen_ws_pool); }void pblk_line_put (struct kref *ref)
@@ -1610,7 +1610,7 @@ void pblk_line_put_wq(struct kref *ref)struct pblk *pblk = line->pblk;struct pblk_line_ws *line_put_ws; - line_put_ws =mempool_alloc (pblk->gen_ws_pool,GFP_ATOMIC ); + line_put_ws =mempool_alloc (&pblk->gen_ws_pool,GFP_ATOMIC );if (!line_put_ws)return ;
@@ -1752,7 +1752,7 @@ void pblk_line_close_ws(struct work_struct *work)struct pblk_line *line = line_ws->line;pblk_line_close (pblk, line); -mempool_free (line_ws, pblk->gen_ws_pool); +mempool_free (line_ws, &pblk->gen_ws_pool); } void pblk_gen_run_ws(struct pblk *pblk, struct pblk_line *line, void *priv,
@@ -1761,7 +1761,7 @@ void pblk_gen_run_ws(struct pblk *pblk, struct pblk_line *line, void *priv, {struct pblk_line_ws *line_ws; - line_ws =mempool_alloc (pblk->gen_ws_pool, gfp_mask); + line_ws =mempool_alloc (&pblk->gen_ws_pool, gfp_mask); line_ws->pblk = pblk; line_ws->line = line;
drivers/lightnvm/pblk-init.c +36 -36
130 lines not on this page · raw message
drivers/lightnvm/pblk-read.c +2 -2
@@ -294,7 +294,7 @@ static int pblk_partial_read_bio(struct pblk *pblk, struct nvm_rq *rqd,kunmap_atomic (src_p);kunmap_atomic (dst_p); -mempool_free (src_bv.bv_page, pblk->page_bio_pool); +mempool_free (src_bv.bv_page, &pblk->page_bio_pool); hole =find_next_zero_bit (read_bitmap, nr_secs, hole +1 ); }while (hole < nr_secs);
@@ -429,7 +429,7 @@ int pblk_submit_read(struct pblk *pblk, struct bio *bio)struct bio *int_bio =NULL ;/* Clone read bio to deal with read errors internally */ - int_bio =bio_clone_fast (bio,GFP_KERNEL , pblk_bio_set); + int_bio =bio_clone_fast (bio,GFP_KERNEL , &pblk_bio_set);if (!int_bio) {pr_err ("pblk: could not clone read bio\n" ); goto fail_end_io;
drivers/lightnvm/pblk-recovery.c +1 -1
@@ -60,7 +60,7 @@ void pblk_submit_rec(struct work_struct *work) goto err; } -mempool_free (recovery, pblk->rec_pool); +mempool_free (recovery, &pblk->rec_pool);return ; err:
drivers/lightnvm/pblk-write.c +4 -4
@@ -122,7 +122,7 @@ static void pblk_end_w_fail(struct pblk *pblk, struct nvm_rq *rqd)if (unlikely (nr_ppas ==1 )) ppa_list = &rqd->ppa_addr; - recovery =mempool_alloc (pblk->rec_pool,GFP_ATOMIC ); + recovery =mempool_alloc (&pblk->rec_pool,GFP_ATOMIC );INIT_LIST_HEAD (&recovery->failed);
@@ -134,7 +134,7 @@ static void pblk_end_w_fail(struct pblk *pblk, struct nvm_rq *rqd)/* Logic error */ if (bit > c_ctx->nr_valid) {WARN_ONCE (1 ,"pblk: corrupted write request\n" ); -mempool_free (recovery, pblk->rec_pool); +mempool_free (recovery, &pblk->rec_pool); goto out; }
@@ -142,7 +142,7 @@ static void pblk_end_w_fail(struct pblk *pblk, struct nvm_rq *rqd) entry =pblk_rb_sync_scan_entry (&pblk->rwb, &ppa);if (!entry) {pr_err ("pblk: could not scan entry on write failure\n" ); -mempool_free (recovery, pblk->rec_pool); +mempool_free (recovery, &pblk->rec_pool); goto out; }
@@ -156,7 +156,7 @@ static void pblk_end_w_fail(struct pblk *pblk, struct nvm_rq *rqd) ret =pblk_recov_setup_rq (pblk, c_ctx, recovery, comp_bits, c_entries);if (ret) {pr_err ("pblk: could not recover from write failure\n" ); -mempool_free (recovery, pblk->rec_pool); +mempool_free (recovery, &pblk->rec_pool); goto out; }
drivers/lightnvm/pblk.h +7 -7
@@ -664,12 +664,12 @@ struct pblk {struct list_head compl_list; -mempool_t *page_bio_pool; -mempool_t *gen_ws_pool; -mempool_t *rec_pool; -mempool_t *r_rq_pool; -mempool_t *w_rq_pool; -mempool_t *e_rq_pool; +mempool_t page_bio_pool; +mempool_t gen_ws_pool; +mempool_t rec_pool; +mempool_t r_rq_pool; +mempool_t w_rq_pool; +mempool_t e_rq_pool;struct workqueue_struct *close_wq;struct workqueue_struct *bb_wq;
@@ -841,7 +841,7 @@ void pblk_write_should_kick(struct pblk *pblk);/* * pblk read path */ -extern struct bio_set *pblk_bio_set; +extern struct bio_set pblk_bio_set;int pblk_submit_read (struct pblk *pblk,struct bio *bio);int pblk_submit_read_gc (struct pblk *pblk,struct pblk_gc_rq *gc_rq);/*
Signature · 1 line
2.17.0
PATCH 5/12 bcache: convert to bioset_init()/mempool_init()
In reply to Kent Overstreet--- drivers/md/bcache/bcache.h | 10 +++++----- drivers/md/bcache/bset.c | 13 ++++--------- drivers/md/bcache/bset.h | 2 +- drivers/md/bcache/btree.c | 4 ++-- drivers/md/bcache/io.c | 4 ++-- drivers/md/bcache/request.c | 18 +++++++++--------- drivers/md/bcache/super.c | 38 ++++++++++++++----------------------- 7 files changed, 37 insertions(+), 52 deletions(-)
drivers/md/bcache/bcache.h +5 -5
@@ -269,7 +269,7 @@ struct bcache_device {atomic_t *stripe_sectors_dirty;unsigned long *full_dirty_stripes; -struct bio_set *bio_split; +struct bio_set bio_split; unsigned data_csum:1;
@@ -528,9 +528,9 @@ struct cache_set {struct closure sb_write;struct semaphore sb_write_mutex; -mempool_t *search; -mempool_t *bio_meta; -struct bio_set *bio_split; +mempool_t search; +mempool_t bio_meta; +struct bio_set bio_split;/* For the btree cache */ struct shrinker shrink;
@@ -655,7 +655,7 @@ struct cache_set {* A btree node on disk could have too many bsets for an iterator to fit * on the stack - have to dynamically allocate them */ -mempool_t *fill_iter; +mempool_t fill_iter;struct bset_sort_state sort;
drivers/md/bcache/bset.c +4 -9
@@ -1118,8 +1118,7 @@ struct bkey *bch_btree_iter_next_filter(struct btree_iter *iter,void bch_bset_sort_state_free (struct bset_sort_state *state) { -if (state->pool) -mempool_destroy (state->pool); +mempool_exit (&state->pool); }int bch_bset_sort_state_init (struct bset_sort_state *state,unsigned page_order)
@@ -1129,11 +1128,7 @@ int bch_bset_sort_state_init(struct bset_sort_state *state, unsigned page_order) state->page_order = page_order; state->crit_factor =int_sqrt (1 << page_order); - state->pool =mempool_create_page_pool (1 , page_order); -if (!state->pool) -return -ENOMEM ; - -return 0 ; +return mempool_init_page_pool (&state->pool,1 , page_order); }EXPORT_SYMBOL (bch_bset_sort_state_init);
@@ -1191,7 +1186,7 @@ static void __btree_sort(struct btree_keys *b, struct btree_iter *iter,BUG_ON (order > state->page_order); - outp =mempool_alloc (state->pool,GFP_NOIO ); + outp =mempool_alloc (&state->pool,GFP_NOIO ); out =page_address (outp); used_mempool = true; order = state->page_order;
@@ -1220,7 +1215,7 @@ static void __btree_sort(struct btree_keys *b, struct btree_iter *iter, }if (used_mempool) -mempool_free (virt_to_page (out), state->pool); +mempool_free (virt_to_page (out), &state->pool);else free_pages ((unsigned long ) out, order);
drivers/md/bcache/bset.h +1 -1
@@ -347,7 +347,7 @@ static inline struct bkey *bch_bset_search(struct btree_keys *b,/* Sorting */ struct bset_sort_state { -mempool_t *pool; +mempool_t pool;unsigned page_order;unsigned crit_factor;
drivers/md/bcache/btree.c +2 -2
@@ -204,7 +204,7 @@ void bch_btree_node_read_done(struct btree *b)struct bset *i =btree_bset_first (b);struct btree_iter *iter; - iter =mempool_alloc (b->c->fill_iter,GFP_NOIO ); + iter =mempool_alloc (&b->c->fill_iter,GFP_NOIO ); iter->size = b->c->sb.bucket_size / b->c->sb.block_size; iter->used =0 ;
@@ -271,7 +271,7 @@ void bch_btree_node_read_done(struct btree *b)bch_bset_init_next (&b->keys,write_block (b),bset_magic (&b->c->sb)); out: -mempool_free (iter, b->c->fill_iter); +mempool_free (iter, &b->c->fill_iter);return ; err:set_btree_node_io_error (b);
drivers/md/bcache/io.c +2 -2
@@ -17,12 +17,12 @@void bch_bbio_free (struct bio *bio,struct cache_set *c) { struct bbio *b = container_of(bio, struct bbio, bio); -mempool_free (b, c->bio_meta); +mempool_free (b, &c->bio_meta); }struct bio *bch_bbio_alloc (struct cache_set *c) { -struct bbio *b =mempool_alloc (c->bio_meta,GFP_NOIO ); +struct bbio *b =mempool_alloc (&c->bio_meta,GFP_NOIO );struct bio *bio = &b->bio;bio_init (bio, bio->bi_inline_vecs,bucket_pages (c));
drivers/md/bcache/request.c +9 -9
@@ -213,7 +213,7 @@ static void bch_data_insert_start(struct closure *cl) do { unsigned i; struct bkey *k; - struct bio_set *split = op->c->bio_split; + struct bio_set *split = &op->c->bio_split; /* 1 for the device pointer and 1 for the chksum */ if (bch_keylist_realloc(&op->insert_keys,
@@ -548,7 +548,7 @@ static int cache_lookup_fn(struct btree_op *op, struct btree *b, struct bkey *k) n =bio_next_split (bio,min_t (uint64_t,INT_MAX ,KEY_OFFSET (k) - bio->bi_iter.bi_sector), -GFP_NOIO , s->d->bio_split); +GFP_NOIO , &s->d->bio_split); bio_key = &container_of(n, struct bbio, bio)->key;bch_bkey_copy_single_ptr (bio_key, k, ptr);
@@ -707,7 +707,7 @@ static void search_free(struct closure *cl)bio_complete (s);closure_debug_destroy (cl); -mempool_free (s, s->d->c->search); +mempool_free (s, &s->d->c->search); } static inline struct search *search_alloc(struct bio *bio,
@@ -715,7 +715,7 @@ static inline struct search *search_alloc(struct bio *bio, {struct search *s; - s =mempool_alloc (d->c->search,GFP_NOIO ); + s =mempool_alloc (&d->c->search,GFP_NOIO );closure_init (&s->cl,NULL );do_bio_hook (s, bio, request_endio);
@@ -864,7 +864,7 @@ static int cached_dev_cache_miss(struct btree *b, struct search *s, s->cache_missed =1 ;if (s->cache_miss || s->iop.bypass) { - miss =bio_next_split (bio, sectors,GFP_NOIO , s->d->bio_split); + miss =bio_next_split (bio, sectors,GFP_NOIO , &s->d->bio_split); ret = miss == bio ?MAP_DONE :MAP_CONTINUE ; goto out_submit; }
@@ -887,14 +887,14 @@ static int cached_dev_cache_miss(struct btree *b, struct search *s, s->iop.replace = true; - miss =bio_next_split (bio, sectors,GFP_NOIO , s->d->bio_split); + miss =bio_next_split (bio, sectors,GFP_NOIO , &s->d->bio_split);/* btree_search_recurse()'s btree iterator is no good anymore */ ret = miss == bio ?MAP_DONE : -EINTR ; cache_bio =bio_alloc_bioset (GFP_NOWAIT ,DIV_ROUND_UP (s->insert_bio_sectors,PAGE_SECTORS ), - dc->disk.bio_split); + &dc->disk.bio_split);if (!cache_bio) goto out_submit;
@@ -1008,7 +1008,7 @@ static void cached_dev_write(struct cached_dev *dc, struct search *s)struct bio *flush; flush =bio_alloc_bioset (GFP_NOIO ,0 , - dc->disk.bio_split); + &dc->disk.bio_split);if (!flush) { s->iop.status =BLK_STS_RESOURCE ; goto insert_data;
@@ -1021,7 +1021,7 @@ static void cached_dev_write(struct cached_dev *dc, struct search *s)closure_bio_submit (s->iop.c, flush, cl); } }else { - s->iop.bio =bio_clone_fast (bio,GFP_NOIO , dc->disk.bio_split); + s->iop.bio =bio_clone_fast (bio,GFP_NOIO , &dc->disk.bio_split);/* I/O request sent to backing device */ bio->bi_end_io = backing_request_endio;closure_bio_submit (s->iop.c, bio, cl);
drivers/md/bcache/super.c +14 -24
@@ -766,8 +766,7 @@ static void bcache_device_free(struct bcache_device *d)put_disk (d->disk); } -if (d->bio_split) -bioset_free (d->bio_split); +bioset_exit (&d->bio_split);kvfree (d->full_dirty_stripes);kvfree (d->stripe_sectors_dirty);
@@ -809,9 +808,8 @@ static int bcache_device_init(struct bcache_device *d, unsigned block_size,if (idx <0 )return idx; -if (!(d->bio_split =bioset_create (4 , offsetof(struct bbio , bio), -BIOSET_NEED_BVECS | -BIOSET_NEED_RESCUER )) || +if (bioset_init (&d->bio_split,4 , offsetof(struct bbio , bio), +BIOSET_NEED_BVECS |BIOSET_NEED_RESCUER ) || !(d->disk =alloc_disk (BCACHE_MINORS ))) {ida_simple_remove (&bcache_device_idx, idx);return -ENOMEM ;
@@ -1465,14 +1463,10 @@ static void cache_set_free(struct closure *cl)if (c->moving_gc_wq)destroy_workqueue (c->moving_gc_wq); -if (c->bio_split) -bioset_free (c->bio_split); -if (c->fill_iter) -mempool_destroy (c->fill_iter); -if (c->bio_meta) -mempool_destroy (c->bio_meta); -if (c->search) -mempool_destroy (c->search); +bioset_exit (&c->bio_split); +mempool_exit (&c->fill_iter); +mempool_exit (&c->bio_meta); +mempool_exit (&c->search);kfree (c->devices);mutex_lock (&bch_register_lock);
@@ -1683,21 +1677,17 @@ struct cache_set *bch_cache_set_alloc(struct cache_sb *sb)INIT_LIST_HEAD (&c->btree_cache_freed);INIT_LIST_HEAD (&c->data_buckets); - c->search =mempool_create_slab_pool (32 , bch_search_cache); -if (!c->search) - goto err; - iter_size = (sb->bucket_size / sb->block_size +1 ) *sizeof (struct btree_iter_set ); if (!(c->devices = kzalloc(c->nr_uuids * sizeof(void *), GFP_KERNEL)) || - !(c->bio_meta = mempool_create_kmalloc_pool(2, - sizeof(struct bbio) + sizeof(struct bio_vec) * - bucket_pages(c))) || - !(c->fill_iter = mempool_create_kmalloc_pool(1, iter_size)) || - !(c->bio_split = bioset_create(4, offsetof(struct bbio, bio), - BIOSET_NEED_BVECS | - BIOSET_NEED_RESCUER)) || + mempool_init_slab_pool(&c->search, 32, bch_search_cache) || + mempool_init_kmalloc_pool(&c->bio_meta, 2, + sizeof(struct bbio) + sizeof(struct bio_vec) * + bucket_pages(c)) || + mempool_init_kmalloc_pool(&c->fill_iter, 1, iter_size) || + bioset_init(&c->bio_split, 4, offsetof(struct bbio, bio), + BIOSET_NEED_BVECS|BIOSET_NEED_RESCUER) || !(c->uuids = alloc_bucket_pages(GFP_KERNEL, c)) || !(c->moving_gc_wq = alloc_workqueue("bcache_gc", WQ_MEM_RECLAIM, 0)) ||
Signature · 1 line
2.17.0
PATCH 6/12 md: convert to bioset_init()/mempool_init()
In reply to Kent Overstreet--- drivers/md/md-faulty.c | 2 +- drivers/md/md-linear.c | 2 +- drivers/md/md-multipath.c | 17 ++++----- drivers/md/md-multipath.h | 2 +- drivers/md/md.c | 61 +++++++++++++------------------ drivers/md/md.h | 4 +-- drivers/md/raid0.c | 5 +-- drivers/md/raid1.c | 76 +++++++++++++++++++-------------------- drivers/md/raid1.h | 6 ++-- drivers/md/raid10.c | 60 +++++++++++++++---------------- drivers/md/raid10.h | 6 ++-- drivers/md/raid5-cache.c | 43 +++++++++++----------- drivers/md/raid5-ppl.c | 42 +++++++++------------- drivers/md/raid5.c | 12 +++---- drivers/md/raid5.h | 2 +- 15 files changed, 159 insertions(+), 181 deletions(-)
drivers/md/md-faulty.c +1 -1
@@ -214,7 +214,7 @@ static bool faulty_make_request(struct mddev *mddev, struct bio *bio) } }if (failit) { -struct bio *b =bio_clone_fast (bio,GFP_NOIO , mddev->bio_set); +struct bio *b =bio_clone_fast (bio,GFP_NOIO , &mddev->bio_set);bio_set_dev (b, conf->rdev->bdev); b->bi_private = bio;
drivers/md/md-linear.c +1 -1
@@ -269,7 +269,7 @@ static bool linear_make_request(struct mddev *mddev, struct bio *bio)if (unlikely (bio_end_sector (bio) > end_sector)) {/* This bio crosses a device boundary, so we have to split it */ struct bio *split =bio_split (bio, end_sector - bio_sector, -GFP_NOIO , mddev->bio_set); +GFP_NOIO , &mddev->bio_set);bio_chain (split, bio);generic_make_request (bio); bio = split;
drivers/md/md-multipath.c +9 -8
@@ -80,7 +80,7 @@ static void multipath_end_bh_io(struct multipath_bh *mp_bh, blk_status_t status) bio->bi_status = status;bio_endio (bio); -mempool_free (mp_bh, conf->pool); +mempool_free (mp_bh, &conf->pool); }static void multipath_end_request (struct bio *bio)
@@ -117,7 +117,7 @@ static bool multipath_make_request(struct mddev *mddev, struct bio * bio)return true; } - mp_bh =mempool_alloc (conf->pool,GFP_NOIO ); + mp_bh =mempool_alloc (&conf->pool,GFP_NOIO ); mp_bh->master_bio = bio; mp_bh->mddev = mddev;
@@ -125,7 +125,7 @@ static bool multipath_make_request(struct mddev *mddev, struct bio * bio) mp_bh->path =multipath_map (conf);if (mp_bh->path <0 ) {bio_io_error (bio); -mempool_free (mp_bh, conf->pool); +mempool_free (mp_bh, &conf->pool);return true; } multipath = conf->multipaths + mp_bh->path;
@@ -378,6 +378,7 @@ static int multipath_run (struct mddev *mddev)struct multipath_info *disk;struct md_rdev *rdev;int working_disks; +int ret;if (md_check_no_bitmap (mddev))return -EINVAL ;
@@ -431,9 +432,9 @@ static int multipath_run (struct mddev *mddev) } mddev->degraded = conf->raid_disks - working_disks; - conf->pool =mempool_create_kmalloc_pool (NR_RESERVED_BUFS , -sizeof (struct multipath_bh )); -if (conf->pool ==NULL ) + ret =mempool_init_kmalloc_pool (&conf->pool,NR_RESERVED_BUFS , +sizeof (struct multipath_bh )); +if (ret) goto out_free_conf; mddev->thread = md_register_thread(multipathd, mddev,
@@ -455,7 +456,7 @@ static int multipath_run (struct mddev *mddev)return 0 ; out_free_conf: -mempool_destroy (conf->pool); +mempool_exit (&conf->pool);kfree (conf->multipaths);kfree (conf); mddev->private =NULL ;
@@ -467,7 +468,7 @@ static void multipath_free(struct mddev *mddev, void *priv) {struct mpconf *conf = priv; -mempool_destroy (conf->pool); +mempool_exit (&conf->pool);kfree (conf->multipaths);kfree (conf); }
drivers/md/md-multipath.h +1 -1
@@ -13,7 +13,7 @@ struct mpconf {spinlock_t device_lock;struct list_head retry_list; -mempool_t *pool; +mempool_t pool; };/*
drivers/md/md.c +24 -37
121 lines not on this page · raw message
drivers/md/md.h +2 -2
@@ -452,8 +452,8 @@ struct mddev {struct attribute_group *to_remove; -struct bio_set *bio_set; -struct bio_set *sync_set;/* for sync operations like +struct bio_set bio_set; +struct bio_set sync_set;/* for sync operations like * metadata and bitmap writes */
drivers/md/raid0.c +3 -2
@@ -479,7 +479,7 @@ static void raid0_handle_discard(struct mddev *mddev, struct bio *bio)if (bio_end_sector (bio) > zone->zone_end) {struct bio *split =bio_split (bio, zone->zone_end - bio->bi_iter.bi_sector,GFP_NOIO , - mddev->bio_set); + &mddev->bio_set);bio_chain (split, bio);generic_make_request (bio); bio = split;
@@ -582,7 +582,8 @@ static bool raid0_make_request(struct mddev *mddev, struct bio *bio) sector = bio_sector;if (sectors <bio_sectors (bio)) { -struct bio *split =bio_split (bio, sectors,GFP_NOIO , mddev->bio_set); +struct bio *split =bio_split (bio, sectors,GFP_NOIO , + &mddev->bio_set);bio_chain (split, bio);generic_make_request (bio); bio = split;
drivers/md/raid1.c +37 -39
211 lines not on this page · raw message
drivers/md/raid1.h +3 -3
@@ -118,10 +118,10 @@ struct r1conf {* mempools - it changes when the array grows or shrinks */ struct pool_info *poolinfo; -mempool_t *r1bio_pool; -mempool_t *r1buf_pool; +mempool_t r1bio_pool; +mempool_t r1buf_pool; -struct bio_set *bio_split; +struct bio_set bio_split;/* temporary buffer to synchronous IO when attempting to repair * a read error.
drivers/md/raid10.c +29 -31
182 lines not on this page · raw message
drivers/md/raid10.h +3 -3
@@ -93,10 +93,10 @@ struct r10conf {*/ wait_queue_head_t wait_barrier; -mempool_t *r10bio_pool; -mempool_t *r10buf_pool; +mempool_t r10bio_pool; +mempool_t r10buf_pool;struct page *tmppage; -struct bio_set *bio_split; +struct bio_set bio_split;/* When taking over an array from a different personality, we store * the new thread here until we fully activate the array.
drivers/md/raid5-cache.c +22 -21
115 lines not on this page · raw message
drivers/md/raid5-ppl.c +17 -25
89 lines not on this page · raw message
drivers/md/raid5.c +6 -6
@@ -5192,7 +5192,7 @@ static int raid5_read_one_chunk(struct mddev *mddev, struct bio *raid_bio)/* * use bio_clone_fast to make a copy of the bio */ - align_bi =bio_clone_fast (raid_bio,GFP_NOIO , mddev->bio_set); + align_bi =bio_clone_fast (raid_bio,GFP_NOIO , &mddev->bio_set);if (!align_bi)return 0 ;/*
@@ -5277,7 +5277,7 @@ static struct bio *chunk_aligned_read(struct mddev *mddev, struct bio *raid_bio)if (sectors <bio_sectors (raid_bio)) {struct r5conf *conf = mddev->private; - split =bio_split (raid_bio, sectors,GFP_NOIO , conf->bio_split); + split =bio_split (raid_bio, sectors,GFP_NOIO , &conf->bio_split);bio_chain (split, raid_bio);generic_make_request (raid_bio); raid_bio = split;
@@ -6773,8 +6773,7 @@ static void free_conf(struct r5conf *conf)if (conf->disks[i].extra_page)put_page (conf->disks[i].extra_page);kfree (conf->disks); -if (conf->bio_split) -bioset_free (conf->bio_split); +bioset_exit (&conf->bio_split);kfree (conf->stripe_hashtbl);kfree (conf->pending_data);kfree (conf);
@@ -6853,6 +6852,7 @@ static struct r5conf *setup_conf(struct mddev *mddev)int i;int group_cnt, worker_cnt_per_group;struct r5worker_group *new_group; +int ret;if (mddev->new_level !=5 && mddev->new_level != 4
@@ -6950,8 +6950,8 @@ static struct r5conf *setup_conf(struct mddev *mddev) goto abort; } - conf->bio_split =bioset_create (BIO_POOL_SIZE ,0 ,0 ); -if (!conf->bio_split) + ret =bioset_init (&conf->bio_split,BIO_POOL_SIZE ,0 ,0 ); +if (ret) goto abort; conf->mddev = mddev;
drivers/md/raid5.h +1 -1
@@ -669,7 +669,7 @@ struct r5conf {int pool_size;/* number of disks in stripeheads in pool */ spinlock_t device_lock;struct disk_info *disks; -struct bio_set *bio_split; +struct bio_set bio_split;/* When taking over an array from a different personality, we store * the new thread here until we fully activate the array.
Signature · 1 line
2.17.0
PATCH 7/12 dm: convert to bioset_init()/mempool_init()
In reply to Kent Overstreet--- drivers/md/dm-bio-prison-v1.c | 13 ++++--- drivers/md/dm-bio-prison-v2.c | 13 ++++--- drivers/md/dm-cache-target.c | 25 ++++++------- drivers/md/dm-core.h | 4 +- drivers/md/dm-crypt.c | 60 ++++++++++++++---------------- drivers/md/dm-integrity.c | 15 ++++---- drivers/md/dm-io.c | 29 ++++++++------- drivers/md/dm-kcopyd.c | 22 ++++++----- drivers/md/dm-log-userspace-base.c | 19 +++++----- drivers/md/dm-region-hash.c | 23 ++++++------ drivers/md/dm-rq.c | 2 +- drivers/md/dm-snap.c | 17 ++++----- drivers/md/dm-thin.c | 32 ++++++++-------- drivers/md/dm-verity-fec.c | 55 +++++++++++++-------------- drivers/md/dm-verity-fec.h | 8 ++-- drivers/md/dm-zoned-target.c | 13 +++---- drivers/md/dm.c | 53 ++++++++++++-------------- 17 files changed, 197 insertions(+), 206 deletions(-)
drivers/md/dm-bio-prison-v1.c +7 -6
@@ -19,7 +19,7 @@struct dm_bio_prison {spinlock_t lock; -mempool_t *cell_pool; +mempool_t cell_pool;struct rb_root cells; };
@@ -34,14 +34,15 @@ static struct kmem_cache *_cell_cache;struct dm_bio_prison *dm_bio_prison_create (void ) {struct dm_bio_prison *prison =kmalloc (sizeof (*prison),GFP_KERNEL ); +int ret;if (!prison)return NULL ;spin_lock_init (&prison->lock); - prison->cell_pool =mempool_create_slab_pool (MIN_CELLS , _cell_cache); -if (!prison->cell_pool) { + ret =mempool_init_slab_pool (&prison->cell_pool,MIN_CELLS , _cell_cache); +if (ret) {kfree (prison);return NULL ; }
@@ -54,21 +55,21 @@ EXPORT_SYMBOL_GPL(dm_bio_prison_create);void dm_bio_prison_destroy (struct dm_bio_prison *prison) { -mempool_destroy (prison->cell_pool); +mempool_exit (&prison->cell_pool);kfree (prison); }EXPORT_SYMBOL_GPL (dm_bio_prison_destroy);struct dm_bio_prison_cell *dm_bio_prison_alloc_cell (struct dm_bio_prison *prison,gfp_t gfp) { -return mempool_alloc (prison->cell_pool, gfp); +return mempool_alloc (&prison->cell_pool, gfp); }EXPORT_SYMBOL_GPL (dm_bio_prison_alloc_cell);void dm_bio_prison_free_cell (struct dm_bio_prison *prison,struct dm_bio_prison_cell *cell) { -mempool_free (cell, prison->cell_pool); +mempool_free (cell, &prison->cell_pool); }EXPORT_SYMBOL_GPL (dm_bio_prison_free_cell);
drivers/md/dm-bio-prison-v2.c +7 -6
@@ -21,7 +21,7 @@ struct dm_bio_prison_v2 {struct workqueue_struct *wq;spinlock_t lock; -mempool_t *cell_pool; +mempool_t cell_pool;struct rb_root cells; };
@@ -36,6 +36,7 @@ static struct kmem_cache *_cell_cache;struct dm_bio_prison_v2 *dm_bio_prison_create_v2 (struct workqueue_struct *wq) {struct dm_bio_prison_v2 *prison =kmalloc (sizeof (*prison),GFP_KERNEL ); +int ret;if (!prison)return NULL ;
@@ -43,8 +44,8 @@ struct dm_bio_prison_v2 *dm_bio_prison_create_v2(struct workqueue_struct *wq) prison->wq = wq;spin_lock_init (&prison->lock); - prison->cell_pool =mempool_create_slab_pool (MIN_CELLS , _cell_cache); -if (!prison->cell_pool) { + ret =mempool_init_slab_pool (&prison->cell_pool,MIN_CELLS , _cell_cache); +if (ret) {kfree (prison);return NULL ; }
@@ -57,21 +58,21 @@ EXPORT_SYMBOL_GPL(dm_bio_prison_create_v2);void dm_bio_prison_destroy_v2 (struct dm_bio_prison_v2 *prison) { -mempool_destroy (prison->cell_pool); +mempool_exit (&prison->cell_pool);kfree (prison); }EXPORT_SYMBOL_GPL (dm_bio_prison_destroy_v2);struct dm_bio_prison_cell_v2 *dm_bio_prison_alloc_cell_v2 (struct dm_bio_prison_v2 *prison,gfp_t gfp) { -return mempool_alloc (prison->cell_pool, gfp); +return mempool_alloc (&prison->cell_pool, gfp); }EXPORT_SYMBOL_GPL (dm_bio_prison_alloc_cell_v2);void dm_bio_prison_free_cell_v2 (struct dm_bio_prison_v2 *prison,struct dm_bio_prison_cell_v2 *cell) { -mempool_free (cell, prison->cell_pool); +mempool_free (cell, &prison->cell_pool); }EXPORT_SYMBOL_GPL (dm_bio_prison_free_cell_v2);
drivers/md/dm-cache-target.c +12 -13
@@ -447,9 +447,9 @@ struct cache {struct work_struct migration_worker;struct delayed_work waker;struct dm_bio_prison_v2 *prison; -struct bio_set *bs; +struct bio_set bs; -mempool_t *migration_pool; +mempool_t migration_pool;struct dm_cache_policy *policy;unsigned policy_nr_args;
@@ -550,7 +550,7 @@ static struct dm_cache_migration *alloc_migration(struct cache *cache) {struct dm_cache_migration *mg; - mg =mempool_alloc (cache->migration_pool,GFP_NOWAIT ); + mg =mempool_alloc (&cache->migration_pool,GFP_NOWAIT );if (!mg)return NULL ;
@@ -569,7 +569,7 @@ static void free_migration(struct dm_cache_migration *mg)if (atomic_dec_and_test (&cache->nr_allocated_migrations))wake_up (&cache->migration_wait); -mempool_free (mg, cache->migration_pool); +mempool_free (mg, &cache->migration_pool); }/*----------------------------------------------------------------*/
@@ -924,7 +924,7 @@ static void issue_op(struct bio *bio, void *context)static void remap_to_origin_and_cache (struct cache *cache,struct bio *bio,dm_oblock_t oblock,dm_cblock_t cblock) { -struct bio *origin_bio =bio_clone_fast (bio,GFP_NOIO , cache->bs); +struct bio *origin_bio =bio_clone_fast (bio,GFP_NOIO , &cache->bs);BUG_ON (!origin_bio);
@@ -2011,7 +2011,7 @@ static void destroy(struct cache *cache) {unsigned i; -mempool_destroy (cache->migration_pool); +mempool_exit (&cache->migration_pool);if (cache->prison)dm_bio_prison_destroy_v2 (cache->prison);
@@ -2047,8 +2047,7 @@ static void destroy(struct cache *cache)kfree (cache->ctr_args[i]);kfree (cache->ctr_args); -if (cache->bs) -bioset_free (cache->bs); +bioset_exit (&cache->bs);kfree (cache); }
@@ -2498,8 +2497,8 @@ static int cache_create(struct cache_args *ca, struct cache **result) cache->features = ca->features;if (writethrough_mode (cache)) {/* Create bioset for writethrough bios issued to origin */ - cache->bs =bioset_create (BIO_POOL_SIZE ,0 ,0 ); -if (!cache->bs) + r =bioset_init (&cache->bs,BIO_POOL_SIZE ,0 ,0 ); +if (r) goto bad; }
@@ -2630,9 +2629,9 @@ static int cache_create(struct cache_args *ca, struct cache **result) goto bad; } - cache->migration_pool =mempool_create_slab_pool (MIGRATION_POOL_SIZE , - migration_cache); -if (!cache->migration_pool) { + r =mempool_init_slab_pool (&cache->migration_pool,MIGRATION_POOL_SIZE , + migration_cache); +if (r) { *error ="Error creating cache's migration mempool" ; goto bad; }
drivers/md/dm-core.h +2 -2
@@ -91,8 +91,8 @@ struct mapped_device {/* * io objects are allocated from here. */ -struct bio_set *io_bs; -struct bio_set *bs; +struct bio_set io_bs; +struct bio_set bs;/* * freeze/thaw support require holding onto a super block
drivers/md/dm-crypt.c +28 -32
170 lines not on this page · raw message
drivers/md/dm-integrity.c +7 -8
@@ -142,7 +142,7 @@ struct dm_integrity_c {unsigned tag_size;__s8 log2_tag_size;sector_t start; -mempool_t *journal_io_mempool; +mempool_t journal_io_mempool;struct dm_io_client *io;struct dm_bufio_client *bufio;struct workqueue_struct *metadata_wq;
@@ -1817,7 +1817,7 @@ static void complete_copy_from_journal(unsigned long error, void *context)struct journal_completion *comp = io->comp;struct dm_integrity_c *ic = comp->ic;remove_range (ic, &io->range); -mempool_free (io, ic->journal_io_mempool); +mempool_free (io, &ic->journal_io_mempool);if (unlikely (error !=0 ))dm_integrity_io_error (ic,"copying from journal" , -EIO );complete_journal_op (comp);
@@ -1886,7 +1886,7 @@ static void do_journal_write(struct dm_integrity_c *ic, unsigned write_start, } next_loop = k -1 ; - io =mempool_alloc (ic->journal_io_mempool,GFP_NOIO ); + io =mempool_alloc (&ic->journal_io_mempool,GFP_NOIO ); io->comp = ∁ io->range.logical_sector = sec; io->range.n_sectors = (k - j) << ic->sb->log2_sectors_per_block;
@@ -1918,7 +1918,7 @@ static void do_journal_write(struct dm_integrity_c *ic, unsigned write_start,if (j == k) {remove_range_unlocked (ic, &io->range);spin_unlock_irq (&ic->endio_wait.lock); -mempool_free (io, ic->journal_io_mempool); +mempool_free (io, &ic->journal_io_mempool); goto skip_io; }for (l = j; l < k; l++) {
@@ -2980,9 +2980,8 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned argc, char **argv) goto bad; } - ic->journal_io_mempool =mempool_create_slab_pool (JOURNAL_IO_MEMPOOL , journal_io_cache); -if (!ic->journal_io_mempool) { - r = -ENOMEM ; + r =mempool_init_slab_pool (&ic->journal_io_mempool,JOURNAL_IO_MEMPOOL , journal_io_cache); +if (r) { ti->error ="Cannot allocate mempool" ; goto bad; }
@@ -3196,7 +3195,7 @@ static void dm_integrity_dtr(struct dm_target *ti)destroy_workqueue (ic->writer_wq);if (ic->bufio)dm_bufio_client_destroy (ic->bufio); -mempool_destroy (ic->journal_io_mempool); +mempool_exit (&ic->journal_io_mempool);if (ic->io)dm_io_client_destroy (ic->io);if (ic->dev)
drivers/md/dm-io.c +15 -14
@@ -22,8 +22,8 @@#define DM_IO_MAX_REGIONS BITS_PER_LONGstruct dm_io_client { -mempool_t *pool; -struct bio_set *bios; +mempool_t pool; +struct bio_set bios; };/*
@@ -49,32 +49,33 @@ struct dm_io_client *dm_io_client_create(void) {struct dm_io_client *client;unsigned min_ios =dm_get_reserved_bio_based_ios (); +int ret; client =kmalloc (sizeof (*client),GFP_KERNEL );if (!client)return ERR_PTR (-ENOMEM ); - client->pool =mempool_create_slab_pool (min_ios, _dm_io_cache); -if (!client->pool) + ret =mempool_init_slab_pool (&client->pool, min_ios, _dm_io_cache); +if (ret) goto bad; - client->bios =bioset_create (min_ios,0 ,BIOSET_NEED_BVECS ); -if (!client->bios) + ret =bioset_init (&client->bios, min_ios,0 ,BIOSET_NEED_BVECS ); +if (ret) goto bad;return client; bad: -mempool_destroy (client->pool); +mempool_exit (&client->pool);kfree (client); -return ERR_PTR (-ENOMEM ); +return ERR_PTR (ret); }EXPORT_SYMBOL (dm_io_client_create);void dm_io_client_destroy (struct dm_io_client *client) { -mempool_destroy (client->pool); -bioset_free (client->bios); +mempool_exit (&client->pool); +bioset_exit (&client->bios);kfree (client); }EXPORT_SYMBOL (dm_io_client_destroy);
@@ -120,7 +121,7 @@ static void complete_io(struct io *io)invalidate_kernel_vmap_range (io->vma_invalidate_address, io->vma_invalidate_size); -mempool_free (io, io->client->pool); +mempool_free (io, &io->client->pool);fn (error_bits, context); }
@@ -344,7 +345,7 @@ static void do_region(int op, int op_flags, unsigned region, dm_sector_div_up(remaining, (PAGE_SIZE >> SECTOR_SHIFT))); } - bio =bio_alloc_bioset (GFP_NOIO , num_bvecs, io->client->bios); + bio =bio_alloc_bioset (GFP_NOIO , num_bvecs, &io->client->bios); bio->bi_iter.bi_sector = where->sector + (where->count - remaining);bio_set_dev (bio, where->bdev); bio->bi_end_io = endio;
@@ -442,7 +443,7 @@ static int sync_io(struct dm_io_client *client, unsigned int num_regions,init_completion (&sio.wait); - io =mempool_alloc (client->pool,GFP_NOIO ); + io =mempool_alloc (&client->pool,GFP_NOIO ); io->error_bits =0 ;atomic_set (&io->count,1 );/* see dispatch_io() */ io->client = client;
@@ -474,7 +475,7 @@ static int async_io(struct dm_io_client *client, unsigned int num_regions,return -EIO ; } - io =mempool_alloc (client->pool,GFP_NOIO ); + io =mempool_alloc (&client->pool,GFP_NOIO ); io->error_bits =0 ;atomic_set (&io->count,1 );/* see dispatch_io() */ io->client = client;
drivers/md/dm-kcopyd.c +12 -10
@@ -47,7 +47,7 @@ struct dm_kcopyd_client {wait_queue_head_t destroyq;atomic_t nr_jobs; -mempool_t *job_pool; +mempool_t job_pool;struct workqueue_struct *kcopyd_wq;struct work_struct kcopyd_work;
@@ -479,7 +479,7 @@ static int run_complete_job(struct kcopyd_job *job)*/ if (job->master_job == job) {mutex_destroy (&job->lock); -mempool_free (job, kc->job_pool); +mempool_free (job, &kc->job_pool); }fn (read_err, write_err, context);
@@ -751,7 +751,7 @@ int dm_kcopyd_copy(struct dm_kcopyd_client *kc, struct dm_io_region *from,* Allocate an array of jobs consisting of one master job * followed by SPLIT_COUNT sub jobs. */ - job =mempool_alloc (kc->job_pool,GFP_NOIO ); + job =mempool_alloc (&kc->job_pool,GFP_NOIO );mutex_init (&job->lock);/*
@@ -835,7 +835,7 @@ void *dm_kcopyd_prepare_callback(struct dm_kcopyd_client *kc, {struct kcopyd_job *job; - job =mempool_alloc (kc->job_pool,GFP_NOIO ); + job =mempool_alloc (&kc->job_pool,GFP_NOIO );memset (job,0 ,sizeof (struct kcopyd_job )); job->kc = kc;
@@ -879,7 +879,7 @@ int kcopyd_cancel(struct kcopyd_job *job, int block)*---------------------------------------------------------------*/ struct dm_kcopyd_client *dm_kcopyd_client_create (struct dm_kcopyd_throttle *throttle) { -int r = -ENOMEM ; +int r;struct dm_kcopyd_client *kc; kc =kmalloc (sizeof (*kc),GFP_KERNEL );
@@ -892,14 +892,16 @@ struct dm_kcopyd_client *dm_kcopyd_client_create(struct dm_kcopyd_throttle *throINIT_LIST_HEAD (&kc->pages_jobs); kc->throttle = throttle; - kc->job_pool =mempool_create_slab_pool (MIN_JOBS , _job_cache); -if (!kc->job_pool) + r =mempool_init_slab_pool (&kc->job_pool,MIN_JOBS , _job_cache); +if (r) goto bad_slab;INIT_WORK (&kc->kcopyd_work, do_work); kc->kcopyd_wq =alloc_workqueue ("kcopyd" ,WQ_MEM_RECLAIM ,0 ); -if (!kc->kcopyd_wq) +if (!kc->kcopyd_wq) { + r = -ENOMEM ; goto bad_workqueue; + } kc->pages =NULL ; kc->nr_reserved_pages = kc->nr_free_pages =0 ;
@@ -923,7 +925,7 @@ struct dm_kcopyd_client *dm_kcopyd_client_create(struct dm_kcopyd_throttle *thro bad_client_pages:destroy_workqueue (kc->kcopyd_wq); bad_workqueue: -mempool_destroy (kc->job_pool); +mempool_exit (&kc->job_pool); bad_slab:kfree (kc);
@@ -942,7 +944,7 @@ void dm_kcopyd_client_destroy(struct dm_kcopyd_client *kc)destroy_workqueue (kc->kcopyd_wq);dm_io_client_destroy (kc->io_client);client_free_pages (kc); -mempool_destroy (kc->job_pool); +mempool_exit (&kc->job_pool);kfree (kc); }EXPORT_SYMBOL (dm_kcopyd_client_destroy);
drivers/md/dm-log-userspace-base.c +9 -10
@@ -76,7 +76,7 @@ struct log_c {*/ uint32_t integrated_flush; -mempool_t *flush_entry_pool; +mempool_t flush_entry_pool; };static struct kmem_cache *_flush_entry_cache;
@@ -249,11 +249,10 @@ static int userspace_ctr(struct dm_dirty_log *log, struct dm_target *ti, goto out; } - lc->flush_entry_pool =mempool_create_slab_pool (FLUSH_ENTRY_POOL_SIZE , - _flush_entry_cache); -if (!lc->flush_entry_pool) { + r =mempool_init_slab_pool (&lc->flush_entry_pool,FLUSH_ENTRY_POOL_SIZE , + _flush_entry_cache); +if (r) {DMERR ("Failed to create flush_entry_pool" ); - r = -ENOMEM ; goto out; }
@@ -313,7 +312,7 @@ static int userspace_ctr(struct dm_dirty_log *log, struct dm_target *ti, out:kfree (devices_rdata);if (r) { -mempool_destroy (lc->flush_entry_pool); +mempool_exit (&lc->flush_entry_pool);kfree (lc);kfree (ctr_str); }else {
@@ -342,7 +341,7 @@ static void userspace_dtr(struct dm_dirty_log *log)if (lc->log_dev)dm_put_device (lc->ti, lc->log_dev); -mempool_destroy (lc->flush_entry_pool); +mempool_exit (&lc->flush_entry_pool);kfree (lc->usr_argv_str);kfree (lc);
@@ -570,7 +569,7 @@ static int userspace_flush(struct dm_dirty_log *log)int mark_list_is_empty;int clear_list_is_empty;struct dm_dirty_log_flush_entry *fe, *tmp_fe; -mempool_t *flush_entry_pool = lc->flush_entry_pool; +mempool_t *flush_entry_pool = &lc->flush_entry_pool;spin_lock_irqsave (&lc->flush_lock, flags);list_splice_init (&lc->mark_list, &mark_list);
@@ -653,7 +652,7 @@ static void userspace_mark_region(struct dm_dirty_log *log, region_t region)struct dm_dirty_log_flush_entry *fe;/* Wait for an allocation, but _never_ fail */ - fe =mempool_alloc (lc->flush_entry_pool,GFP_NOIO ); + fe =mempool_alloc (&lc->flush_entry_pool,GFP_NOIO );BUG_ON (!fe);spin_lock_irqsave (&lc->flush_lock, flags);
@@ -687,7 +686,7 @@ static void userspace_clear_region(struct dm_dirty_log *log, region_t region)* to cause the region to be resync'ed when the * device is activated next time. */ - fe =mempool_alloc (lc->flush_entry_pool,GFP_ATOMIC ); + fe =mempool_alloc (&lc->flush_entry_pool,GFP_ATOMIC );if (!fe) {DMERR ("Failed to allocate memory to clear region." );return ;
drivers/md/dm-region-hash.c +12 -11
@@ -63,7 +63,7 @@ struct dm_region_hash {/* hash table */ rwlock_t hash_lock; -mempool_t *region_pool; +mempool_t region_pool;unsigned mask;unsigned nr_buckets;unsigned prime;
@@ -169,6 +169,7 @@ struct dm_region_hash *dm_region_hash_create(struct dm_region_hash *rh;unsigned nr_buckets, max_buckets;size_t i; +int ret;/* * Calculate a suitable number of buckets for our hash
@@ -220,9 +221,9 @@ struct dm_region_hash *dm_region_hash_create(INIT_LIST_HEAD (&rh->failed_recovered_regions); rh->flush_failure =0 ; - rh->region_pool =mempool_create_kmalloc_pool (MIN_REGIONS , -sizeof (struct dm_region )); -if (!rh->region_pool) { + ret =mempool_init_kmalloc_pool (&rh->region_pool,MIN_REGIONS , +sizeof (struct dm_region )); +if (ret) {vfree (rh->buckets);kfree (rh); rh =ERR_PTR (-ENOMEM );
@@ -242,14 +243,14 @@ void dm_region_hash_destroy(struct dm_region_hash *rh)list_for_each_entry_safe (reg, nreg, rh->buckets + h, hash_list) {BUG_ON (atomic_read (®->pending)); -mempool_free (reg, rh->region_pool); +mempool_free (reg, &rh->region_pool); } }if (rh->log)dm_dirty_log_destroy (rh->log); -mempool_destroy (rh->region_pool); +mempool_exit (&rh->region_pool);vfree (rh->buckets);kfree (rh); }
@@ -287,7 +288,7 @@ static struct dm_region *__rh_alloc(struct dm_region_hash *rh, region_t region) {struct dm_region *reg, *nreg; - nreg =mempool_alloc (rh->region_pool,GFP_ATOMIC ); + nreg =mempool_alloc (&rh->region_pool,GFP_ATOMIC );if (unlikely (!nreg)) nreg =kmalloc (sizeof (*nreg),GFP_NOIO | __GFP_NOFAIL);
@@ -303,7 +304,7 @@ static struct dm_region *__rh_alloc(struct dm_region_hash *rh, region_t region) reg =__rh_lookup (rh, region);if (reg)/* We lost the race. */ -mempool_free (nreg, rh->region_pool); +mempool_free (nreg, &rh->region_pool);else {__rh_insert (rh, nreg);if (nreg->state ==DM_RH_CLEAN ) {
@@ -481,17 +482,17 @@ void dm_rh_update_states(struct dm_region_hash *rh, int errors_handled)list_for_each_entry_safe (reg, next, &recovered, list) { rh->log->type->clear_region (rh->log, reg->key);complete_resync_work (reg,1 ); -mempool_free (reg, rh->region_pool); +mempool_free (reg, &rh->region_pool); }list_for_each_entry_safe (reg, next, &failed_recovered, list) {complete_resync_work (reg, errors_handled ?0 :1 ); -mempool_free (reg, rh->region_pool); +mempool_free (reg, &rh->region_pool); }list_for_each_entry_safe (reg, next, &clean, list) { rh->log->type->clear_region (rh->log, reg->key); -mempool_free (reg, rh->region_pool); +mempool_free (reg, &rh->region_pool); } rh->log->type->flush (rh->log);
drivers/md/dm-rq.c +1 -1
@@ -433,7 +433,7 @@ static int setup_clone(struct request *clone, struct request *rq, {int r; - r =blk_rq_prep_clone (clone, rq, tio->md->bs, gfp_mask, + r =blk_rq_prep_clone (clone, rq, &tio->md->bs, gfp_mask, dm_rq_bio_constructor, tio);if (r)return r;
drivers/md/dm-snap.c +8 -9
@@ -87,7 +87,7 @@ struct dm_snapshot {*/ struct list_head out_of_order_list; -mempool_t *pending_pool; +mempool_t pending_pool;struct dm_exception_table pending;struct dm_exception_table complete;
@@ -682,7 +682,7 @@ static void free_completed_exception(struct dm_exception *e)static struct dm_snap_pending_exception *alloc_pending_exception (struct dm_snapshot *s) { -struct dm_snap_pending_exception *pe =mempool_alloc (s->pending_pool, +struct dm_snap_pending_exception *pe =mempool_alloc (&s->pending_pool,GFP_NOIO );atomic_inc (&s->pending_exceptions_count);
@@ -695,7 +695,7 @@ static void free_pending_exception(struct dm_snap_pending_exception *pe) {struct dm_snapshot *s = pe->snap; -mempool_free (pe, s->pending_pool); +mempool_free (pe, &s->pending_pool);smp_mb__before_atomic ();atomic_dec (&s->pending_exceptions_count); }
@@ -1196,10 +1196,9 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv) goto bad_kcopyd; } - s->pending_pool =mempool_create_slab_pool (MIN_IOS , pending_cache); -if (!s->pending_pool) { + r =mempool_init_slab_pool (&s->pending_pool,MIN_IOS , pending_cache); +if (r) { ti->error ="Could not allocate mempool for pending exceptions" ; - r = -ENOMEM ; goto bad_pending_pool; }
@@ -1259,7 +1258,7 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)unregister_snapshot (s); bad_load_and_register: -mempool_destroy (s->pending_pool); +mempool_exit (&s->pending_pool); bad_pending_pool:dm_kcopyd_client_destroy (s->kcopyd_client);
@@ -1355,7 +1354,7 @@ static void snapshot_dtr(struct dm_target *ti)while (atomic_read (&s->pending_exceptions_count))msleep (1 );/* -* Ensure instructions in mempool_destroy aren't reordered +* Ensure instructions in mempool_exit aren't reordered * before atomic_read. */ smp_mb ();
@@ -1367,7 +1366,7 @@ static void snapshot_dtr(struct dm_target *ti)__free_exceptions (s); -mempool_destroy (s->pending_pool); +mempool_exit (&s->pending_pool);dm_exception_store_destroy (s->store);
drivers/md/dm-thin.c +16 -16
@@ -260,7 +260,7 @@ struct pool {struct dm_deferred_set *all_io_ds;struct dm_thin_new_mapping *next_mapping; -mempool_t *mapping_pool; +mempool_t mapping_pool;process_bio_fn process_bio;process_bio_fn process_discard;
@@ -917,7 +917,7 @@ static void process_prepared_mapping_fail(struct dm_thin_new_mapping *m) {cell_error (m->tc->pool, m->cell);list_del (&m->list); -mempool_free (m, m->tc->pool->mapping_pool); +mempool_free (m, &m->tc->pool->mapping_pool); }static void process_prepared_mapping (struct dm_thin_new_mapping *m)
@@ -961,7 +961,7 @@ static void process_prepared_mapping(struct dm_thin_new_mapping *m) out:list_del (&m->list); -mempool_free (m, pool->mapping_pool); +mempool_free (m, &pool->mapping_pool); }/*----------------------------------------------------------------*/
@@ -971,7 +971,7 @@ static void free_discard_mapping(struct dm_thin_new_mapping *m)struct thin_c *tc = m->tc;if (m->cell)cell_defer_no_holder (tc, m->cell); -mempool_free (m, tc->pool->mapping_pool); +mempool_free (m, &tc->pool->mapping_pool); }static void process_prepared_discard_fail (struct dm_thin_new_mapping *m)
@@ -999,7 +999,7 @@ static void process_prepared_discard_no_passdown(struct dm_thin_new_mapping *m)bio_endio (m->bio);cell_defer_no_holder (tc, m->cell); -mempool_free (m, tc->pool->mapping_pool); +mempool_free (m, &tc->pool->mapping_pool); }/*----------------------------------------------------------------*/
@@ -1092,7 +1092,7 @@ static void process_prepared_discard_passdown_pt1(struct dm_thin_new_mapping *m)metadata_operation_failed (pool,"dm_thin_remove_range" , r);bio_io_error (m->bio);cell_defer_no_holder (tc, m->cell); -mempool_free (m, pool->mapping_pool); +mempool_free (m, &pool->mapping_pool);return ; }
@@ -1105,7 +1105,7 @@ static void process_prepared_discard_passdown_pt1(struct dm_thin_new_mapping *m)metadata_operation_failed (pool,"dm_pool_inc_data_range" , r);bio_io_error (m->bio);cell_defer_no_holder (tc, m->cell); -mempool_free (m, pool->mapping_pool); +mempool_free (m, &pool->mapping_pool);return ; }
@@ -1150,7 +1150,7 @@ static void process_prepared_discard_passdown_pt2(struct dm_thin_new_mapping *m)bio_endio (m->bio);cell_defer_no_holder (tc, m->cell); -mempool_free (m, pool->mapping_pool); +mempool_free (m, &pool->mapping_pool); } static void process_prepared(struct pool *pool, struct list_head *head,
@@ -1196,7 +1196,7 @@ static int ensure_next_mapping(struct pool *pool)if (pool->next_mapping)return 0 ; - pool->next_mapping =mempool_alloc (pool->mapping_pool,GFP_ATOMIC ); + pool->next_mapping =mempool_alloc (&pool->mapping_pool,GFP_ATOMIC );return pool->next_mapping ?0 : -ENOMEM ; }
@@ -2835,8 +2835,8 @@ static void __pool_destroy(struct pool *pool)destroy_workqueue (pool->wq);if (pool->next_mapping) -mempool_free (pool->next_mapping, pool->mapping_pool); -mempool_destroy (pool->mapping_pool); +mempool_free (pool->next_mapping, &pool->mapping_pool); +mempool_exit (&pool->mapping_pool);dm_deferred_set_destroy (pool->shared_read_ds);dm_deferred_set_destroy (pool->all_io_ds);kfree (pool);
@@ -2931,11 +2931,11 @@ static struct pool *pool_create(struct mapped_device *pool_md, } pool->next_mapping =NULL ; - pool->mapping_pool =mempool_create_slab_pool (MAPPING_POOL_SIZE , - _new_mapping_cache); -if (!pool->mapping_pool) { + r =mempool_init_slab_pool (&pool->mapping_pool,MAPPING_POOL_SIZE , + _new_mapping_cache); +if (r) { *error ="Error creating pool's mapping mempool" ; - err_p =ERR_PTR (-ENOMEM ); + err_p =ERR_PTR (r); goto bad_mapping_pool; }
@@ -2955,7 +2955,7 @@ static struct pool *pool_create(struct mapped_device *pool_md,return pool; bad_sort_array: -mempool_destroy (pool->mapping_pool); +mempool_exit (&pool->mapping_pool); bad_mapping_pool:dm_deferred_set_destroy (pool->all_io_ds); bad_all_io_ds:
drivers/md/dm-verity-fec.c +28 -27
122 lines not on this page · raw message
drivers/md/dm-verity-fec.h +4 -4
@@ -46,10 +46,10 @@ struct dm_verity_fec {sector_t hash_blocks;/* blocks covered after v->hash_start */ unsigned char roots;/* number of parity bytes, M-N of RS(M, N) */ unsigned char rsn;/* N of RS(M, N) */ -mempool_t *rs_pool;/* mempool for fio->rs */ -mempool_t *prealloc_pool;/* mempool for preallocated buffers */ -mempool_t *extra_pool;/* mempool for extra buffers */ -mempool_t *output_pool;/* mempool for output */ +mempool_t rs_pool;/* mempool for fio->rs */ +mempool_t prealloc_pool;/* mempool for preallocated buffers */ +mempool_t extra_pool;/* mempool for extra buffers */ +mempool_t output_pool;/* mempool for output */ struct kmem_cache *cache;/* cache for buffers */ };
drivers/md/dm-zoned-target.c +6 -7
@@ -57,7 +57,7 @@ struct dmz_target {struct workqueue_struct *chunk_wq;/* For cloned BIOs to zones */ -struct bio_set *bio_set; +struct bio_set bio_set;/* For flush */ spinlock_t flush_lock;
@@ -121,7 +121,7 @@ static int dmz_submit_read_bio(struct dmz_target *dmz, struct dm_zone *zone, }/* Partial BIO: we need to clone the BIO */ - clone =bio_clone_fast (bio,GFP_NOIO , dmz->bio_set); + clone =bio_clone_fast (bio,GFP_NOIO , &dmz->bio_set);if (!clone)return -ENOMEM ;
@@ -779,10 +779,9 @@ static int dmz_ctr(struct dm_target *ti, unsigned int argc, char **argv) ti->len = (sector_t )dmz_nr_chunks (dmz->metadata) << dev->zone_nr_sectors_shift;/* Zone BIO */ - dmz->bio_set =bioset_create (DMZ_MIN_BIOS ,0 ,0 ); -if (!dmz->bio_set) { + ret =bioset_init (&dmz->bio_set,DMZ_MIN_BIOS ,0 ,0 ); +if (ret) { ti->error ="Create BIO set failed" ; - ret = -ENOMEM ; goto err_meta; }
@@ -828,7 +827,7 @@ static int dmz_ctr(struct dm_target *ti, unsigned int argc, char **argv)destroy_workqueue (dmz->chunk_wq); err_bio:mutex_destroy (&dmz->chunk_lock); -bioset_free (dmz->bio_set); +bioset_exit (&dmz->bio_set); err_meta:dmz_dtr_metadata (dmz->metadata); err_dev:
@@ -858,7 +857,7 @@ static void dmz_dtr(struct dm_target *ti)dmz_dtr_metadata (dmz->metadata); -bioset_free (dmz->bio_set); +bioset_exit (&dmz->bio_set);dmz_put_zoned_device (ti);
drivers/md/dm.c +23 -30
120 lines not on this page · raw message
Signature · 1 line
2.17.0
PATCH 8/12 target: convert to bioset_init()/mempool_init()
In reply to Kent Overstreet--- drivers/target/target_core_iblock.c | 14 ++++++-------- drivers/target/target_core_iblock.h | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-)
drivers/target/target_core_iblock.c +6 -8
@@ -94,8 +94,8 @@ static int iblock_configure_device(struct se_device *dev)return -EINVAL ; } - ib_dev->ibd_bio_set =bioset_create (IBLOCK_BIO_POOL_SIZE ,0 ,BIOSET_NEED_BVECS ); -if (!ib_dev->ibd_bio_set) { + ret =bioset_init (&ib_dev->ibd_bio_set,IBLOCK_BIO_POOL_SIZE ,0 ,BIOSET_NEED_BVECS ); +if (ret) {pr_err ("IBLOCK: Unable to create bioset\n" ); goto out; }
@@ -141,7 +141,7 @@ static int iblock_configure_device(struct se_device *dev) bi =bdev_get_integrity (bd);if (bi) { -struct bio_set *bs = ib_dev->ibd_bio_set; +struct bio_set *bs = &ib_dev->ibd_bio_set;if (!strcmp (bi->profile->name,"T10-DIF-TYPE3-IP" ) || !strcmp (bi->profile->name,"T10-DIF-TYPE1-IP" )) {
@@ -174,8 +174,7 @@ static int iblock_configure_device(struct se_device *dev) out_blkdev_put:blkdev_put (ib_dev->ibd_bd,FMODE_WRITE |FMODE_READ |FMODE_EXCL ); out_free_bioset: -bioset_free (ib_dev->ibd_bio_set); - ib_dev->ibd_bio_set =NULL ; +bioset_exit (&ib_dev->ibd_bio_set); out:return ret; }
@@ -199,8 +198,7 @@ static void iblock_destroy_device(struct se_device *dev)if (ib_dev->ibd_bd !=NULL )blkdev_put (ib_dev->ibd_bd,FMODE_WRITE |FMODE_READ |FMODE_EXCL ); -if (ib_dev->ibd_bio_set !=NULL ) -bioset_free (ib_dev->ibd_bio_set); +bioset_exit (&ib_dev->ibd_bio_set); } static unsigned long long iblock_emulate_read_cap_with_block_size(
@@ -332,7 +330,7 @@ iblock_get_bio(struct se_cmd *cmd, sector_t lba, u32 sg_num, int op,if (sg_num >BIO_MAX_PAGES ) sg_num =BIO_MAX_PAGES ; - bio =bio_alloc_bioset (GFP_NOIO , sg_num, ib_dev->ibd_bio_set); + bio =bio_alloc_bioset (GFP_NOIO , sg_num, &ib_dev->ibd_bio_set);if (!bio) {pr_err ("Unable to allocate memory for bio\n" );return NULL ;
drivers/target/target_core_iblock.h +1 -1
@@ -22,7 +22,7 @@ struct iblock_dev {struct se_device dev;unsigned char ibd_udev_path[SE_UDEV_PATH_LEN ];u32 ibd_flags; -struct bio_set *ibd_bio_set; +struct bio_set ibd_bio_set;struct block_device *ibd_bd;bool ibd_readonly; }____cacheline_aligned ;
Signature · 1 line
2.17.0
PATCH 9/12 fs: convert block_dev.c to bioset_init()
In reply to Kent Overstreet--- fs/block_dev.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
fs/block_dev.c +3 -6
@@ -272,7 +272,7 @@ struct blkdev_dio {struct bio bio; }; -static struct bio_set *blkdev_dio_pool__read_mostly ; +static struct bio_set blkdev_dio_pool;static void blkdev_bio_end_io (struct bio *bio) {
@@ -334,7 +334,7 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages) (bdev_logical_block_size(bdev) - 1))return -EINVAL ; - bio =bio_alloc_bioset (GFP_KERNEL , nr_pages, blkdev_dio_pool); + bio =bio_alloc_bioset (GFP_KERNEL , nr_pages, &blkdev_dio_pool);bio_get (bio);/* extra ref for the completion handler */ dio = container_of(bio, struct blkdev_dio, bio);
@@ -432,10 +432,7 @@ blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter)static __init int blkdev_init (void ) { - blkdev_dio_pool =bioset_create (4 , offsetof(struct blkdev_dio , bio),BIOSET_NEED_BVECS ); -if (!blkdev_dio_pool) -return -ENOMEM ; -return 0 ; +return bioset_init (&blkdev_dio_pool,4 , offsetof(struct blkdev_dio , bio),BIOSET_NEED_BVECS ); }module_init (blkdev_init);
Signature · 1 line
2.17.0
PATCH 10/12 btrfs: convert to bioset_init()/mempool_init()
In reply to Kent Overstreet--- fs/btrfs/extent_io.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-)
fs/btrfs/extent_io.c +11 -14
@@ -26,7 +26,7 @@static struct kmem_cache *extent_state_cache;static struct kmem_cache *extent_buffer_cache; -static struct bio_set *btrfs_bioset; +static struct bio_set btrfs_bioset;static inline bool extent_state_in_tree (const struct extent_state *state) {
@@ -162,20 +162,18 @@ int __init extent_io_init(void)if (!extent_buffer_cache) goto free_state_cache; - btrfs_bioset =bioset_create (BIO_POOL_SIZE , - offsetof(struct btrfs_io_bio , bio), -BIOSET_NEED_BVECS ); -if (!btrfs_bioset) +if (bioset_init (&btrfs_bioset,BIO_POOL_SIZE , + offsetof(struct btrfs_io_bio , bio), +BIOSET_NEED_BVECS )) goto free_buffer_cache; -if (bioset_integrity_create (btrfs_bioset,BIO_POOL_SIZE )) +if (bioset_integrity_create (&btrfs_bioset,BIO_POOL_SIZE )) goto free_bioset;return 0 ; free_bioset: -bioset_free (btrfs_bioset); - btrfs_bioset =NULL ; +bioset_exit (&btrfs_bioset); free_buffer_cache:kmem_cache_destroy (extent_buffer_cache);
@@ -198,8 +196,7 @@ void __cold extent_io_exit(void)rcu_barrier ();kmem_cache_destroy (extent_state_cache);kmem_cache_destroy (extent_buffer_cache); -if (btrfs_bioset) -bioset_free (btrfs_bioset); +bioset_exit (&btrfs_bioset); } void extent_io_tree_init(struct extent_io_tree *tree,
@@ -2679,7 +2676,7 @@ struct bio *btrfs_bio_alloc(struct block_device *bdev, u64 first_byte) {struct bio *bio; - bio =bio_alloc_bioset (GFP_NOFS ,BIO_MAX_PAGES , btrfs_bioset); + bio =bio_alloc_bioset (GFP_NOFS ,BIO_MAX_PAGES , &btrfs_bioset);bio_set_dev (bio, bdev); bio->bi_iter.bi_sector = first_byte >>9 ;btrfs_io_bio_init (btrfs_io_bio (bio));
@@ -2692,7 +2689,7 @@ struct bio *btrfs_bio_clone(struct bio *bio)struct bio *new;/* Bio allocation backed by a bioset does not fail */ - new =bio_clone_fast (bio,GFP_NOFS , btrfs_bioset); + new =bio_clone_fast (bio,GFP_NOFS , &btrfs_bioset); btrfs_bio =btrfs_io_bio (new);btrfs_io_bio_init (btrfs_bio); btrfs_bio->iter = bio->bi_iter;
@@ -2704,7 +2701,7 @@ struct bio *btrfs_io_bio_alloc(unsigned int nr_iovecs)struct bio *bio;/* Bio allocation backed by a bioset does not fail */ - bio =bio_alloc_bioset (GFP_NOFS , nr_iovecs, btrfs_bioset); + bio =bio_alloc_bioset (GFP_NOFS , nr_iovecs, &btrfs_bioset);btrfs_io_bio_init (btrfs_io_bio (bio));return bio; }
@@ -2715,7 +2712,7 @@ struct bio *btrfs_bio_clone_partial(struct bio *orig, int offset, int size)struct btrfs_io_bio *btrfs_bio;/* this will never fail when it's backed by a bioset */ - bio =bio_clone_fast (orig,GFP_NOFS , btrfs_bioset); + bio =bio_clone_fast (orig,GFP_NOFS , &btrfs_bioset);ASSERT (bio); btrfs_bio =btrfs_io_bio (bio);
Signature · 1 line
2.17.0
PATCH 11/12 xfs: convert to bioset_init()/mempool_init()
In reply to Kent Overstreet--- fs/xfs/xfs_aops.c | 2 +- fs/xfs/xfs_aops.h | 2 +- fs/xfs/xfs_super.c | 11 +++++------ 3 files changed, 7 insertions(+), 8 deletions(-)
fs/xfs/xfs_aops.c +1 -1
@@ -594,7 +594,7 @@ xfs_alloc_ioend(struct xfs_ioend *ioend;struct bio *bio; - bio =bio_alloc_bioset (GFP_NOFS ,BIO_MAX_PAGES , xfs_ioend_bioset); + bio =bio_alloc_bioset (GFP_NOFS ,BIO_MAX_PAGES , &xfs_ioend_bioset);xfs_init_bio_from_bh (bio, bh); ioend = container_of(bio, struct xfs_ioend, io_inline_bio);
fs/xfs/xfs_aops.h +1 -1
@@ -18,7 +18,7 @@#ifndef __XFS_AOPS_H__#define __XFS_AOPS_H__ -extern struct bio_set *xfs_ioend_bioset; +extern struct bio_set xfs_ioend_bioset;/* * Types of I/O for bmap clustering and I/O completion tracking.
fs/xfs/xfs_super.c +5 -6
@@ -63,7 +63,7 @@#include <linux/parser.h> static const struct super_operations xfs_super_operations; -struct bio_set *xfs_ioend_bioset; +struct bio_set xfs_ioend_bioset;static struct kset *xfs_kset;/* top-level xfs sysfs dir */ #ifdef DEBUG
@@ -1845,10 +1845,9 @@ MODULE_ALIAS_FS("xfs"); STATIC int __initxfs_init_zones (void ) { - xfs_ioend_bioset =bioset_create (4 *MAX_BUF_PER_PAGE , +if (bioset_init (&xfs_ioend_bioset,4 *MAX_BUF_PER_PAGE , offsetof(struct xfs_ioend , io_inline_bio), -BIOSET_NEED_BVECS ); -if (!xfs_ioend_bioset) +BIOSET_NEED_BVECS )) goto out; xfs_log_ticket_zone = kmem_zone_init(sizeof(xlog_ticket_t),
@@ -1997,7 +1996,7 @@ xfs_init_zones(void) out_destroy_log_ticket_zone:kmem_zone_destroy (xfs_log_ticket_zone); out_free_ioend_bioset: -bioset_free (xfs_ioend_bioset); +bioset_exit (&xfs_ioend_bioset); out:return -ENOMEM ; }
@@ -2029,7 +2028,7 @@ xfs_destroy_zones(void)kmem_zone_destroy (xfs_btree_cur_zone);kmem_zone_destroy (xfs_bmap_free_item_zone);kmem_zone_destroy (xfs_log_ticket_zone); -bioset_free (xfs_ioend_bioset); +bioset_exit (&xfs_ioend_bioset); }STATIC int__init
Signature · 1 line
2.17.0
PATCH 12/12 block: Drop bioset_create()
In reply to Kent OverstreetAll users have been converted to bioset_init()
--- block/bio.c | 61 ++++++++++----------------------------------- include/linux/bio.h | 6 ++--- 2 files changed, 15 insertions(+), 52 deletions(-)
block/bio.c +13 -48
@@ -1908,22 +1908,26 @@ void bioset_exit(struct bio_set *bs) }EXPORT_SYMBOL (bioset_exit); -void bioset_free (struct bio_set *bs) -{ -bioset_exit (bs); -kfree (bs); -} -EXPORT_SYMBOL (bioset_free); -/** * bioset_init - Initialize a bio_set +* @bs: pool to initialize * @pool_size: Number of bio and bio_vecs to cache in the mempool * @front_pad: Number of bytes to allocate in front of the returned bio * @flags: Flags to modify behavior, currently %BIOSET_NEED_BVECS * and %BIOSET_NEED_RESCUER * -* Similar to bioset_create(), but initializes a passed-in bioset instead of -* separately allocating it. +* Description: +* Set up a bio_set to be used with @bio_alloc_bioset. Allows the caller +* to ask for a number of bytes to be allocated in front of the bio. +* Front pad allocation is useful for embedding the bio inside +* another structure, to avoid allocating extra data to go with the bio. +* Note that the bio must be embedded at the END of that structure always, +* or things will break badly. +* If %BIOSET_NEED_BVECS is set in @flags, a separate pool will be allocated +* for allocating iovecs. This pool is not needed e.g. for bio_clone_fast(). +* If %BIOSET_NEED_RESCUER is set, a workqueue is created which can be used to +* dispatch queued requests when the mempool runs out of space. +* */ int bioset_init(struct bio_set *bs, unsigned int pool_size,
@@ -1963,45 +1967,6 @@ int bioset_init(struct bio_set *bs, }EXPORT_SYMBOL (bioset_init); -/** -* bioset_create - Create a bio_set -* @pool_size: Number of bio and bio_vecs to cache in the mempool -* @front_pad: Number of bytes to allocate in front of the returned bio -* @flags: Flags to modify behavior, currently %BIOSET_NEED_BVECS -* and %BIOSET_NEED_RESCUER -* -* Description: -* Set up a bio_set to be used with @bio_alloc_bioset. Allows the caller -* to ask for a number of bytes to be allocated in front of the bio. -* Front pad allocation is useful for embedding the bio inside -* another structure, to avoid allocating extra data to go with the bio. -* Note that the bio must be embedded at the END of that structure always, -* or things will break badly. -* If %BIOSET_NEED_BVECS is set in @flags, a separate pool will be allocated -* for allocating iovecs. This pool is not needed e.g. for bio_clone_fast(). -* If %BIOSET_NEED_RESCUER is set, a workqueue is created which can be used to -* dispatch queued requests when the mempool runs out of space. -* -*/ -struct bio_set *bioset_create (unsigned int pool_size, -unsigned int front_pad, -int flags) -{ -struct bio_set *bs; - - bs =kzalloc (sizeof (*bs),GFP_KERNEL ); -if (!bs) -return NULL ; - -if (bioset_init (bs, pool_size, front_pad, flags)) { -kfree (bs); -return NULL ; - } - -return bs; -} -EXPORT_SYMBOL (bioset_create); -#ifdef CONFIG_BLK_CGROUP /**
include/linux/bio.h +2 -4
@@ -410,14 +410,12 @@ static inline struct bio *bio_next_split(struct bio *bio, int sectors,return bio_split (bio, sectors, gfp, bs); } -extern int bioset_init (struct bio_set *,unsigned int ,unsigned int ,int flags); -extern void bioset_exit (struct bio_set *); -extern struct bio_set *bioset_create (unsigned int ,unsigned int ,int flags);enum {BIOSET_NEED_BVECS =BIT (0 ),BIOSET_NEED_RESCUER =BIT (1 ), }; -extern void bioset_free (struct bio_set *); +extern int bioset_init (struct bio_set *,unsigned int ,unsigned int ,int flags); +extern void bioset_exit (struct bio_set *);extern int biovec_init_pool (mempool_t *pool,int pool_entries);extern struct bio *bio_alloc_bioset (gfp_t ,unsigned int ,struct bio_set *);
Signature · 1 line
2.17.0
Quoted 8 lines · Kent Overstreet
Jens - this series does the rest of the conversions that Christoph wanted, and drops
bioset_create().Only lightly tested, but the changes are pretty mechanical. Based on your for-next tree.
It's also in the for-jens branch at https://evilpiepirate.org/git/bcachefs.git
Quoted 7 lines
Kent Overstreet (12):
block: convert bounce,q->bio_splitto bioset_init()/mempool_init()
drbd: convert to bioset_init()/mempool_init()
pktcdvd: convert to bioset_init()/mempool_init()
lightnvm: convert to bioset_init()/mempool_init()
bcache: convert to bioset_init()/mempool_init()
md: convert to bioset_init()/mempool_init()
Hi Kent,
this conversion looks really good, thanks for Ccing me on it. However as Shaohua Li is now the maintainer of md, it probably should have gone to him as well.
Thanks,
NeilBrown
Thanks - sending it to him
Quoted 25 lines · NeilBrown
Quoted 8 lines · Kent Overstreet
Jens - this series does the rest of the conversions that Christoph wanted, and drops
bioset_create().Only lightly tested, but the changes are pretty mechanical. Based on your for-next tree.
It's also in the for-jens branch at https://evilpiepirate.org/git/bcachefs.git
Quoted 7 lines
Kent Overstreet (12):
block: convert bounce,q->bio_splitto bioset_init()/mempool_init()
drbd: convert to bioset_init()/mempool_init()
pktcdvd: convert to bioset_init()/mempool_init()
lightnvm: convert to bioset_init()/mempool_init()
bcache: convert to bioset_init()/mempool_init()
md: convert to bioset_init()/mempool_init()Hi Kent,
this conversion looks really good, thanks for Ccing me on it. However as Shaohua Li is now the maintainer of md, it probably should have gone to him as well.Thanks,
NeilBrown
Re: [PATCH 05/12] bcache: convert to bioset_init()/mempool_init()
In reply to Kent OverstreetQuoted 1 line · Kent Overstreet
Signed-off-by Kent Overstreet <[email protected]>
Hi Kent,
This change looks good to me,
Thanks.
Coly Li
Quoted 303 lines
--- drivers/md/bcache/bcache.h | 10 +++++----- drivers/md/bcache/bset.c | 13 ++++--------- drivers/md/bcache/bset.h | 2 +- drivers/md/bcache/btree.c | 4 ++-- drivers/md/bcache/io.c | 4 ++-- drivers/md/bcache/request.c | 18 +++++++++--------- drivers/md/bcache/super.c | 38 ++++++++++++++----------------------- 7 files changed, 37 insertions(+), 52 deletions(-)drivers/md/bcache/bcache.h +5
-5@@ -269,7 +269,7 @@ struct bcache_device {atomic_t *stripe_sectors_dirty;unsigned long *full_dirty_stripes; -struct bio_set *bio_split; +struct bio_set bio_split; unsigned data_csum:1;@@ -528,9 +528,9 @@ struct cache_set {struct closure sb_write;struct semaphore sb_write_mutex; -mempool_t *search; -mempool_t *bio_meta; -struct bio_set *bio_split; +mempool_t search; +mempool_t bio_meta; +struct bio_set bio_split;/* For the btree cache */ struct shrinker shrink;@@ -655,7 +655,7 @@ struct cache_set {* A btree node on disk could have too many bsets for an iterator to fit * on the stack - have to dynamically allocate them */ -mempool_t *fill_iter; +mempool_t fill_iter;struct bset_sort_state sort;drivers/md/bcache/bset.c +4
-9@@ -1118,8 +1118,7 @@ struct bkey *bch_btree_iter_next_filter(struct btree_iter *iter,void bch_bset_sort_state_free (struct bset_sort_state *state) { -if (state->pool) -mempool_destroy (state->pool); +mempool_exit (&state->pool); }int bch_bset_sort_state_init (struct bset_sort_state *state,unsigned page_order)@@ -1129,11 +1128,7 @@ int bch_bset_sort_state_init(struct bset_sort_state *state, unsigned page_order) state->page_order = page_order; state->crit_factor =int_sqrt (1 << page_order); - state->pool =mempool_create_page_pool (1 , page_order); -if (!state->pool) -return -ENOMEM ; - -return 0 ; +return mempool_init_page_pool (&state->pool,1 , page_order); }EXPORT_SYMBOL (bch_bset_sort_state_init);@@ -1191,7 +1186,7 @@ static void __btree_sort(struct btree_keys *b, struct btree_iter *iter,BUG_ON (order > state->page_order); - outp =mempool_alloc (state->pool,GFP_NOIO ); + outp =mempool_alloc (&state->pool,GFP_NOIO ); out =page_address (outp); used_mempool = true; order = state->page_order;@@ -1220,7 +1215,7 @@ static void __btree_sort(struct btree_keys *b, struct btree_iter *iter, }if (used_mempool) -mempool_free (virt_to_page (out), state->pool); +mempool_free (virt_to_page (out), &state->pool);else free_pages ((unsigned long ) out, order);drivers/md/bcache/bset.h +1
-1@@ -347,7 +347,7 @@ static inline struct bkey *bch_bset_search(struct btree_keys *b,/* Sorting */ struct bset_sort_state { -mempool_t *pool; +mempool_t pool;unsigned page_order;unsigned crit_factor;drivers/md/bcache/btree.c +2
-2@@ -204,7 +204,7 @@ void bch_btree_node_read_done(struct btree *b)struct bset *i =btree_bset_first (b);struct btree_iter *iter; - iter =mempool_alloc (b->c->fill_iter,GFP_NOIO ); + iter =mempool_alloc (&b->c->fill_iter,GFP_NOIO ); iter->size = b->c->sb.bucket_size / b->c->sb.block_size; iter->used =0 ;@@ -271,7 +271,7 @@ void bch_btree_node_read_done(struct btree *b)bch_bset_init_next (&b->keys,write_block (b),bset_magic (&b->c->sb)); out: -mempool_free (iter, b->c->fill_iter); +mempool_free (iter, &b->c->fill_iter);return ; err:set_btree_node_io_error (b);drivers/md/bcache/io.c +2
-2@@ -17,12 +17,12 @@void bch_bbio_free (struct bio *bio,struct cache_set *c) { struct bbio *b = container_of(bio, struct bbio, bio); -mempool_free (b, c->bio_meta); +mempool_free (b, &c->bio_meta); }struct bio *bch_bbio_alloc (struct cache_set *c) { -struct bbio *b =mempool_alloc (c->bio_meta,GFP_NOIO ); +struct bbio *b =mempool_alloc (&c->bio_meta,GFP_NOIO );struct bio *bio = &b->bio;bio_init (bio, bio->bi_inline_vecs,bucket_pages (c));drivers/md/bcache/request.c +9
-9@@ -213,7 +213,7 @@ static void bch_data_insert_start(struct closure *cl) do { unsigned i; struct bkey *k; - struct bio_set *split = op->c->bio_split; + struct bio_set *split = &op->c->bio_split; /* 1 for the device pointer and 1 for the chksum */ if (bch_keylist_realloc(&op->insert_keys,@@ -548,7 +548,7 @@ static int cache_lookup_fn(struct btree_op *op, struct btree *b, struct bkey *k) n =bio_next_split (bio,min_t (uint64_t,INT_MAX ,KEY_OFFSET (k) - bio->bi_iter.bi_sector), -GFP_NOIO , s->d->bio_split); +GFP_NOIO , &s->d->bio_split); bio_key = &container_of(n, struct bbio, bio)->key;bch_bkey_copy_single_ptr (bio_key, k, ptr);@@ -707,7 +707,7 @@ static void search_free(struct closure *cl)bio_complete (s);closure_debug_destroy (cl); -mempool_free (s, s->d->c->search); +mempool_free (s, &s->d->c->search); } static inline struct search *search_alloc(struct bio *bio,@@ -715,7 +715,7 @@ static inline struct search *search_alloc(struct bio *bio, {struct search *s; - s =mempool_alloc (d->c->search,GFP_NOIO ); + s =mempool_alloc (&d->c->search,GFP_NOIO );closure_init (&s->cl,NULL );do_bio_hook (s, bio, request_endio);@@ -864,7 +864,7 @@ static int cached_dev_cache_miss(struct btree *b, struct search *s, s->cache_missed =1 ;if (s->cache_miss || s->iop.bypass) { - miss =bio_next_split (bio, sectors,GFP_NOIO , s->d->bio_split); + miss =bio_next_split (bio, sectors,GFP_NOIO , &s->d->bio_split); ret = miss == bio ?MAP_DONE :MAP_CONTINUE ; goto out_submit; }@@ -887,14 +887,14 @@ static int cached_dev_cache_miss(struct btree *b, struct search *s, s->iop.replace = true; - miss =bio_next_split (bio, sectors,GFP_NOIO , s->d->bio_split); + miss =bio_next_split (bio, sectors,GFP_NOIO , &s->d->bio_split);/* btree_search_recurse()'s btree iterator is no good anymore */ ret = miss == bio ?MAP_DONE : -EINTR ; cache_bio =bio_alloc_bioset (GFP_NOWAIT ,DIV_ROUND_UP (s->insert_bio_sectors,PAGE_SECTORS ), - dc->disk.bio_split); + &dc->disk.bio_split);if (!cache_bio) goto out_submit;@@ -1008,7 +1008,7 @@ static void cached_dev_write(struct cached_dev *dc, struct search *s)struct bio *flush; flush =bio_alloc_bioset (GFP_NOIO ,0 , - dc->disk.bio_split); + &dc->disk.bio_split);if (!flush) { s->iop.status =BLK_STS_RESOURCE ; goto insert_data;@@ -1021,7 +1021,7 @@ static void cached_dev_write(struct cached_dev *dc, struct search *s)closure_bio_submit (s->iop.c, flush, cl); } }else { - s->iop.bio =bio_clone_fast (bio,GFP_NOIO , dc->disk.bio_split); + s->iop.bio =bio_clone_fast (bio,GFP_NOIO , &dc->disk.bio_split);/* I/O request sent to backing device */ bio->bi_end_io = backing_request_endio;closure_bio_submit (s->iop.c, bio, cl);drivers/md/bcache/super.c +14
-24@@ -766,8 +766,7 @@ static void bcache_device_free(struct bcache_device *d)put_disk (d->disk); } -if (d->bio_split) -bioset_free (d->bio_split); +bioset_exit (&d->bio_split);kvfree (d->full_dirty_stripes);kvfree (d->stripe_sectors_dirty);@@ -809,9 +808,8 @@ static int bcache_device_init(struct bcache_device *d, unsigned block_size,if (idx <0 )return idx; -if (!(d->bio_split =bioset_create (4 , offsetof(struct bbio , bio), -BIOSET_NEED_BVECS | -BIOSET_NEED_RESCUER )) || +if (bioset_init (&d->bio_split,4 , offsetof(struct bbio , bio), +BIOSET_NEED_BVECS |BIOSET_NEED_RESCUER ) || !(d->disk =alloc_disk (BCACHE_MINORS ))) {ida_simple_remove (&bcache_device_idx, idx);return -ENOMEM ;@@ -1465,14 +1463,10 @@ static void cache_set_free(struct closure *cl)if (c->moving_gc_wq)destroy_workqueue (c->moving_gc_wq); -if (c->bio_split) -bioset_free (c->bio_split); -if (c->fill_iter) -mempool_destroy (c->fill_iter); -if (c->bio_meta) -mempool_destroy (c->bio_meta); -if (c->search) -mempool_destroy (c->search); +bioset_exit (&c->bio_split); +mempool_exit (&c->fill_iter); +mempool_exit (&c->bio_meta); +mempool_exit (&c->search);kfree (c->devices);mutex_lock (&bch_register_lock);@@ -1683,21 +1677,17 @@ struct cache_set *bch_cache_set_alloc(struct cache_sb *sb)INIT_LIST_HEAD (&c->btree_cache_freed);INIT_LIST_HEAD (&c->data_buckets); - c->search =mempool_create_slab_pool (32 , bch_search_cache); -if (!c->search) - goto err; - iter_size = (sb->bucket_size / sb->block_size +1 ) *sizeof (struct btree_iter_set ); if (!(c->devices = kzalloc(c->nr_uuids * sizeof(void *), GFP_KERNEL)) || - !(c->bio_meta = mempool_create_kmalloc_pool(2, - sizeof(struct bbio) + sizeof(struct bio_vec) * - bucket_pages(c))) || - !(c->fill_iter = mempool_create_kmalloc_pool(1, iter_size)) || - !(c->bio_split = bioset_create(4, offsetof(struct bbio, bio), - BIOSET_NEED_BVECS | - BIOSET_NEED_RESCUER)) || + mempool_init_slab_pool(&c->search, 32, bch_search_cache) || + mempool_init_kmalloc_pool(&c->bio_meta, 2, + sizeof(struct bbio) + sizeof(struct bio_vec) * + bucket_pages(c)) || + mempool_init_kmalloc_pool(&c->fill_iter, 1, iter_size) || + bioset_init(&c->bio_split, 4, offsetof(struct bbio, bio), + BIOSET_NEED_BVECS|BIOSET_NEED_RESCUER) || !(c->uuids = alloc_bucket_pages(GFP_KERNEL, c)) || !(c->moving_gc_wq = alloc_workqueue("bcache_gc", WQ_MEM_RECLAIM, 0)) ||
Quoted 5 lines · Kent Overstreet
Jens - this series does the rest of the conversions that Christoph wanted, and drops
bioset_create().Only lightly tested, but the changes are pretty mechanical. Based on your for-next tree.
By switching 'mempool_t *' to 'mempool_t' and 'bio_set *' to 'bio_set' you've altered the alignment of members in data structures. So I'll need to audit all the data structures you've modified in DM.
Could we get the backstory on _why_ you're making this change? Would go a long way to helping me appreciate why this is a good use of anyone's time.
Thanks,
Mike
Jens Axboe
maintainerQuoted 9 lines · Mike Snitzer
Quoted 5 lines · Kent Overstreet
Jens - this series does the rest of the conversions that Christoph wanted, and drops
bioset_create().Only lightly tested, but the changes are pretty mechanical. Based on your for-next tree.
Quoted 7 lines
By switching '
mempool_t*' to 'mempool_t' and 'bio_set*' to 'bio_set' you've altered the alignment of members in data structures. So I'll need to audit all the data structures you've modified in DM.Could we get the backstory on _why_ you're making this change? Would go a long way to helping me appreciate why this is a good use of anyone's time.
Yeah, it's in the first series, it gets rid of a pointer indirection.
Signature · 1 line
Jens Axboe
Jens Axboe
maintainerQuoted 5 lines · Kent Overstreet
Jens - this series does the rest of the conversions that Christoph wanted, and drops
bioset_create().Only lightly tested, but the changes are pretty mechanical. Based on your for-next tree.
Looks good to me. I'll let it simmer for a bit to give folks a chance to comment on it.
Signature · 1 line
Jens Axboe
Quoted 14 lines · Jens Axboe
Quoted 13 lines · Mike Snitzer
Quoted 5 lines · Kent Overstreet
Jens - this series does the rest of the conversions that Christoph wanted, and drops
bioset_create().Only lightly tested, but the changes are pretty mechanical. Based on your for-next tree.
By switching '
mempool_t*' to 'mempool_t' and 'bio_set*' to 'bio_set' you've altered the alignment of members in data structures. So I'll need to audit all the data structures you've modified in DM.
Quoted 5 lines
Quoted 3 lines
Could we get the backstory on _why_ you're making this change? Would go a long way to helping me appreciate why this is a good use of anyone's time.
Yeah, it's in the first series, it gets rid of a pointer indirection.
"Allows mempools to be embedded in other structs, getting rid of a pointer indirection from allocation fastpaths."
So this is about using contiguous memory or avoiding partial allocation failure? Or both?
Or more to it? Just trying to fully appreciate the theory behind the perceived associated benefit.
I do think the increased risk of these embedded bio_set and mempool_t themselves crossing cachelines, or struct members that follow them doing so, really detracts from these types of changes.
Thanks,
Mike
Jens Axboe
maintainerQuoted 23 lines · Mike Snitzer
Quoted 14 lines · Jens Axboe
Quoted 13 lines · Mike Snitzer
Quoted 5 lines · Kent Overstreet
Jens - this series does the rest of the conversions that Christoph wanted, and drops
bioset_create().Only lightly tested, but the changes are pretty mechanical. Based on your for-next tree.
By switching '
mempool_t*' to 'mempool_t' and 'bio_set*' to 'bio_set' you've altered the alignment of members in data structures. So I'll need to audit all the data structures you've modified in DM.Quoted 5 lines
Quoted 3 lines
Could we get the backstory on _why_ you're making this change? Would go a long way to helping me appreciate why this is a good use of anyone's time.
Yeah, it's in the first series, it gets rid of a pointer indirection.
Quoted 8 lines
"Allows mempools to be embedded in other structs, getting rid of a pointer indirection from allocation fastpaths."
So this is about using contiguous memory or avoiding partial allocation failure? Or both?
Or more to it? Just trying to fully appreciate the theory behind the perceived associated benefit.
It's about avoiding a pointer indirection. Instead of having to follow a pointer to get to that struct, it's simple offset math off your main structure.
Quoted 3 lines
I do think the increased risk of these embedded
bio_setandmempool_tthemselves crossing cachelines, or struct members that follow them doing so, really detracts from these types of changes.
Definitely something to look out for, though most of them should be per-dev structures and not in-flight structures. That makes it a bit less sensitive. But can't hurt to audit the layouts and adjust if necessary. This is why it's posted for review :-)
Signature · 1 line
Jens Axboe
Quoted 37 lines · Jens Axboe
Quoted 23 lines · Mike Snitzer
Quoted 14 lines · Jens Axboe
Quoted 13 lines · Mike Snitzer
Quoted 5 lines · Kent Overstreet
Jens - this series does the rest of the conversions that Christoph wanted, and drops
bioset_create().Only lightly tested, but the changes are pretty mechanical. Based on your for-next tree.
By switching '
mempool_t*' to 'mempool_t' and 'bio_set*' to 'bio_set' you've altered the alignment of members in data structures. So I'll need to audit all the data structures you've modified in DM.Quoted 5 lines
Quoted 3 lines
Could we get the backstory on _why_ you're making this change? Would go a long way to helping me appreciate why this is a good use of anyone's time.
Yeah, it's in the first series, it gets rid of a pointer indirection.
Quoted 8 lines
"Allows mempools to be embedded in other structs, getting rid of a pointer indirection from allocation fastpaths."
So this is about using contiguous memory or avoiding partial allocation failure? Or both?
Or more to it? Just trying to fully appreciate the theory behind the perceived associated benefit.
It's about avoiding a pointer indirection. Instead of having to follow a pointer to get to that struct, it's simple offset math off your main structure.
Quoted 8 lines
Quoted 3 lines
I do think the increased risk of these embedded
bio_setandmempool_tthemselves crossing cachelines, or struct members that follow them doing so, really detracts from these types of changes.Definitely something to look out for, though most of them should be per-dev structures and not in-flight structures. That makes it a bit less sensitive. But can't hurt to audit the layouts and adjust if necessary. This is why it's posted for review :-)
This isn't something that is easily caught upfront. Yes we can all be busy little beavers with pahole to audit alignment. But chances are most people won't do it.
Reality is there is potential for a regression due to false sharing to creep in if a hot struct member suddenly starts straddling a cacheline. That type of NUMA performance killer is pretty insidious and somewhat tedious to hunt down even when looking for it with specialized tools:
https://joemario.github.io/blog/2016/09/01/c2c-blog/
Jens Axboe
maintainerQuoted 53 lines · Mike Snitzer
Quoted 37 lines · Jens Axboe
Quoted 23 lines · Mike Snitzer
Quoted 14 lines · Jens Axboe
Quoted 13 lines · Mike Snitzer
Quoted 5 lines · Kent Overstreet
Jens - this series does the rest of the conversions that Christoph wanted, and drops
bioset_create().Only lightly tested, but the changes are pretty mechanical. Based on your for-next tree.
By switching '
mempool_t*' to 'mempool_t' and 'bio_set*' to 'bio_set' you've altered the alignment of members in data structures. So I'll need to audit all the data structures you've modified in DM.Quoted 5 lines
Quoted 3 lines
Could we get the backstory on _why_ you're making this change? Would go a long way to helping me appreciate why this is a good use of anyone's time.
Yeah, it's in the first series, it gets rid of a pointer indirection.
Quoted 8 lines
"Allows mempools to be embedded in other structs, getting rid of a pointer indirection from allocation fastpaths."
So this is about using contiguous memory or avoiding partial allocation failure? Or both?
Or more to it? Just trying to fully appreciate the theory behind the perceived associated benefit.
It's about avoiding a pointer indirection. Instead of having to follow a pointer to get to that struct, it's simple offset math off your main structure.
Quoted 8 lines
Quoted 3 lines
I do think the increased risk of these embedded
bio_setandmempool_tthemselves crossing cachelines, or struct members that follow them doing so, really detracts from these types of changes.Definitely something to look out for, though most of them should be per-dev structures and not in-flight structures. That makes it a bit less sensitive. But can't hurt to audit the layouts and adjust if necessary. This is why it's posted for review :-)
This isn't something that is easily caught upfront. Yes we can all be busy little beavers with pahole to audit alignment. But chances are most people won't do it.
Quoted 5 lines
Reality is there is potential for a regression due to false sharing to creep in if a hot struct member suddenly starts straddling a cacheline. That type of NUMA performance killer is pretty insidious and somewhat tedious to hunt down even when looking for it with specialized tools:
https://joemario.github.io/blog/2016/09/01/c2c-blog/
IMHO you're making a big deal out of something that should not be. If the dm bits are that sensitive and cache line honed to perfection already due to previous regressions in that area, then it might not be a bad idea to have some compile checks for false cacheline sharing between sensitive members, or spilling of a sub-struct into multiple cachelines.
It's not like this was pushed behind your back. It's posted for review. It's quite possible the net change is a win for dm. Let's focus on getting it reviewed, rather than pontificate on what could potentially go all wrong with this.
Signature · 1 line
Jens Axboe
Quoted 54 lines · Jens Axboe
Quoted 53 lines · Mike Snitzer
Quoted 37 lines · Jens Axboe
Quoted 23 lines · Mike Snitzer
Quoted 14 lines · Jens Axboe
Quoted 13 lines · Mike Snitzer
Quoted 5 lines · Kent Overstreet
Jens - this series does the rest of the conversions that Christoph wanted, and drops
bioset_create().Only lightly tested, but the changes are pretty mechanical. Based on your for-next tree.
By switching '
mempool_t*' to 'mempool_t' and 'bio_set*' to 'bio_set' you've altered the alignment of members in data structures. So I'll need to audit all the data structures you've modified in DM.Quoted 5 lines
Quoted 3 lines
Could we get the backstory on _why_ you're making this change? Would go a long way to helping me appreciate why this is a good use of anyone's time.
Yeah, it's in the first series, it gets rid of a pointer indirection.
Quoted 8 lines
"Allows mempools to be embedded in other structs, getting rid of a pointer indirection from allocation fastpaths."
So this is about using contiguous memory or avoiding partial allocation failure? Or both?
Or more to it? Just trying to fully appreciate the theory behind the perceived associated benefit.
It's about avoiding a pointer indirection. Instead of having to follow a pointer to get to that struct, it's simple offset math off your main structure.
Quoted 8 lines
Quoted 3 lines
I do think the increased risk of these embedded
bio_setandmempool_tthemselves crossing cachelines, or struct members that follow them doing so, really detracts from these types of changes.Definitely something to look out for, though most of them should be per-dev structures and not in-flight structures. That makes it a bit less sensitive. But can't hurt to audit the layouts and adjust if necessary. This is why it's posted for review :-)
This isn't something that is easily caught upfront. Yes we can all be busy little beavers with pahole to audit alignment. But chances are most people won't do it.
Quoted 7 lines
Quoted 5 lines
Reality is there is potential for a regression due to false sharing to creep in if a hot struct member suddenly starts straddling a cacheline. That type of NUMA performance killer is pretty insidious and somewhat tedious to hunt down even when looking for it with specialized tools:
https://joemario.github.io/blog/2016/09/01/c2c-blog/IMHO you're making a big deal out of something that should not be.
I raised an issue that had seemingly not been considered at all. Not making a big deal. Raising it for others' benefit.
Quoted 10 lines
If the dm bits are that sensitive and cache line honed to perfection already due to previous regressions in that area, then it might not be a bad idea to have some compile checks for false cacheline sharing between sensitive members, or spilling of a sub-struct into multiple cachelines.
It's not like this was pushed behind your back. It's posted for review. It's quite possible the net change is a win for dm. Let's focus on getting it reviewed, rather than pontificate on what could potentially go all wrong with this.
Why are you making this personal? Or purely about DM? I'm merely pointing out this change isn't something that can be given a quick blanket "looks good".
Mike
Jens Axboe
maintainerQuoted 74 lines · Mike Snitzer
Quoted 54 lines · Jens Axboe
Quoted 53 lines · Mike Snitzer
Quoted 37 lines · Jens Axboe
Quoted 23 lines · Mike Snitzer
Quoted 14 lines · Jens Axboe
Quoted 13 lines · Mike Snitzer
Quoted 5 lines · Kent Overstreet
Jens - this series does the rest of the conversions that Christoph wanted, and drops
bioset_create().Only lightly tested, but the changes are pretty mechanical. Based on your for-next tree.
By switching '
mempool_t*' to 'mempool_t' and 'bio_set*' to 'bio_set' you've altered the alignment of members in data structures. So I'll need to audit all the data structures you've modified in DM.Quoted 5 lines
Quoted 3 lines
Could we get the backstory on _why_ you're making this change? Would go a long way to helping me appreciate why this is a good use of anyone's time.
Yeah, it's in the first series, it gets rid of a pointer indirection.
Quoted 8 lines
"Allows mempools to be embedded in other structs, getting rid of a pointer indirection from allocation fastpaths."
So this is about using contiguous memory or avoiding partial allocation failure? Or both?
Or more to it? Just trying to fully appreciate the theory behind the perceived associated benefit.
It's about avoiding a pointer indirection. Instead of having to follow a pointer to get to that struct, it's simple offset math off your main structure.
Quoted 8 lines
Quoted 3 lines
I do think the increased risk of these embedded
bio_setandmempool_tthemselves crossing cachelines, or struct members that follow them doing so, really detracts from these types of changes.Definitely something to look out for, though most of them should be per-dev structures and not in-flight structures. That makes it a bit less sensitive. But can't hurt to audit the layouts and adjust if necessary. This is why it's posted for review :-)
This isn't something that is easily caught upfront. Yes we can all be busy little beavers with pahole to audit alignment. But chances are most people won't do it.
Quoted 7 lines
Quoted 5 lines
Reality is there is potential for a regression due to false sharing to creep in if a hot struct member suddenly starts straddling a cacheline. That type of NUMA performance killer is pretty insidious and somewhat tedious to hunt down even when looking for it with specialized tools:
https://joemario.github.io/blog/2016/09/01/c2c-blog/IMHO you're making a big deal out of something that should not be.
I raised an issue that had seemingly not been considered at all. Not making a big deal. Raising it for others' benefit.
Quoted 6 lines
If the dm bits are that sensitive and cache line honed to perfection already due to previous regressions in that area, then it might not be a bad idea to have some compile checks for false cacheline sharing between sensitive members, or spilling of a sub-struct into multiple cachelines.
Quoted 8 lines
Quoted 4 lines
It's not like this was pushed behind your back. It's posted for review. It's quite possible the net change is a win for dm. Let's focus on getting it reviewed, rather than pontificate on what could potentially go all wrong with this.
Why are you making this personal? Or purely about DM? I'm merely pointing out this change isn't something that can be given a quick blanket "looks good".
I'm not making this personal at all?! You raised a (valid) concern, I'm merely stating why I don't think it's a high risk issue. I'm assuming your worry is related to dm, as those are the reports that would ultimately land on your desk.
Signature · 1 line
Jens Axboe
Quoted 14 lines · Jens Axboe
Quoted 13 lines · Mike Snitzer
Quoted 5 lines · Kent Overstreet
Jens - this series does the rest of the conversions that Christoph wanted, and drops
bioset_create().Only lightly tested, but the changes are pretty mechanical. Based on your for-next tree.
By switching '
mempool_t*' to 'mempool_t' and 'bio_set*' to 'bio_set' you've altered the alignment of members in data structures. So I'll need to audit all the data structures you've modified in DM.
Quoted 5 lines
Quoted 3 lines
Could we get the backstory on _why_ you're making this change? Would go a long way to helping me appreciate why this is a good use of anyone's time.
Yeah, it's in the first series, it gets rid of a pointer indirection.
This should to be also mentioned the changelog of each patch. There are 12 subsystems changed, this could be about 10 maintainers and I guess everybody has the same question why the change is made.
The conversion is not exactly the same in all patches, the simple pointer -> static variable can be possibly covered by the same generic text but as Mike points out the alignment changes should be at least mentioned for consideration otherwise.
Quoted 80 lines · Jens Axboe
Quoted 79 lines · Mike Snitzer
Quoted 54 lines · Jens Axboe
Quoted 53 lines · Mike Snitzer
Quoted 37 lines · Jens Axboe
Quoted 23 lines · Mike Snitzer
Quoted 14 lines · Jens Axboe
Quoted 13 lines · Mike Snitzer
Quoted 5 lines · Kent Overstreet
Jens - this series does the rest of the conversions that Christoph wanted, and drops
bioset_create().Only lightly tested, but the changes are pretty mechanical. Based on your for-next tree.
By switching '
mempool_t*' to 'mempool_t' and 'bio_set*' to 'bio_set' you've altered the alignment of members in data structures. So I'll need to audit all the data structures you've modified in DM.Quoted 5 lines
Quoted 3 lines
Could we get the backstory on _why_ you're making this change? Would go a long way to helping me appreciate why this is a good use of anyone's time.
Yeah, it's in the first series, it gets rid of a pointer indirection.
Quoted 8 lines
"Allows mempools to be embedded in other structs, getting rid of a pointer indirection from allocation fastpaths."
So this is about using contiguous memory or avoiding partial allocation failure? Or both?
Or more to it? Just trying to fully appreciate the theory behind the perceived associated benefit.
It's about avoiding a pointer indirection. Instead of having to follow a pointer to get to that struct, it's simple offset math off your main structure.
Quoted 8 lines
Quoted 3 lines
I do think the increased risk of these embedded
bio_setandmempool_tthemselves crossing cachelines, or struct members that follow them doing so, really detracts from these types of changes.Definitely something to look out for, though most of them should be per-dev structures and not in-flight structures. That makes it a bit less sensitive. But can't hurt to audit the layouts and adjust if necessary. This is why it's posted for review :-)
This isn't something that is easily caught upfront. Yes we can all be busy little beavers with pahole to audit alignment. But chances are most people won't do it.
Quoted 7 lines
Quoted 5 lines
Reality is there is potential for a regression due to false sharing to creep in if a hot struct member suddenly starts straddling a cacheline. That type of NUMA performance killer is pretty insidious and somewhat tedious to hunt down even when looking for it with specialized tools:
https://joemario.github.io/blog/2016/09/01/c2c-blog/IMHO you're making a big deal out of something that should not be.
I raised an issue that had seemingly not been considered at all. Not making a big deal. Raising it for others' benefit.
Quoted 10 lines
If the dm bits are that sensitive and cache line honed to perfection already due to previous regressions in that area, then it might not be a bad idea to have some compile checks for false cacheline sharing between sensitive members, or spilling of a sub-struct into multiple cachelines.
It's not like this was pushed behind your back. It's posted for review. It's quite possible the net change is a win for dm. Let's focus on getting it reviewed, rather than pontificate on what could potentially go all wrong with this.
Quoted 8 lines
Quoted 3 lines
Why are you making this personal? Or purely about DM? I'm merely pointing out this change isn't something that can be given a quick blanket "looks good".
I'm not making this personal at all?! You raised a (valid) concern, I'm merely stating why I don't think it's a high risk issue. I'm assuming your worry is related to dm, as those are the reports that would ultimately land on your desk.
Then we'll just agree to disagree with what this implies: "It's not like this was pushed behind your back."
Reality is I'm fine with the change. Just think there is follow-on work (now or later) that is needed.
Enough said.
Jens Axboe
maintainerQuoted 19 lines · David Sterba
Quoted 18 lines · Jens Axboe
Quoted 16 lines · Mike Snitzer
Quoted 5 lines · Kent Overstreet
Jens - this series does the rest of the conversions that Christoph wanted, and drops
bioset_create().Only lightly tested, but the changes are pretty mechanical. Based on your for-next tree.
By switching '
mempool_t*' to 'mempool_t' and 'bio_set*' to 'bio_set' you've altered the alignment of members in data structures. So I'll need to audit all the data structures you've modified in DM.Could we get the backstory on _why_ you're making this change? Would go a long way to helping me appreciate why this is a good use of anyone's time.
Quoted 5 lines
Quoted 1 line
Yeah, it's in the first series, it gets rid of a pointer indirection.
This should to be also mentioned the changelog of each patch. There are 12 subsystems changed, this could be about 10 maintainers and I guess everybody has the same question why the change is made.
Agree, the justification should be in this series as well, of course. Kent, might not be a bad idea to resend with a more descriptive cover letter.
Signature · 1 line
Jens Axboe
Jens Axboe
maintainerQuoted 87 lines · Mike Snitzer
Quoted 84 lines · Jens Axboe
Quoted 82 lines · Mike Snitzer
Quoted 54 lines · Jens Axboe
Quoted 53 lines · Mike Snitzer
Quoted 37 lines · Jens Axboe
Quoted 23 lines · Mike Snitzer
Quoted 14 lines · Jens Axboe
Quoted 13 lines · Mike Snitzer
Quoted 5 lines · Kent Overstreet
Jens - this series does the rest of the conversions that Christoph wanted, and drops
bioset_create().Only lightly tested, but the changes are pretty mechanical. Based on your for-next tree.
By switching '
mempool_t*' to 'mempool_t' and 'bio_set*' to 'bio_set' you've altered the alignment of members in data structures. So I'll need to audit all the data structures you've modified in DM.Quoted 5 lines
Quoted 3 lines
Could we get the backstory on _why_ you're making this change? Would go a long way to helping me appreciate why this is a good use of anyone's time.
Yeah, it's in the first series, it gets rid of a pointer indirection.
Quoted 8 lines
"Allows mempools to be embedded in other structs, getting rid of a pointer indirection from allocation fastpaths."
So this is about using contiguous memory or avoiding partial allocation failure? Or both?
Or more to it? Just trying to fully appreciate the theory behind the perceived associated benefit.
It's about avoiding a pointer indirection. Instead of having to follow a pointer to get to that struct, it's simple offset math off your main structure.
Quoted 8 lines
Quoted 3 lines
I do think the increased risk of these embedded
bio_setandmempool_tthemselves crossing cachelines, or struct members that follow them doing so, really detracts from these types of changes.Definitely something to look out for, though most of them should be per-dev structures and not in-flight structures. That makes it a bit less sensitive. But can't hurt to audit the layouts and adjust if necessary. This is why it's posted for review :-)
This isn't something that is easily caught upfront. Yes we can all be busy little beavers with pahole to audit alignment. But chances are most people won't do it.
Quoted 7 lines
Quoted 5 lines
Reality is there is potential for a regression due to false sharing to creep in if a hot struct member suddenly starts straddling a cacheline. That type of NUMA performance killer is pretty insidious and somewhat tedious to hunt down even when looking for it with specialized tools:
https://joemario.github.io/blog/2016/09/01/c2c-blog/IMHO you're making a big deal out of something that should not be.
I raised an issue that had seemingly not been considered at all. Not making a big deal. Raising it for others' benefit.
Quoted 10 lines
If the dm bits are that sensitive and cache line honed to perfection already due to previous regressions in that area, then it might not be a bad idea to have some compile checks for false cacheline sharing between sensitive members, or spilling of a sub-struct into multiple cachelines.
It's not like this was pushed behind your back. It's posted for review. It's quite possible the net change is a win for dm. Let's focus on getting it reviewed, rather than pontificate on what could potentially go all wrong with this.
Why are you making this personal? Or purely about DM? I'm merely pointing out this change isn't something that can be given a quick blanket "looks good".
Quoted 7 lines
Quoted 4 lines
I'm not making this personal at all?! You raised a (valid) concern, I'm merely stating why I don't think it's a high risk issue. I'm assuming your worry is related to dm, as those are the reports that would ultimately land on your desk.
Then we'll just agree to disagree with what this implies: "It's not like this was pushed behind your back."
I'm afraid you've lost me now - it was not pushed behind your back, it was posted for review, with you on the CC list. Not trying to be deliberately dense here, I just don't see what our disagreement is.
Quoted 2 lines
Reality is I'm fine with the change. Just think there is follow-on work (now or later) that is needed.
It's not hard to run the quick struct layout checks or alignment. If there's a concern, that should be done now, instead of being deferred to later. There's no point merging something that we expect to have follow-on work. If that's the case, then it should not be merged. There are no dependencies in the patchset, except that the last patch obviously can't be applied until all of the previous ones are in.
I took a quick look at the struct mapped_device layout, which I'm assuming is the most important on the dm side. It's pretty big to begin with, obviously this makes it bigger since we're now embedding the bio_sets. On my config, doesn't show any false sharing that would be problematic, or layout changes that would worry me. FWIW.
Signature · 1 line
Jens Axboe
Quoted 8 lines · Jens Axboe
Quoted 7 lines · Mike Snitzer
Quoted 4 lines · Jens Axboe
Quoted 3 lines · Mike Snitzer
On Mon, May 21 2018 at 10:52am -0400,
Jens Axboe <[email protected]> wrote:
...
Quoted 25 lines
Quoted 25 lines
Quoted 24 lines
Quoted 11 lines
Quoted 1 line
IMHO you're making a big deal out of something that should not be.
I raised an issue that had seemingly not been considered at all. Not making a big deal. Raising it for others' benefit.
Quoted 6 lines
If the dm bits are that sensitive and cache line honed to perfection already due to previous regressions in that area, then it might not be a bad idea to have some compile checks for false cacheline sharing between sensitive members, or spilling of a sub-struct into multiple cachelines.
Quoted 8 lines
Quoted 4 lines
It's not like this was pushed behind your back. It's posted for review. It's quite possible the net change is a win for dm. Let's focus on getting it reviewed, rather than pontificate on what could potentially go all wrong with this.
Why are you making this personal? Or purely about DM? I'm merely pointing out this change isn't something that can be given a quick blanket "looks good".
I'm not making this personal at all?! You raised a (valid) concern, I'm merely stating why I don't think it's a high risk issue. I'm assuming your worry is related to dm, as those are the reports that would ultimately land on your desk.
Quoted 6 lines
Quoted 2 lines
Then we'll just agree to disagree with what this implies: "It's not like this was pushed behind your back."
I'm afraid you've lost me now - it was not pushed behind your back, it was posted for review, with you on the CC list. Not trying to be deliberately dense here, I just don't see what our disagreement is.
You're having an off day ;) Mondays and all?
I just raised an alignment concern that needs to be considered during review by all stakeholders. Wasn't upset at all. Maybe my email tone came off otherwise?
And then you got confused by me pointing out how it was weird for you to suggest I felt this stuff was pushed behind my back.. and went on to think I really think that. It's almost like you're a confused hypnotist seeding me with paranoid dilutions. ;)
/me waits for Jens to snap his fingers so he can just slowly step away from this line of discussion that is solidly dead now...
Quoted 9 lines
Quoted 2 lines
Reality is I'm fine with the change. Just think there is follow-on work (now or later) that is needed.
It's not hard to run the quick struct layout checks or alignment. If there's a concern, that should be done now, instead of being deferred to later. There's no point merging something that we expect to have follow-on work. If that's the case, then it should not be merged. There are no dependencies in the patchset, except that the last patch obviously can't be applied until all of the previous ones are in.
Cool, sounds good.
Quoted 5 lines
I took a quick look at the struct
mapped_devicelayout, which I'm assuming is the most important on the dm side. It's pretty big to begin with, obviously this makes it bigger since we're now embedding thebio_sets. On my config, doesn't show any false sharing that would be problematic, or layout changes that would worry me. FWIW.
Great, thanks, do you happen to have a tree you can push so others can get a quick compile and look at the series fully applied?
BTW, I'm upstream DM maintainer but I have a role in caring for related subsystems (e.g. block core, etc) in downstream releases.. *cough* RHEL. So this alignment concern wasn't ever purely about DM.
Mike
Jens Axboe
maintainerQuoted 50 lines · Mike Snitzer
Quoted 8 lines · Jens Axboe
Quoted 7 lines · Mike Snitzer
Quoted 4 lines · Jens Axboe
Quoted 3 lines · Mike Snitzer
On Mon, May 21 2018 at 10:52am -0400,
Jens Axboe <[email protected]> wrote:...
Quoted 25 lines
Quoted 25 lines
Quoted 24 lines
Quoted 11 lines
Quoted 1 line
IMHO you're making a big deal out of something that should not be.
I raised an issue that had seemingly not been considered at all. Not making a big deal. Raising it for others' benefit.
Quoted 6 lines
If the dm bits are that sensitive and cache line honed to perfection already due to previous regressions in that area, then it might not be a bad idea to have some compile checks for false cacheline sharing between sensitive members, or spilling of a sub-struct into multiple cachelines.
Quoted 8 lines
Quoted 4 lines
It's not like this was pushed behind your back. It's posted for review. It's quite possible the net change is a win for dm. Let's focus on getting it reviewed, rather than pontificate on what could potentially go all wrong with this.
Why are you making this personal? Or purely about DM? I'm merely pointing out this change isn't something that can be given a quick blanket "looks good".
I'm not making this personal at all?! You raised a (valid) concern, I'm merely stating why I don't think it's a high risk issue. I'm assuming your worry is related to dm, as those are the reports that would ultimately land on your desk.
Quoted 6 lines
Quoted 2 lines
Then we'll just agree to disagree with what this implies: "It's not like this was pushed behind your back."
I'm afraid you've lost me now - it was not pushed behind your back, it was posted for review, with you on the CC list. Not trying to be deliberately dense here, I just don't see what our disagreement is.
You're having an off day ;) Mondays and all?
I just raised an alignment concern that needs to be considered during review by all stakeholders. Wasn't upset at all. Maybe my email tone came off otherwise?
Quoted 7 lines
And then you got confused by me pointing out how it was weird for you to suggest I felt this stuff was pushed behind my back.. and went on to think I really think that. It's almost like you're a confused hypnotist seeding me with paranoid dilutions. ;)
/me waits for Jens to snap his fingers so he can just slowly step away from this line of discussion that is solidly dead now...
Mike, wtf are you talking about.
Quoted 12 lines
Quoted 9 lines
Quoted 2 lines
Reality is I'm fine with the change. Just think there is follow-on work (now or later) that is needed.
It's not hard to run the quick struct layout checks or alignment. If there's a concern, that should be done now, instead of being deferred to later. There's no point merging something that we expect to have follow-on work. If that's the case, then it should not be merged. There are no dependencies in the patchset, except that the last patch obviously can't be applied until all of the previous ones are in.
Cool, sounds good.
Quoted 8 lines
Quoted 5 lines
I took a quick look at the struct
mapped_devicelayout, which I'm assuming is the most important on the dm side. It's pretty big to begin with, obviously this makes it bigger since we're now embedding thebio_sets. On my config, doesn't show any false sharing that would be problematic, or layout changes that would worry me. FWIW.Great, thanks, do you happen to have a tree you can push so others can get a quick compile and look at the series fully applied?
I do not, I simply ran a quick analysis of the layout, then applied the full patchset, and repeated that exercise. Literally a 5 minute thing. I haven't applied the series, so haven't pushed anything out.
Quoted 3 lines
BTW, I'm upstream DM maintainer but I have a role in caring for related subsystems (e.g. block core, etc) in downstream releases.. *cough* RHEL. So this alignment concern wasn't ever purely about DM.
I tend to care about that too...
Signature · 1 line
Jens Axboe
Quoted 46 lines · Mike Snitzer
Quoted 8 lines · Jens Axboe
Quoted 7 lines · Mike Snitzer
Quoted 4 lines · Jens Axboe
Quoted 3 lines · Mike Snitzer
On Mon, May 21 2018 at 10:52am -0400,
Jens Axboe <[email protected]> wrote:...
Quoted 25 lines
Quoted 25 lines
Quoted 24 lines
Quoted 11 lines
Quoted 1 line
IMHO you're making a big deal out of something that should not be.
I raised an issue that had seemingly not been considered at all. Not making a big deal. Raising it for others' benefit.
Quoted 6 lines
If the dm bits are that sensitive and cache line honed to perfection already due to previous regressions in that area, then it might not be a bad idea to have some compile checks for false cacheline sharing between sensitive members, or spilling of a sub-struct into multiple cachelines.
Quoted 8 lines
Quoted 4 lines
It's not like this was pushed behind your back. It's posted for review. It's quite possible the net change is a win for dm. Let's focus on getting it reviewed, rather than pontificate on what could potentially go all wrong with this.
Why are you making this personal? Or purely about DM? I'm merely pointing out this change isn't something that can be given a quick blanket "looks good".
I'm not making this personal at all?! You raised a (valid) concern, I'm merely stating why I don't think it's a high risk issue. I'm assuming your worry is related to dm, as those are the reports that would ultimately land on your desk.
Quoted 6 lines
Quoted 2 lines
Then we'll just agree to disagree with what this implies: "It's not like this was pushed behind your back."
I'm afraid you've lost me now - it was not pushed behind your back, it was posted for review, with you on the CC list. Not trying to be deliberately dense here, I just don't see what our disagreement is.
You're having an off day ;) Mondays and all?
Quoted 8 lines
I just raised an alignment concern that needs to be considered during review by all stakeholders. Wasn't upset at all. Maybe my email tone came off otherwise?
And then you got confused by me pointing out how it was weird for you to suggest I felt this stuff was pushed behind my back.. and went on to think I really think that. It's almost like you're a confused hypnotist seeding me with paranoid dilutions. ;)
Uh, you came across as upset and paranoid to me too. Chalk it up to email? :)
I personally don't care, I have no horse in this race. This particular patch series wasn't my idea, Christoph wanted all these conversions done so bioset_create() could be deleted. If you want us to hold off on the dm patch for awhile until someone can get around to testing it or whatever (since I don't have tests for everything I pushed) that would be perfectly fine by me.
Quoted 2 lines · Kent Overstreet
Uh, you came across as upset and paranoid to me too. Chalk it up to email? :)
Awesome. See how easy it is to make someone with purely constructive questions and feedback come off as upset and paranoid?
The tipping point occurs when bait is set with:
"It's not like <insert complete non sequitur>".
Then:
"Let's focus on getting it reviewed, rather than pontificate on what could potentially go all wrong with this."
Message received: less pontificating, more doing!
And here I thought that focusing on what could go wrong (across all code touched) was review. But OK, I'm the one that made this all weird ;)
It is what it is at this point.
Quoted 5 lines
I personally don't care, I have no horse in this race. This particular patch series wasn't my idea, Christoph wanted all these conversions done so
bioset_create()could be deleted. If you want us to hold off on the dm patch for awhile until someone can get around to testing it or whatever (since I don't have tests for everything I pushed) that would be perfectly fine by me.
As I clarified already: this isn't about DM.
Every single data structure change in this series should be reviewed for unforeseen alignment consequences. Jens seemed to say that is worthwhile. Not sure if he'll do it or we divide it up. If we divide it up a temp topic branch should be published for others to inspect.
Could be alignment hasn't been a historic concern for a bunch of the data structures changed in this series.. if so then all we can do is fix up any obvious potential for false sharing.
Mike
Re: [PATCH 11/12] xfs: convert to bioset_init()/mempool_init()
In reply to Kent OverstreetQuoted 1 line · Kent Overstreet
Signed-off-by Kent Overstreet <[email protected]>
Looks ok, I guess...
--D
Quoted 83 lines
--- fs/xfs/xfs_aops.c | 2 +- fs/xfs/xfs_aops.h | 2 +- fs/xfs/xfs_super.c | 11 +++++------ 3 files changed, 7 insertions(+), 8 deletions(-)fs/xfs/xfs_aops.c +1
-1@@ -594,7 +594,7 @@ xfs_alloc_ioend(struct xfs_ioend *ioend;struct bio *bio; - bio =bio_alloc_bioset (GFP_NOFS ,BIO_MAX_PAGES , xfs_ioend_bioset); + bio =bio_alloc_bioset (GFP_NOFS ,BIO_MAX_PAGES , &xfs_ioend_bioset);xfs_init_bio_from_bh (bio, bh); ioend = container_of(bio, struct xfs_ioend, io_inline_bio);fs/xfs/xfs_aops.h +1
-1@@ -18,7 +18,7 @@#ifndef __XFS_AOPS_H__#define __XFS_AOPS_H__ -extern struct bio_set *xfs_ioend_bioset; +extern struct bio_set xfs_ioend_bioset;/* * Types of I/O for bmap clustering and I/O completion tracking. fs/xfs/xfs_super.c +5
-6@@ -63,7 +63,7 @@#include <linux/parser.h> static const struct super_operations xfs_super_operations; -struct bio_set *xfs_ioend_bioset; +struct bio_set xfs_ioend_bioset;static struct kset *xfs_kset;/* top-level xfs sysfs dir */ #ifdef DEBUG @@ -1845,10 +1845,9 @@ MODULE_ALIAS_FS("xfs"); STATIC int __initxfs_init_zones (void ) { - xfs_ioend_bioset =bioset_create (4 *MAX_BUF_PER_PAGE , +if (bioset_init (&xfs_ioend_bioset,4 *MAX_BUF_PER_PAGE , offsetof(struct xfs_ioend , io_inline_bio), -BIOSET_NEED_BVECS ); -if (!xfs_ioend_bioset) +BIOSET_NEED_BVECS )) goto out; xfs_log_ticket_zone = kmem_zone_init(sizeof(xlog_ticket_t),@@ -1997,7 +1996,7 @@ xfs_init_zones(void) out_destroy_log_ticket_zone:kmem_zone_destroy (xfs_log_ticket_zone); out_free_ioend_bioset: -bioset_free (xfs_ioend_bioset); +bioset_exit (&xfs_ioend_bioset); out:return -ENOMEM ; }@@ -2029,7 +2028,7 @@ xfs_destroy_zones(void)kmem_zone_destroy (xfs_btree_cur_zone);kmem_zone_destroy (xfs_bmap_free_item_zone);kmem_zone_destroy (xfs_log_ticket_zone); -bioset_free (xfs_ioend_bioset); +bioset_exit (&xfs_ioend_bioset); }STATIC int__init Signature · 6 lines
2.17.0 -- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 8 lines · Mike Snitzer
Every single data structure change in this series should be reviewed for unforeseen alignment consequences. Jens seemed to say that is worthwhile. Not sure if he'll do it or we divide it up. If we divide it up a temp topic branch should be published for others to inspect.
Could be alignment hasn't been a historic concern for a bunch of the data structures changed in this series.. if so then all we can do is fix up any obvious potential for false sharing.
Honestly, I almost never worry about alignment... the very few times I do care, I use __cacheline_aligned_in_smp.
If alignment is a concern in any of those structs, there really ought to be a comment indicating it. I very much doubt anything I touched was performance sensitive enough for it to be an issue, though. And if there is a performance impact, it should be oughtweighed by the reduced pointer chasing.
If you disagree, I don't mind leaving the device mapper patch out, it really makes no difference to me. I could glance over for alignment issues but I feel like my analysis would not be terribly valuable to you considering I've already said my position on alignment is "meh, don't care" :)
Quoted 6 lines · Kent Overstreet
Quoted 5 lines · Mike Snitzer
Every single data structure change in this series should be reviewed for unforeseen alignment consequences. Jens seemed to say that is worthwhile. Not sure if he'll do it or we divide it up. If we divide it up a temp topic branch should be published for others to inspect.
Quoted 6 lines
Quoted 3 lines
Could be alignment hasn't been a historic concern for a bunch of the data structures changed in this series.. if so then all we can do is fix up any obvious potential for false sharing.
Honestly, I almost never worry about alignment... the very few times I do care, I use
__cacheline_aligned_in_smp.
And that generally is the right stratgey. If Mike really doesn't want a change we can just open code the kmalloc for the bio set there, the important point is that we should not keep the old API around for no good reason.
Re: [PATCH 01/12] block: convert bounce, q->bio_split to bioset_init()/mempool_init()
In reply to Kent OverstreetLooks good,
Re: [PATCH 08/12] target: convert to bioset_init()/mempool_init()
In reply to Kent OverstreetLooks good,
Re: [PATCH 09/12] fs: convert block_dev.c to bioset_init()
In reply to Kent OverstreetLooks good,
Re: [PATCH 04/12] lightnvm: convert to bioset_init()/mempool_init()
In reply to Kent OverstreetQuoted 378 lines · Kent Overstreet
Signed-off-by Kent Overstreet <[email protected]>---
drivers/lightnvm/pblk-core.c | 30 ++++++------- drivers/lightnvm/pblk-init.c | 72 ++++++++++++++++---------------- drivers/lightnvm/pblk-read.c | 4 +- drivers/lightnvm/pblk-recovery.c | 2 +- drivers/lightnvm/pblk-write.c | 8 ++-- drivers/lightnvm/pblk.h | 14 +++---- 6 files changed, 65 insertions(+), 65 deletions(-)drivers/lightnvm/pblk-core.c +15
-15@@ -40,7 +40,7 @@ static void pblk_line_mark_bb(struct work_struct *work) }kfree (ppa); -mempool_free (line_ws, pblk->gen_ws_pool); +mempool_free (line_ws, &pblk->gen_ws_pool); } static void pblk_mark_bb(struct pblk *pblk, struct pblk_line *line,@@ -102,7 +102,7 @@ static void pblk_end_io_erase(struct nvm_rq *rqd)struct pblk *pblk = rqd->private;__pblk_end_io_erase (pblk, rqd); -mempool_free (rqd, pblk->e_rq_pool); +mempool_free (rqd, &pblk->e_rq_pool); }/* @@ -237,15 +237,15 @@ struct nvm_rq *pblk_alloc_rqd(struct pblk *pblk, int type)switch (type) {case PBLK_WRITE :case PBLK_WRITE_INT : - pool = pblk->w_rq_pool; + pool = &pblk->w_rq_pool; rq_size = pblk_w_rq_size;break ;case PBLK_READ : - pool = pblk->r_rq_pool; + pool = &pblk->r_rq_pool; rq_size = pblk_g_rq_size;break ;default : - pool = pblk->e_rq_pool; + pool = &pblk->e_rq_pool; rq_size = pblk_g_rq_size; }@@ -265,13 +265,13 @@ void pblk_free_rqd(struct pblk *pblk, struct nvm_rq *rqd, int type)case PBLK_WRITE :kfree (((struct pblk_c_ctx *)nvm_rq_to_pdu (rqd))->lun_bitmap);case PBLK_WRITE_INT : - pool = pblk->w_rq_pool; + pool = &pblk->w_rq_pool;break ;case PBLK_READ : - pool = pblk->r_rq_pool; + pool = &pblk->r_rq_pool;break ;case PBLK_ERASE : - pool = pblk->e_rq_pool; + pool = &pblk->e_rq_pool;break ;default :pr_err ("pblk: trying to free unknown rqd type\n" );@@ -292,7 +292,7 @@ void pblk_bio_free_pages(struct pblk *pblk, struct bio *bio, int off,for (i = off; i < nr_pages + off; i++) { bv = bio->bi_io_vec[i]; -mempool_free (bv.bv_page, pblk->page_bio_pool); +mempool_free (bv.bv_page, &pblk->page_bio_pool); } }@@ -304,12 +304,12 @@ int pblk_bio_add_pages(struct pblk *pblk, struct bio *bio, gfp_t flags,int i, ret;for (i =0 ; i < nr_pages; i++) { - page =mempool_alloc (pblk->page_bio_pool, flags); + page =mempool_alloc (&pblk->page_bio_pool, flags); ret =bio_add_pc_page (q, bio, page,PBLK_EXPOSED_PAGE_SIZE ,0 );if (ret !=PBLK_EXPOSED_PAGE_SIZE ) {pr_err ("pblk: could not add page to bio\n" ); -mempool_free (page, pblk->page_bio_pool); +mempool_free (page, &pblk->page_bio_pool); goto err; } }@@ -1593,7 +1593,7 @@ static void pblk_line_put_ws(struct work_struct *work)struct pblk_line *line = line_put_ws->line;__pblk_line_put (pblk, line); -mempool_free (line_put_ws, pblk->gen_ws_pool); +mempool_free (line_put_ws, &pblk->gen_ws_pool); }void pblk_line_put (struct kref *ref)@@ -1610,7 +1610,7 @@ void pblk_line_put_wq(struct kref *ref)struct pblk *pblk = line->pblk;struct pblk_line_ws *line_put_ws; - line_put_ws =mempool_alloc (pblk->gen_ws_pool,GFP_ATOMIC ); + line_put_ws =mempool_alloc (&pblk->gen_ws_pool,GFP_ATOMIC );if (!line_put_ws)return ;@@ -1752,7 +1752,7 @@ void pblk_line_close_ws(struct work_struct *work)struct pblk_line *line = line_ws->line;pblk_line_close (pblk, line); -mempool_free (line_ws, pblk->gen_ws_pool); +mempool_free (line_ws, &pblk->gen_ws_pool); } void pblk_gen_run_ws(struct pblk *pblk, struct pblk_line *line, void *priv,@@ -1761,7 +1761,7 @@ void pblk_gen_run_ws(struct pblk *pblk, struct pblk_line *line, void *priv, {struct pblk_line_ws *line_ws; - line_ws =mempool_alloc (pblk->gen_ws_pool, gfp_mask); + line_ws =mempool_alloc (&pblk->gen_ws_pool, gfp_mask); line_ws->pblk = pblk; line_ws->line = line;drivers/lightnvm/pblk-init.c +19
-19@@ -23,7 +23,7 @@static struct kmem_cache *pblk_ws_cache, *pblk_rec_cache, *pblk_g_rq_cache, *pblk_w_rq_cache;static DECLARE_RWSEM (pblk_lock); -struct bio_set *pblk_bio_set; +struct bio_set pblk_bio_set;static int pblk_rw_io (struct request_queue *q,struct pblk *pblk,struct bio *bio)@@ -341,7 +341,7 @@ static int pblk_core_init(struct pblk *pblk) {struct nvm_tgt_dev *dev = pblk->dev;struct nvm_geo *geo = &dev->geo; -int max_write_ppas; +int ret, max_write_ppas;atomic64_set (&pblk->user_wa,0 );atomic64_set (&pblk->pad_wa,0 );@@ -375,33 +375,33 @@ static int pblk_core_init(struct pblk *pblk) goto fail_free_pad_dist;/* Internal bios can be at most the sectors signaled by the device. */ - pblk->page_bio_pool =mempool_create_page_pool (NVM_MAX_VLBA ,0 ); -if (!pblk->page_bio_pool) + ret =mempool_init_page_pool (&pblk->page_bio_pool,NVM_MAX_VLBA ,0 ); +if (ret) goto free_global_caches; - pblk->gen_ws_pool =mempool_create_slab_pool (PBLK_GEN_WS_POOL_SIZE , - pblk_ws_cache); -if (!pblk->gen_ws_pool) + ret =mempool_init_slab_pool (&pblk->gen_ws_pool,PBLK_GEN_WS_POOL_SIZE , + pblk_ws_cache); +if (ret) goto free_page_bio_pool; - pblk->rec_pool =mempool_create_slab_pool (geo->all_luns, - pblk_rec_cache); -if (!pblk->rec_pool) + ret =mempool_init_slab_pool (&pblk->rec_pool, geo->all_luns, + pblk_rec_cache); +if (ret) goto free_gen_ws_pool; - pblk->r_rq_pool =mempool_create_slab_pool (geo->all_luns, - pblk_g_rq_cache); -if (!pblk->r_rq_pool) + ret =mempool_init_slab_pool (&pblk->r_rq_pool, geo->all_luns, + pblk_g_rq_cache); +if (ret) goto free_rec_pool; - pblk->e_rq_pool =mempool_create_slab_pool (geo->all_luns, - pblk_g_rq_cache); -if (!pblk->e_rq_pool) + ret =mempool_init_slab_pool (&pblk->e_rq_pool, geo->all_luns, + pblk_g_rq_cache); +if (ret) goto free_r_rq_pool; - pblk->w_rq_pool =mempool_create_slab_pool (geo->all_luns, - pblk_w_rq_cache); -if (!pblk->w_rq_pool) + ret =mempool_init_slab_pool (&pblk->w_rq_pool, geo->all_luns, + pblk_w_rq_cache); +if (ret) goto free_e_rq_pool; pblk->close_wq = alloc_workqueue("pblk-close-wq",@@ -433,17 +433,17 @@ static int pblk_core_init(struct pblk *pblk)
free_close_wq:destroy_workqueue(pblk->close_wq);
free_w_rq_pool:drivers/lightnvm/pblk-init.c +1
-1-mempool_destroy (pblk->w_rq_pool); +mempool_exit (&pblk->w_rq_pool);
free_e_rq_pool:drivers/lightnvm/pblk-init.c +1
-1-mempool_destroy (pblk->e_rq_pool); +mempool_exit (&pblk->e_rq_pool);
free_r_rq_pool:drivers/lightnvm/pblk-init.c +1
-1-mempool_destroy (pblk->r_rq_pool); +mempool_exit (&pblk->r_rq_pool);
free_rec_pool:drivers/lightnvm/pblk-init.c +1
-1-mempool_destroy (pblk->rec_pool); +mempool_exit (&pblk->rec_pool);
free_gen_ws_pool:drivers/lightnvm/pblk-init.c +1
-1-mempool_destroy (pblk->gen_ws_pool); +mempool_exit (&pblk->gen_ws_pool);
free_page_bio_pool:drivers/lightnvm/pblk-init.c +1
-1-mempool_destroy (pblk->page_bio_pool); +mempool_exit (&pblk->page_bio_pool);
free_global_caches:pblk_free_global_caches(pblk);
fail_free_pad_dist:drivers/lightnvm/pblk-init.c +11
-11@@ -462,12 +462,12 @@ static void pblk_core_free(struct pblk *pblk)if (pblk->bb_wq)destroy_workqueue (pblk->bb_wq); -mempool_destroy (pblk->page_bio_pool); -mempool_destroy (pblk->gen_ws_pool); -mempool_destroy (pblk->rec_pool); -mempool_destroy (pblk->r_rq_pool); -mempool_destroy (pblk->e_rq_pool); -mempool_destroy (pblk->w_rq_pool); +mempool_exit (&pblk->page_bio_pool); +mempool_exit (&pblk->gen_ws_pool); +mempool_exit (&pblk->rec_pool); +mempool_exit (&pblk->r_rq_pool); +mempool_exit (&pblk->e_rq_pool); +mempool_exit (&pblk->w_rq_pool);pblk_free_global_caches (pblk);kfree (pblk->pad_dist);@@ -1297,18 +1297,18 @@ static int __init pblk_module_init(void) {int ret; - pblk_bio_set =bioset_create (BIO_POOL_SIZE ,0 ,0 ); -if (!pblk_bio_set) -return -ENOMEM ; + ret =bioset_init (&pblk_bio_set,BIO_POOL_SIZE ,0 ,0 ); +if (ret) +return ret; ret =nvm_register_tgt_type (&tt_pblk);if (ret) -bioset_free (pblk_bio_set); +bioset_exit (&pblk_bio_set);return ret; }static void pblk_module_exit (void ) { -bioset_free (pblk_bio_set); +bioset_exit (&pblk_bio_set);nvm_unregister_tgt_type (&tt_pblk); }drivers/lightnvm/pblk-read.c +2
-2@@ -294,7 +294,7 @@ static int pblk_partial_read_bio(struct pblk *pblk, struct nvm_rq *rqd,kunmap_atomic (src_p);kunmap_atomic (dst_p); -mempool_free (src_bv.bv_page, pblk->page_bio_pool); +mempool_free (src_bv.bv_page, &pblk->page_bio_pool); hole =find_next_zero_bit (read_bitmap, nr_secs, hole +1 ); }while (hole < nr_secs);@@ -429,7 +429,7 @@ int pblk_submit_read(struct pblk *pblk, struct bio *bio)struct bio *int_bio =NULL ;/* Clone read bio to deal with read errors internally */ - int_bio =bio_clone_fast (bio,GFP_KERNEL , pblk_bio_set); + int_bio =bio_clone_fast (bio,GFP_KERNEL , &pblk_bio_set);if (!int_bio) {pr_err ("pblk: could not clone read bio\n" ); goto fail_end_io;drivers/lightnvm/pblk-recovery.c +1
-1@@ -60,7 +60,7 @@ void pblk_submit_rec(struct work_struct *work) goto err; } -mempool_free (recovery, pblk->rec_pool); +mempool_free (recovery, &pblk->rec_pool);return ;err:
drivers/lightnvm/pblk-write.c +4
-4@@ -122,7 +122,7 @@ static void pblk_end_w_fail(struct pblk *pblk, struct nvm_rq *rqd)if (unlikely (nr_ppas ==1 )) ppa_list = &rqd->ppa_addr; - recovery =mempool_alloc (pblk->rec_pool,GFP_ATOMIC ); + recovery =mempool_alloc (&pblk->rec_pool,GFP_ATOMIC );INIT_LIST_HEAD (&recovery->failed);@@ -134,7 +134,7 @@ static void pblk_end_w_fail(struct pblk *pblk, struct nvm_rq *rqd)/* Logic error */ if (bit > c_ctx->nr_valid) {WARN_ONCE (1 ,"pblk: corrupted write request\n" ); -mempool_free (recovery, pblk->rec_pool); +mempool_free (recovery, &pblk->rec_pool); goto out; }@@ -142,7 +142,7 @@ static void pblk_end_w_fail(struct pblk *pblk, struct nvm_rq *rqd) entry =pblk_rb_sync_scan_entry (&pblk->rwb, &ppa);if (!entry) {pr_err ("pblk: could not scan entry on write failure\n" ); -mempool_free (recovery, pblk->rec_pool); +mempool_free (recovery, &pblk->rec_pool); goto out; }@@ -156,7 +156,7 @@ static void pblk_end_w_fail(struct pblk *pblk, struct nvm_rq *rqd) ret =pblk_recov_setup_rq (pblk, c_ctx, recovery, comp_bits, c_entries);if (ret) {pr_err ("pblk: could not recover from write failure\n" ); -mempool_free (recovery, pblk->rec_pool); +mempool_free (recovery, &pblk->rec_pool); goto out; }drivers/lightnvm/pblk.h +7
-8@@ -664,12 +664,12 @@ struct pblk {struct list_head compl_list; -mempool_t *page_bio_pool; -mempool_t *gen_ws_pool; -mempool_t *rec_pool; -mempool_t *r_rq_pool; -mempool_t *w_rq_pool; -mempool_t *e_rq_pool; +mempool_t page_bio_pool; +mempool_t gen_ws_pool; +mempool_t rec_pool; +mempool_t r_rq_pool; +mempool_t w_rq_pool; +mempool_t e_rq_pool;struct workqueue_struct *close_wq;struct workqueue_struct *bb_wq;@@ -841,7 +841,7 @@ void pblk_write_should_kick(struct pblk *pblk);/* * pblk read path */ -extern struct bio_set *pblk_bio_set; +extern struct bio_set pblk_bio_set;int pblk_submit_read (struct pblk *pblk,struct bio *bio);int pblk_submit_read_gc (struct pblk *pblk,struct pblk_gc_rq *gc_rq);/* --
Quoted 1 line
2.17.0
Looks like two patches in one, but the changes look good to me as part of the series.
checkpatch complains on a couple of patches in the series. Nothing big, but you probably want to have a look.
Re: [PATCH 11/12] xfs: convert to bioset_init()/mempool_init()
In reply to Kent OverstreetThis creates a minor conflict with my iomap series, but that should be easy to merge if needed.
Otherwise looks good:
Re: [PATCH 12/12] block: Drop bioset_create()
In reply to Kent OverstreetLooks good,
Quoted 11 lines · Christoph Hellwig
Quoted 10 lines · Kent Overstreet
Quoted 8 lines · Mike Snitzer
Every single data structure change in this series should be reviewed for unforeseen alignment consequences. Jens seemed to say that is worthwhile. Not sure if he'll do it or we divide it up. If we divide it up a temp topic branch should be published for others to inspect.
Could be alignment hasn't been a historic concern for a bunch of the data structures changed in this series.. if so then all we can do is fix up any obvious potential for false sharing.
Quoted 7 lines
Quoted 2 lines
Honestly, I almost never worry about alignment... the very few times I do care, I use
__cacheline_aligned_in_smp.And that generally is the right stratgey. If Mike really doesn't want a change we can just open code the kmalloc for the bio set there, the important point is that we should not keep the old API around for no good reason.
Again, I never said I didn't want these changes. I just thought it worthwhile to mention the potential for alignment quirks arising.
Reality is false sharing is quite uncommon. So my concern was/is pretty niche and unlikely to be applicable.
That said, I did take the opportunity to look at all the DM structures that were modified. The bio_set and mempool_t structs are so large that they span multiple cachelines as is. So I focused on eliminating unnecessary spanning of cachelines (by non-bio_set and non-mempool_t members) and eliminated most holes in DM structs. This is the result:
http://people.redhat.com/msnitzer/dm-4.18-struct-reorg/
Compare before.txt vs after_kent.txt vs after_mike.txt
Nothing staggering or special. Just something I'll add once Kent's latest changes land.
But, I also eliminated 2 4-byte holes in struct bio_set, Jens please feel free to pick this up (if you think it useful):
From: Mike Snitzer <[email protected]>
Subject: [PATCH] block: eliminate 2 4-byte holes in bio_set structure
--- include/linux/bio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/bio.h +1 -1
@@ -735,7 +735,6 @@ static inline void bio_inc_remaining(struct bio *bio)struct bio_set {struct kmem_cache *bio_slab; -unsigned int front_pad;mempool_t bio_pool;mempool_t bvec_pool;
@@ -743,6 +742,7 @@ struct bio_set {mempool_t bio_integrity_pool;mempool_t bvec_integrity_pool;#endif +unsigned int front_pad;/* * Deadlock avoidance for stacking block drivers: see comments in
Quoted 56 lines · Jens Axboe
Quoted 55 lines · Mike Snitzer
Quoted 8 lines · Jens Axboe
Quoted 7 lines · Mike Snitzer
Quoted 4 lines · Jens Axboe
Quoted 3 lines · Mike Snitzer
On Mon, May 21 2018 at 10:52am -0400,
Jens Axboe <[email protected]> wrote:...
Quoted 25 lines
Quoted 25 lines
Quoted 24 lines
Quoted 11 lines
Quoted 1 line
IMHO you're making a big deal out of something that should not be.
I raised an issue that had seemingly not been considered at all. Not making a big deal. Raising it for others' benefit.
Quoted 6 lines
If the dm bits are that sensitive and cache line honed to perfection already due to previous regressions in that area, then it might not be a bad idea to have some compile checks for false cacheline sharing between sensitive members, or spilling of a sub-struct into multiple cachelines.
Quoted 8 lines
Quoted 4 lines
It's not like this was pushed behind your back. It's posted for review. It's quite possible the net change is a win for dm. Let's focus on getting it reviewed, rather than pontificate on what could potentially go all wrong with this.
Why are you making this personal? Or purely about DM? I'm merely pointing out this change isn't something that can be given a quick blanket "looks good".
I'm not making this personal at all?! You raised a (valid) concern, I'm merely stating why I don't think it's a high risk issue. I'm assuming your worry is related to dm, as those are the reports that would ultimately land on your desk.
Quoted 6 lines
Quoted 2 lines
Then we'll just agree to disagree with what this implies: "It's not like this was pushed behind your back."
I'm afraid you've lost me now - it was not pushed behind your back, it was posted for review, with you on the CC list. Not trying to be deliberately dense here, I just don't see what our disagreement is.
You're having an off day ;) Mondays and all?
I just raised an alignment concern that needs to be considered during review by all stakeholders. Wasn't upset at all. Maybe my email tone came off otherwise?
And then you got confused by me pointing out how it was weird for you to suggest I felt this stuff was pushed behind my back.. and went on to think I really think that. It's almost like you're a confused hypnotist seeding me with paranoid dilutions. ;)
Quoted 4 lines
Quoted 2 lines
/me waits for Jens to snap his fingers so he can just slowly step away from this line of discussion that is solidly dead now...
Mike, wtf are you talking about.
He Jens, just wanted to formally apologize for how I mishandled this chain of communication.
As you know I like to joke (as happens to unfunny people, sometimes it only makes sense to me). In this instance I was being playful when in reality I should've stayed on message.
It clouded the issue further and I regret that, I also regret my follow up to Kent where I spelled out why I later felt attacked.
This is on me.
Quoted 25 lines
Quoted 12 lines
Quoted 9 lines
Quoted 2 lines
Reality is I'm fine with the change. Just think there is follow-on work (now or later) that is needed.
It's not hard to run the quick struct layout checks or alignment. If there's a concern, that should be done now, instead of being deferred to later. There's no point merging something that we expect to have follow-on work. If that's the case, then it should not be merged. There are no dependencies in the patchset, except that the last patch obviously can't be applied until all of the previous ones are in.
Cool, sounds good.
Quoted 8 lines
Quoted 5 lines
I took a quick look at the struct
mapped_devicelayout, which I'm assuming is the most important on the dm side. It's pretty big to begin with, obviously this makes it bigger since we're now embedding thebio_sets. On my config, doesn't show any false sharing that would be problematic, or layout changes that would worry me. FWIW.Great, thanks, do you happen to have a tree you can push so others can get a quick compile and look at the series fully applied?
I do not, I simply ran a quick analysis of the layout, then applied the full patchset, and repeated that exercise. Literally a 5 minute thing. I haven't applied the series, so haven't pushed anything out.
Quoted 5 lines
Quoted 3 lines
BTW, I'm upstream DM maintainer but I have a role in caring for related subsystems (e.g. block core, etc) in downstream releases.. *cough* RHEL. So this alignment concern wasn't ever purely about DM.
I tend to care about that too...
So revisiting this patchset: are you inclined to take these changes (I assume yes)? If so, what would you need in order to get them staged for 4.18? I'll start with offering my review in reply to the DM patch. I'd much prefer to see this level of change go in sooner rather than later.
Thanks,
Mike
Jens Axboe
maintainerQuoted 4 lines · Mike Snitzer
So revisiting this patchset: are you inclined to take these changes (I assume yes)? If so, what would you need in order to get them staged for 4.18? I'll start with offering my review in reply to the DM patch. I'd much prefer to see this level of change go in sooner rather than later.
Yeah I'd like to take the changes, but we might have to wait for 4.19 at this point. It'd certainly help to have the dm bits reviewed, as they are some of the larger ones. The grunt of the others are mostly trivial and smaller in scope.
Signature · 1 line
Jens Axboe
Re: [PATCH 07/12] dm: convert to bioset_init()/mempool_init()
In reply to Kent OverstreetQuoted 12 lines · Kent Overstreet
Signed-off-by Kent Overstreet <[email protected]>--- drivers/md/dm-bio-prison-v1.c | 13 ++++--- drivers/md/dm-bio-prison-v2.c | 13 ++++--- drivers/md/dm-cache-target.c | 25 ++++++------- drivers/md/dm-core.h | 4 +- drivers/md/dm-crypt.c | 60 ++++++++++++++---------------- drivers/md/dm-integrity.c | 15 ++++---- drivers/md/dm-io.c | 29 ++++++++------- drivers/md/dm-kcopyd.c | 22 ++++++----- drivers/md/dm-log-userspace-base.c | 19 +++++----- drivers/md/dm-region-hash.c | 23 ++++++------
Quoted 8 lines
drivers/md/dm-rq.c | 2 +- drivers/md/dm-snap.c | 17 ++++----- drivers/md/dm-thin.c | 32 ++++++++-------- drivers/md/dm-verity-fec.c | 55 +++++++++++++-------------- drivers/md/dm-verity-fec.h | 8 ++-- drivers/md/dm-zoned-target.c | 13 +++---- drivers/md/dm.c | 53 ++++++++++++-------------- 17 files changed, 197 insertions(+), 206 deletions(-)
In general I think each of these driver patches in the series needs a one-line summary in the description, e.g.:
Embed bioset and mempool_t to avoid pointer indirection in the fast IO path.
But that aside, on a code level, I had to double check bioset_exit() is safe to call even if bioset_init() failed. AFter confirming it is (and double checking by chatting with Kent) I like how the code is simpler (not having to check if the bioset is set before calling it).
Nice job Kent, like you said: mostly mechnical. But even the changes that weren't purely mechnical (e.g. passing r to ERR_PTR, rather than using old hardcode) were fixed up nicely.
Quoted 10 lines · Jens Axboe
Quoted 4 lines · Mike Snitzer
So revisiting this patchset: are you inclined to take these changes (I assume yes)? If so, what would you need in order to get them staged for 4.18? I'll start with offering my review in reply to the DM patch. I'd much prefer to see this level of change go in sooner rather than later.
Yeah I'd like to take the changes, but we might have to wait for 4.19 at this point. It'd certainly help to have the dm bits reviewed, as they are some of the larger ones. The grunt of the others are mostly trivial and smaller in scope.
I don't have a strong opinion on 4.18 vs. 4.19, but I'm available to do whatever fixups are needed if it'll help get them in faster.
Jens Axboe
maintainerQuoted 7 lines · Kent Overstreet
Quoted 6 lines · Jens Axboe
Quoted 4 lines · Mike Snitzer
So revisiting this patchset: are you inclined to take these changes (I assume yes)? If so, what would you need in order to get them staged for 4.18? I'll start with offering my review in reply to the DM patch. I'd much prefer to see this level of change go in sooner rather than later.
Quoted 7 lines
Quoted 4 lines
Yeah I'd like to take the changes, but we might have to wait for 4.19 at this point. It'd certainly help to have the dm bits reviewed, as they are some of the larger ones. The grunt of the others are mostly trivial and smaller in scope.
I don't have a strong opinion on 4.18 vs. 4.19, but I'm available to do whatever fixups are needed if it'll help get them in faster.
Let's do 4.18, I'm getting ready to queue it up. Pinged a few btrfs folks to get that part reviewed.
Note that I'll add a one liner description in the commit message for the patches, as suggested by Mike. They are pretty barren, a little meat in the body won't hurt.
Signature · 1 line
Jens Axboe
Quoted 10 lines · Jens Axboe
Quoted 4 lines · Mike Snitzer
So revisiting this patchset: are you inclined to take these changes (I assume yes)? If so, what would you need in order to get them staged for 4.18? I'll start with offering my review in reply to the DM patch. I'd much prefer to see this level of change go in sooner rather than later.
Yeah I'd like to take the changes, but we might have to wait for 4.19 at this point. It'd certainly help to have the dm bits reviewed, as they are some of the larger ones. The grunt of the others are mostly trivial and smaller in scope.
I _really_ would like to see this land for 4.18. It'll avoid downstream backport problems (due to all the churn in this patchset).
As I'm sure you've seen I reviewed and Acked-by the DM patch.
I mentioned I've been chatting with Kent, he is available if anything needs a v2 for whatever reason.
Would you be OK adding a single sentence description to each driver's patch header (rather than leaving empty like how Kent submitted)? Or should Kent resubmit the entire set with that boilerplate header for each patch?
Jens Axboe
maintainerQuoted 19 lines · Mike Snitzer
Quoted 10 lines · Jens Axboe
Quoted 4 lines · Mike Snitzer
So revisiting this patchset: are you inclined to take these changes (I assume yes)? If so, what would you need in order to get them staged for 4.18? I'll start with offering my review in reply to the DM patch. I'd much prefer to see this level of change go in sooner rather than later.
Yeah I'd like to take the changes, but we might have to wait for 4.19 at this point. It'd certainly help to have the dm bits reviewed, as they are some of the larger ones. The grunt of the others are mostly trivial and smaller in scope.
I _really_ would like to see this land for 4.18. It'll avoid downstream backport problems (due to all the churn in this patchset).
As I'm sure you've seen I reviewed and Acked-by the DM patch.
Quoted 7 lines
I mentioned I've been chatting with Kent, he is available if anything needs a v2 for whatever reason.
Would you be OK adding a single sentence description to each driver's patch header (rather than leaving empty like how Kent submitted)? Or should Kent resubmit the entire set with that boilerplate header for each patch?
See previous email for both questions :)
Signature · 1 line
Jens Axboe
Re: [PATCH 10/12] btrfs: convert to bioset_init()/mempool_init()
In reply to Kent OverstreetQuoted 5 lines · Kent Overstreet
Signed-off-by Kent Overstreet <[email protected]>--- fs/btrfs/extent_io.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-)
Assuming the rest of the comments/questions for the series get worked out, the btrfs side of this looks fine.
Jens Axboe
maintainerQuoted 8 lines · Kent Overstreet
Jens - this series does the rest of the conversions that Christoph wanted, and drops
bioset_create().Only lightly tested, but the changes are pretty mechanical. Based on your for-next tree.
It's also in the for-jens branch at https://evilpiepirate.org/git/bcachefs.git
Quoted 13 lines
Kent Overstreet (12):
block: convert bounce,q->bio_splitto bioset_init()/mempool_init()
drbd: convert to bioset_init()/mempool_init()
pktcdvd: convert to bioset_init()/mempool_init()
lightnvm: convert to bioset_init()/mempool_init()
bcache: convert to bioset_init()/mempool_init()
md: convert to bioset_init()/mempool_init()
dm: convert to bioset_init()/mempool_init()
target: convert to bioset_init()/mempool_init()
fs: convertblock_dev.ctobioset_init()
btrfs: convert to bioset_init()/mempool_init()
xfs: convert to bioset_init()/mempool_init()
block: Dropbioset_create()
With the reviews, I've queued this up for 4.18.
Signature · 1 line
Jens Axboe
Re: [PATCH 06/12] md: convert to bioset_init()/mempool_init()
In reply to Kent OverstreetQuoted 24 lines · Kent Overstreet
(quoted diff) +6
-3@@ -510,7 +510,10 @@ static void mddev_delayed_delete(struct work_struct *ws); static void mddev_put(struct mddev *mddev) { - struct bio_set *bs = NULL, *sync_bs = NULL; + struct bio_set bs, sync_bs; + + memset(&bs, 0, sizeof(bs)); + memset(&sync_bs, 0, sizeof(sync_bs)); if (!atomic_dec_and_lock(&mddev->active, &all_mddevs_lock)) return;@@ -521,8 +524,8 @@ static void mddev_put(struct mddev *mddev) list_del_init(&mddev->all_mddevs); bs = mddev->bio_set; sync_bs = mddev->sync_set; - mddev->bio_set = NULL; - mddev->sync_set = NULL; + memset(&mddev->bio_set, 0, sizeof(mddev->bio_set)); + memset(&mddev->sync_set, 0, sizeof(mddev->sync_set)); if (mddev->gendisk) { /* We did a probe so need to clean up. Call * queue_work inside the spinlock so that
Review static void mddev_put(struct mddev *mddev) · line 543
Quoted 10 lines
(quoted diff) +2
-4@@ -535,10 +538,8 @@ static void mddev_put(struct mddev *mddev) kfree(mddev); } spin_unlock(&all_mddevs_lock); - if (bs) - bioset_free(bs); - if (sync_bs) - bioset_free(sync_bs); + bioset_exit(&bs); + bioset_exit(&sync_bs); }
This has triggered a new warning in randconfig builds for me, on 32-bit:
drivers/md/md.c: In function 'mddev_put':drivers/md/md.c:564:1: error: the frame size of 1096 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
and on 64-bit:
drivers/md/md.c: In function 'mddev_put':drivers/md/md.c:564:1: error: the frame size of 2112 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]
The size of bio_set is a bit configuration dependent, but it looks like this is a bit too big to put on the stack either way, epsecially when you traverse a list and copy two of them with assignments for each loop in 'bs = mddev->bio_set'.
A related problem is that calling bioset_exit on a copy of the bio_set might not do the right thing. The function is defined as
void bioset_exit(struct bio_set *bs)
{
if (bs->rescue_workqueue)
destroy_workqueue(bs->rescue_workqueue);
bs->rescue_workqueue = NULL;
mempool_exit(&bs->bio_pool);
mempool_exit(&bs->bvec_pool);
bioset_integrity_free(bs);
if (bs->bio_slab)
bio_put_slab(bs);
bs->bio_slab = NULL;
}So it calls a couple of functions (detroy_workqueue, mempool_exit, bioset_integrity_free, bio_put_slab), each of which might rely on a the structure being the same one that was originally allocated. If the structure contains any kind of linked list entry, passing a copy into the list management functions would guarantee corruption.
I could not come up with an obvious fix, but maybe it's possible to change mddev_put() to do call bioset_exit() before the structure gets freed? Something like the (completely untested and probably wrong somewhere) patch below
drivers/md/md.c +8 -10
@@ -531,11 +531,6 @@ static void mddev_delayed_delete(struct work_struct *ws);static void mddev_put (struct mddev *mddev) { -struct bio_set bs, sync_bs; - -memset (&bs,0 ,sizeof (bs)); -memset (&sync_bs,0 ,sizeof (sync_bs)); -if (!atomic_dec_and_lock (&mddev->active, &all_mddevs_lock))return ; if (!mddev->raid_disks && list_empty(&mddev->disks) &&
@@ -543,10 +538,14 @@ static void mddev_put(struct mddev *mddev)/* Array is not configured at all, and not held active, * so destroy it */ list_del_init (&mddev->all_mddevs); - bs = mddev->bio_set; - sync_bs = mddev->sync_set; +spin_unlock (&all_mddevs_lock); + +bioset_exit (&mddev->bio_set);memset (&mddev->bio_set,0 ,sizeof (mddev->bio_set)); + +bioset_exit (&mddev->sync_set);memset (&mddev->sync_set,0 ,sizeof (mddev->sync_set)); +if (mddev->gendisk) {/* We did a probe so need to clean up. Call * queue_work inside the spinlock so that
@@ -557,10 +556,9 @@ static void mddev_put(struct mddev *mddev)queue_work (md_misc_wq, &mddev->del_work); }else kfree (mddev); + }else { +spin_unlock (&all_mddevs_lock); } -spin_unlock (&all_mddevs_lock); -bioset_exit (&bs); -bioset_exit (&sync_bs); }static void md_safemode_timeout (struct timer_list *t);