Re: [PATCH 16/20] block: move ->make_request_fn to struct block_device_operations

2020-07-02 Thread Coly Li
On 2020/7/1 16:59, Christoph Hellwig wrote:
> The make_request_fn is a little weird in that it sits directly in
> struct request_queue instead of an operation vector.  Replace it with
> a block_device_operations method called submit_bio (which describes much
> better what it does).  Also remove the request_queue argument to it, as
> the queue can be derived pretty trivially from the bio.
> 
> Signed-off-by: Christoph Hellwig 

For the bcache part,

Acked-by: Coly Li 

> ---
>  Documentation/block/biodoc.rst|  2 +-
>  .../block/writeback_cache_control.rst |  2 +-
>  arch/m68k/emu/nfblock.c   |  5 +-
>  arch/xtensa/platforms/iss/simdisk.c   |  5 +-
>  block/blk-cgroup.c|  2 +-
>  block/blk-core.c  | 53 +++
>  block/blk-mq.c| 10 ++--
>  block/blk.h   |  2 -
>  drivers/block/brd.c   |  5 +-
>  drivers/block/drbd/drbd_int.h |  2 +-
>  drivers/block/drbd/drbd_main.c|  9 ++--
>  drivers/block/drbd/drbd_req.c |  2 +-
>  drivers/block/null_blk_main.c | 17 --
>  drivers/block/pktcdvd.c   | 11 ++--
>  drivers/block/ps3vram.c   | 15 +++---
>  drivers/block/rsxx/dev.c  |  7 ++-
>  drivers/block/umem.c  |  5 +-
>  drivers/block/zram/zram_drv.c | 11 ++--
>  drivers/lightnvm/core.c   |  8 +--
>  drivers/lightnvm/pblk-init.c  | 12 +++--
>  drivers/md/bcache/request.c   |  4 +-
>  drivers/md/bcache/request.h   |  4 +-
>  drivers/md/bcache/super.c | 23 +---
>  drivers/md/dm.c   | 23 
>  drivers/md/md.c   |  5 +-
>  drivers/nvdimm/blk.c  |  5 +-
>  drivers/nvdimm/btt.c  |  5 +-
>  drivers/nvdimm/pmem.c |  5 +-
>  drivers/nvme/host/core.c  |  1 +
>  drivers/nvme/host/multipath.c |  5 +-
>  drivers/nvme/host/nvme.h  |  1 +
>  drivers/s390/block/dcssblk.c  |  9 ++--
>  drivers/s390/block/xpram.c|  6 +--
>  include/linux/blk-mq.h|  2 +-
>  include/linux/blkdev.h|  7 +--
>  include/linux/lightnvm.h  |  3 +-
>  36 files changed, 153 insertions(+), 140 deletions(-)
> 
[snipped]

> diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
> index 7acf024e99f351..fc5702b10074d6 100644
> --- a/drivers/md/bcache/request.c
> +++ b/drivers/md/bcache/request.c
> @@ -1158,7 +1158,7 @@ static void quit_max_writeback_rate(struct cache_set *c,
>  
>  /* Cached devices - read & write stuff */
>  
> -blk_qc_t cached_dev_make_request(struct request_queue *q, struct bio *bio)
> +blk_qc_t cached_dev_submit_bio(struct bio *bio)
>  {
>   struct search *s;
>   struct bcache_device *d = bio->bi_disk->private_data;
> @@ -1291,7 +1291,7 @@ static void flash_dev_nodata(struct closure *cl)
>   continue_at(cl, search_free, NULL);
>  }
>  
> -blk_qc_t flash_dev_make_request(struct request_queue *q, struct bio *bio)
> +blk_qc_t flash_dev_submit_bio(struct bio *bio)
>  {
>   struct search *s;
>   struct closure *cl;
> diff --git a/drivers/md/bcache/request.h b/drivers/md/bcache/request.h
> index bb005c93dd7218..82b38366a95deb 100644
> --- a/drivers/md/bcache/request.h
> +++ b/drivers/md/bcache/request.h
> @@ -37,10 +37,10 @@ unsigned int bch_get_congested(const struct cache_set *c);
>  void bch_data_insert(struct closure *cl);
>  
>  void bch_cached_dev_request_init(struct cached_dev *dc);
> -blk_qc_t cached_dev_make_request(struct request_queue *q, struct bio *bio);
> +blk_qc_t cached_dev_submit_bio(struct bio *bio);
>  
>  void bch_flash_dev_request_init(struct bcache_device *d);
> -blk_qc_t flash_dev_make_request(struct request_queue *q, struct bio *bio);
> +blk_qc_t flash_dev_submit_bio(struct bio *bio);
>  
>  extern struct kmem_cache *bch_search_cache;
>  
> diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
> index 21aa168113d30b..de13f6e916966d 100644
> --- a/drivers/md/bcache/super.c
> +++ b/drivers/md/bcache/super.c
> @@ -680,7 +680,16 @@ static int ioctl_dev(struct block_device *b, fmode_t 
> mode,
>   return d->ioctl(d, mode, cmd, arg);
>  }
>  
> -static const struct block_device_operations bcache_ops = {
> +static const struct block_device_operations bcache_cached_ops = {
> + .submit_bio = cached_dev_submit_bio,
> + .open   = open_dev,
> + .release= release_dev,
> + .ioctl  = ioctl_dev,
> + .owner  = THIS_MODULE,
> +};
> +
> +static const struct block_device_operations bcache_flash_ops 

Re: [PATCH 16/20] block: move ->make_request_fn to struct block_device_operations

2020-07-01 Thread Dan Williams
On Wed, Jul 1, 2020 at 2:01 AM Christoph Hellwig  wrote:
>
> The make_request_fn is a little weird in that it sits directly in
> struct request_queue instead of an operation vector.  Replace it with
> a block_device_operations method called submit_bio (which describes much
> better what it does).  Also remove the request_queue argument to it, as
> the queue can be derived pretty trivially from the bio.
>
> Signed-off-by: Christoph Hellwig 
> ---
[..]
>  drivers/nvdimm/blk.c  |  5 +-
>  drivers/nvdimm/btt.c  |  5 +-
>  drivers/nvdimm/pmem.c |  5 +-

For drivers/nvdimm

Acked-by: Dan Williams 


[PATCH 16/20] block: move ->make_request_fn to struct block_device_operations

2020-07-01 Thread Christoph Hellwig
The make_request_fn is a little weird in that it sits directly in
struct request_queue instead of an operation vector.  Replace it with
a block_device_operations method called submit_bio (which describes much
better what it does).  Also remove the request_queue argument to it, as
the queue can be derived pretty trivially from the bio.

Signed-off-by: Christoph Hellwig 
---
 Documentation/block/biodoc.rst|  2 +-
 .../block/writeback_cache_control.rst |  2 +-
 arch/m68k/emu/nfblock.c   |  5 +-
 arch/xtensa/platforms/iss/simdisk.c   |  5 +-
 block/blk-cgroup.c|  2 +-
 block/blk-core.c  | 53 +++
 block/blk-mq.c| 10 ++--
 block/blk.h   |  2 -
 drivers/block/brd.c   |  5 +-
 drivers/block/drbd/drbd_int.h |  2 +-
 drivers/block/drbd/drbd_main.c|  9 ++--
 drivers/block/drbd/drbd_req.c |  2 +-
 drivers/block/null_blk_main.c | 17 --
 drivers/block/pktcdvd.c   | 11 ++--
 drivers/block/ps3vram.c   | 15 +++---
 drivers/block/rsxx/dev.c  |  7 ++-
 drivers/block/umem.c  |  5 +-
 drivers/block/zram/zram_drv.c | 11 ++--
 drivers/lightnvm/core.c   |  8 +--
 drivers/lightnvm/pblk-init.c  | 12 +++--
 drivers/md/bcache/request.c   |  4 +-
 drivers/md/bcache/request.h   |  4 +-
 drivers/md/bcache/super.c | 23 +---
 drivers/md/dm.c   | 23 
 drivers/md/md.c   |  5 +-
 drivers/nvdimm/blk.c  |  5 +-
 drivers/nvdimm/btt.c  |  5 +-
 drivers/nvdimm/pmem.c |  5 +-
 drivers/nvme/host/core.c  |  1 +
 drivers/nvme/host/multipath.c |  5 +-
 drivers/nvme/host/nvme.h  |  1 +
 drivers/s390/block/dcssblk.c  |  9 ++--
 drivers/s390/block/xpram.c|  6 +--
 include/linux/blk-mq.h|  2 +-
 include/linux/blkdev.h|  7 +--
 include/linux/lightnvm.h  |  3 +-
 36 files changed, 153 insertions(+), 140 deletions(-)

diff --git a/Documentation/block/biodoc.rst b/Documentation/block/biodoc.rst
index b964796ec9c780..267384159bf793 100644
--- a/Documentation/block/biodoc.rst
+++ b/Documentation/block/biodoc.rst
@@ -1036,7 +1036,7 @@ Now the generic block layer performs partition-remapping 
early and thus
 provides drivers with a sector number relative to whole device, rather than
 having to take partition number into account in order to arrive at the true
 sector number. The routine blk_partition_remap() is invoked by
-generic_make_request even before invoking the queue specific make_request_fn,
+generic_make_request even before invoking the queue specific ->submit_bio,
 so the i/o scheduler also gets to operate on whole disk sector numbers. This
 should typically not require changes to block drivers, it just never gets
 to invoke its own partition sector offset calculations since all bios
diff --git a/Documentation/block/writeback_cache_control.rst 
b/Documentation/block/writeback_cache_control.rst
index 2c752c57c14c62..b208488d0aae85 100644
--- a/Documentation/block/writeback_cache_control.rst
+++ b/Documentation/block/writeback_cache_control.rst
@@ -47,7 +47,7 @@ the Forced Unit Access is implemented.  The REQ_PREFLUSH and 
REQ_FUA flags
 may both be set on a single bio.
 
 
-Implementation details for make_request_fn based block drivers
+Implementation details for bio based block drivers
 --
 
 These drivers will always see the REQ_PREFLUSH and REQ_FUA bits as they sit
diff --git a/arch/m68k/emu/nfblock.c b/arch/m68k/emu/nfblock.c
index 87e8b1700acd28..92d26c81244134 100644
--- a/arch/m68k/emu/nfblock.c
+++ b/arch/m68k/emu/nfblock.c
@@ -59,7 +59,7 @@ struct nfhd_device {
struct gendisk *disk;
 };
 
-static blk_qc_t nfhd_make_request(struct request_queue *queue, struct bio *bio)
+static blk_qc_t nfhd_submit_bio(struct bio *bio)
 {
struct nfhd_device *dev = bio->bi_disk->private_data;
struct bio_vec bvec;
@@ -93,6 +93,7 @@ static int nfhd_getgeo(struct block_device *bdev, struct 
hd_geometry *geo)
 
 static const struct block_device_operations nfhd_ops = {
.owner  = THIS_MODULE,
+   .submit_bio = nfhd_submit_bio,
.getgeo = nfhd_getgeo,
 };
 
@@ -118,7 +119,7 @@ static int __init nfhd_init_one(int id, u32 blocks, u32 
bsize)
dev->bsize = bsize;
dev->bshift = ffs(bsize) - 10;
 
-   dev->queue = blk_alloc_queue(nfhd_make_request, NUMA_NO_NODE);
+   dev->queue = 

[PATCH 16/20] block: move ->make_request_fn to struct block_device_operations

2020-06-29 Thread Christoph Hellwig
The make_request_fn is a little weird in that it sits directly in
struct request_queue instead of an operation vector.  Replace it with
a block_device_operations method called submit_bio (which describes much
better what it does).  Also remove the request_queue argument to it, as
the queue can be derived pretty trivially from the bio.

Signed-off-by: Christoph Hellwig 
---
 Documentation/block/biodoc.rst|  2 +-
 .../block/writeback_cache_control.rst |  2 +-
 arch/m68k/emu/nfblock.c   |  5 +-
 arch/xtensa/platforms/iss/simdisk.c   |  5 +-
 block/blk-cgroup.c|  2 +-
 block/blk-core.c  | 53 +++
 block/blk-mq.c| 10 ++--
 block/blk.h   |  2 -
 drivers/block/brd.c   |  5 +-
 drivers/block/drbd/drbd_int.h |  2 +-
 drivers/block/drbd/drbd_main.c|  9 ++--
 drivers/block/drbd/drbd_req.c |  2 +-
 drivers/block/null_blk_main.c | 17 --
 drivers/block/pktcdvd.c   | 11 ++--
 drivers/block/ps3vram.c   | 15 +++---
 drivers/block/rsxx/dev.c  |  7 ++-
 drivers/block/umem.c  |  5 +-
 drivers/block/zram/zram_drv.c | 11 ++--
 drivers/lightnvm/core.c   |  8 +--
 drivers/lightnvm/pblk-init.c  | 12 +++--
 drivers/md/bcache/request.c   |  4 +-
 drivers/md/bcache/request.h   |  4 +-
 drivers/md/bcache/super.c | 23 +---
 drivers/md/dm.c   | 23 
 drivers/md/md.c   |  5 +-
 drivers/nvdimm/blk.c  |  5 +-
 drivers/nvdimm/btt.c  |  5 +-
 drivers/nvdimm/pmem.c |  5 +-
 drivers/nvme/host/core.c  |  1 +
 drivers/nvme/host/multipath.c |  5 +-
 drivers/nvme/host/nvme.h  |  1 +
 drivers/s390/block/dcssblk.c  |  9 ++--
 drivers/s390/block/xpram.c|  6 +--
 include/linux/blk-mq.h|  2 +-
 include/linux/blkdev.h|  7 +--
 include/linux/lightnvm.h  |  3 +-
 36 files changed, 153 insertions(+), 140 deletions(-)

diff --git a/Documentation/block/biodoc.rst b/Documentation/block/biodoc.rst
index b964796ec9c780..267384159bf793 100644
--- a/Documentation/block/biodoc.rst
+++ b/Documentation/block/biodoc.rst
@@ -1036,7 +1036,7 @@ Now the generic block layer performs partition-remapping 
early and thus
 provides drivers with a sector number relative to whole device, rather than
 having to take partition number into account in order to arrive at the true
 sector number. The routine blk_partition_remap() is invoked by
-generic_make_request even before invoking the queue specific make_request_fn,
+generic_make_request even before invoking the queue specific ->submit_bio,
 so the i/o scheduler also gets to operate on whole disk sector numbers. This
 should typically not require changes to block drivers, it just never gets
 to invoke its own partition sector offset calculations since all bios
diff --git a/Documentation/block/writeback_cache_control.rst 
b/Documentation/block/writeback_cache_control.rst
index 2c752c57c14c62..b208488d0aae85 100644
--- a/Documentation/block/writeback_cache_control.rst
+++ b/Documentation/block/writeback_cache_control.rst
@@ -47,7 +47,7 @@ the Forced Unit Access is implemented.  The REQ_PREFLUSH and 
REQ_FUA flags
 may both be set on a single bio.
 
 
-Implementation details for make_request_fn based block drivers
+Implementation details for bio based block drivers
 --
 
 These drivers will always see the REQ_PREFLUSH and REQ_FUA bits as they sit
diff --git a/arch/m68k/emu/nfblock.c b/arch/m68k/emu/nfblock.c
index 87e8b1700acd28..92d26c81244134 100644
--- a/arch/m68k/emu/nfblock.c
+++ b/arch/m68k/emu/nfblock.c
@@ -59,7 +59,7 @@ struct nfhd_device {
struct gendisk *disk;
 };
 
-static blk_qc_t nfhd_make_request(struct request_queue *queue, struct bio *bio)
+static blk_qc_t nfhd_submit_bio(struct bio *bio)
 {
struct nfhd_device *dev = bio->bi_disk->private_data;
struct bio_vec bvec;
@@ -93,6 +93,7 @@ static int nfhd_getgeo(struct block_device *bdev, struct 
hd_geometry *geo)
 
 static const struct block_device_operations nfhd_ops = {
.owner  = THIS_MODULE,
+   .submit_bio = nfhd_submit_bio,
.getgeo = nfhd_getgeo,
 };
 
@@ -118,7 +119,7 @@ static int __init nfhd_init_one(int id, u32 blocks, u32 
bsize)
dev->bsize = bsize;
dev->bshift = ffs(bsize) - 10;
 
-   dev->queue = blk_alloc_queue(nfhd_make_request, NUMA_NO_NODE);
+   dev->queue =