[PATCH 22/27] block: refactor discard bio size limiting

2022-04-08 Thread Christoph Hellwig
Move all the logic to limit the discard bio size into a common helper so that it is better documented. Signed-off-by: Christoph Hellwig Reviewed-by: Martin K. Petersen Acked-by: Coly Li --- block/blk-lib.c | 59 - block/blk.h | 14

[PATCH 21/27] block: move {bdev, queue_limit}_discard_alignment out of line

2022-04-08 Thread Christoph Hellwig
No need to inline these fairly larger helpers. Also fix the return value to be unsigned, just like the field in struct queue_limits. Signed-off-by: Christoph Hellwig Reviewed-by: Martin K. Petersen --- block/blk-settings.c | 35 +++ include/linux/blkdev.h

[PATCH 20/27] block: use bdev_discard_alignment in part_discard_alignment_show

2022-04-08 Thread Christoph Hellwig
Use the bdev based alignment helper instead of open coding it. Signed-off-by: Christoph Hellwig Reviewed-by: Martin K. Petersen --- block/partitions/core.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/block/partitions/core.c b/block/partitions/core.c index

[PATCH 18/27] block: move bdev_alignment_offset and queue_limit_alignment_offset out of line

2022-04-08 Thread Christoph Hellwig
No need to inline these fairly larger helpers. Signed-off-by: Christoph Hellwig Reviewed-by: Martin K. Petersen --- block/blk-settings.c | 23 +++ include/linux/blkdev.h | 21 + 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/block/blk

[PATCH 19/27] block: remove queue_discard_alignment

2022-04-08 Thread Christoph Hellwig
Just use bdev_alignment_offset in disk_discard_alignment_show instead. That helpers is the same except for an always false branch that doesn't matter in this slow path. Signed-off-by: Christoph Hellwig Reviewed-by: Martin K. Petersen --- block/genhd.c | 2 +- include/linux/blk

[PATCH 17/27] block: use bdev_alignment_offset in disk_alignment_offset_show

2022-04-08 Thread Christoph Hellwig
This does the same as the open coded variant except for an extra branch, and allows to remove queue_alignment_offset entirely. Signed-off-by: Christoph Hellwig Reviewed-by: Martin K. Petersen --- block/genhd.c | 2 +- include/linux/blkdev.h | 8 2 files changed, 1 insertion

[PATCH 16/27] block: use bdev_alignment_offset in part_alignment_offset_show

2022-04-08 Thread Christoph Hellwig
Replace the open coded offset calculation with the proper helper. This is an ABI change in that the -1 for a misaligned partition is properly propagated, which can be considered a bug fix and matches what is done on the whole device. Signed-off-by: Christoph Hellwig Reviewed-by: Martin K

[PATCH 15/27] block: add a bdev_max_zone_append_sectors helper

2022-04-08 Thread Christoph Hellwig
Add a helper to check the max supported sectors for zone append based on the block_device instead of having to poke into the block layer internal request_queue. Signed-off-by: Christoph Hellwig Acked-by: Damien Le Moal Reviewed-by: Martin K. Petersen Reviewed-by: Johannes Thumshirn

[PATCH 14/27] block: add a bdev_stable_writes helper

2022-04-08 Thread Christoph Hellwig
Add a helper to check the stable writes flag based on the block_device instead of having to poke into the block layer internal request_queue. Signed-off-by: Christoph Hellwig Reviewed-by: Martin K. Petersen --- drivers/md/dm-table.c | 4 +--- fs/super.c | 2 +- include/linux

[PATCH 13/27] block: add a bdev_fua helper

2022-04-08 Thread Christoph Hellwig
Add a helper to check the FUA flag based on the block_device instead of having to poke into the block layer internal request_queue. Signed-off-by: Christoph Hellwig Reviewed-by: Martin K. Petersen --- drivers/block/rnbd/rnbd-srv.c | 3 +-- drivers/target/target_core_iblock.c | 3 +-- fs

[PATCH 12/27] block: add a bdev_write_cache helper

2022-04-08 Thread Christoph Hellwig
Add a helper to check the write cache flag based on the block_device instead of having to poke into the block layer internal request_queue. Signed-off-by: Christoph Hellwig Reviewed-by: Martin K. Petersen Acked-by: David Sterba [btrfs] --- drivers/block/rnbd/rnbd-srv.c | 2 +- drivers

[PATCH 11/27] block: add a bdev_nonrot helper

2022-04-08 Thread Christoph Hellwig
Add a helper to check the nonrot flag based on the block_device instead of having to poke into the block layer internal request_queue. Signed-off-by: Christoph Hellwig Reviewed-by: Martin K. Petersen Acked-by: David Sterba [btrfs] --- block/ioctl.c | 2 +- drivers/block

[PATCH 10/27] mm: use bdev_is_zoned in claim_swapfile

2022-04-08 Thread Christoph Hellwig
Use the bdev based helper instead of poking into the queue. Signed-off-by: Christoph Hellwig --- mm/swapfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/swapfile.c b/mm/swapfile.c index 63c61f8b26118..4c7537162af5e 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c

[PATCH 09/27] ntfs3: use bdev_logical_block_size instead of open coding it

2022-04-08 Thread Christoph Hellwig
Signed-off-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn --- fs/ntfs3/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c index 278dcf5024102..cd30e81abbce0 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -920,7 +920,7

[PATCH 08/27] btrfs: use bdev_max_active_zones instead of open coding it

2022-04-08 Thread Christoph Hellwig
Signed-off-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn --- fs/btrfs/zoned.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c index 1b1b310c3c510..f72cad7391a11 100644 --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -350,7

[PATCH 07/27] drbd: cleanup decide_on_discard_support

2022-04-08 Thread Christoph Hellwig
Sanitize the calling conventions and use a goto label to cleanup the code flow. Signed-off-by: Christoph Hellwig Acked-by: Christoph Böhmwalder --- drivers/block/drbd/drbd_nl.c | 68 +++- 1 file changed, 35 insertions(+), 33 deletions(-) diff --git a/drivers

[PATCH 06/27] drbd: use bdev_alignment_offset instead of queue_alignment_offset

2022-04-08 Thread Christoph Hellwig
The bdev version does the right thing for partitions, so use that. Fixes: 9104d31a759f ("drbd: introduce WRITE_SAME support") Signed-off-by: Christoph Hellwig Acked-by: Christoph Böhmwalder --- drivers/block/drbd/drbd_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) di

[PATCH 05/27] drbd: use bdev based limit helpers in drbd_send_sizes

2022-04-08 Thread Christoph Hellwig
Use the bdev based limits helpers where they exist. Signed-off-by: Christoph Hellwig Acked-by: Christoph Böhmwalder --- drivers/block/drbd/drbd_main.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd

[PATCH 04/27] drbd: remove assign_p_sizes_qlim

2022-04-08 Thread Christoph Hellwig
Fold each branch into its only caller. Signed-off-by: Christoph Hellwig --- drivers/block/drbd/drbd_main.c | 47 +++--- 1 file changed, 20 insertions(+), 27 deletions(-) diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index 9676a1d214bc5

[PATCH 03/27] target: fix discard alignment on partitions

2022-04-08 Thread Christoph Hellwig
Use the proper bdev_discard_alignment helper that accounts for partition offsets. Fixes: c66ac9db8d4a ("[SCSI] target: Add LIO target core v4.0.0-rc6") Signed-off-by: Christoph Hellwig Reviewed-by: Martin K. Petersen --- drivers/target/target_core_device.c | 4 ++-- 1 file

[PATCH 02/27] target: pass a block_device to target_configure_unmap_from_queue

2022-04-08 Thread Christoph Hellwig
The SCSI target drivers is a consumer of the block layer and shoul d generally work on struct block_device. Signed-off-by: Christoph Hellwig Reviewed-by: Martin K. Petersen --- drivers/target/target_core_device.c | 5 +++-- drivers/target/target_core_file.c| 7 --- drivers/target

[PATCH 01/27] target: remove an incorrect unmap zeroes data deduction

2022-04-08 Thread Christoph Hellwig
block: Convert WRITE_SAME to blkdev_issue_zeroout") Signed-off-by: Christoph Hellwig Reviewed-by: Martin K. Petersen --- drivers/target/target_core_device.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index 44b

use block_device based APIs in block layer consumers v2

2022-04-08 Thread Christoph Hellwig
Hi Jens, this series cleanups up the block layer API so that APIs consumed by file systems are (almost) only struct block_devic based, so that file systems don't have to poke into block layer internals like the request_queue. I also found a bunch of existing bugs related to partition offsets and

Re: [PATCH 1/5] iommu: Replace uses of IOMMU_CAP_CACHE_COHERENCY with dev_is_dma_coherent()

2022-04-07 Thread Christoph Hellwig
On Thu, Apr 07, 2022 at 04:17:11PM +0100, Robin Murphy wrote: >> My take is that the drivers using this API are doing it to make sure >> their HW blocks are setup in a way that is consistent with the DMA API >> they are also using, and run in constrained embedded-style >> environments that know the

Re: [PATCH 07/27] btrfs: use bdev_max_active_zones instead of open coding it

2022-04-07 Thread Christoph Hellwig
On Thu, Apr 07, 2022 at 05:20:49PM +0200, David Sterba wrote: > On Wed, Apr 06, 2022 at 08:04:56AM +0200, Christoph Hellwig wrote: > > Signed-off-by: Christoph Hellwig > > As it's a standalone patch I can take it (possibly with other similar > prep btrfs patches) in curre

Re: [PATCH 1/5] iommu: Replace uses of IOMMU_CAP_CACHE_COHERENCY with dev_is_dma_coherent()

2022-04-06 Thread Christoph Hellwig
On Wed, Apr 06, 2022 at 01:06:23PM -0300, Jason Gunthorpe wrote: > On Wed, Apr 06, 2022 at 05:50:56PM +0200, Christoph Hellwig wrote: > > On Wed, Apr 06, 2022 at 12:18:23PM -0300, Jason Gunthorpe wrote: > > > > Oh, I didn't know about device_get_dma_attr().. > > &g

Re: [PATCH 1/5] iommu: Replace uses of IOMMU_CAP_CACHE_COHERENCY with dev_is_dma_coherent()

2022-04-06 Thread Christoph Hellwig
On Wed, Apr 06, 2022 at 12:18:23PM -0300, Jason Gunthorpe wrote: > > Oh, I didn't know about device_get_dma_attr().. Which is completely broken for any non-OF, non-ACPI plaform. ___ Virtualization mailing list Virtualization@lists.linux-foundation.org ht

Re: [PATCH 1/5] iommu: Replace uses of IOMMU_CAP_CACHE_COHERENCY with dev_is_dma_coherent()

2022-04-06 Thread Christoph Hellwig
On Wed, Apr 06, 2022 at 11:14:46AM -0300, Jason Gunthorpe wrote: > Really? It is the only condition that dma_info_to_prot() tests to > decide of IOMMU_CACHE is used or not, so you are saying that there is > a condition where a device can be attached to an iommu_domain and > dev_is_dma_coherent() re

Re: [PATCH 1/5] iommu: Replace uses of IOMMU_CAP_CACHE_COHERENCY with dev_is_dma_coherent()

2022-04-06 Thread Christoph Hellwig
On Wed, Apr 06, 2022 at 09:07:30AM -0300, Jason Gunthorpe wrote: > Didn't see it > > I'll move dev_is_dma_coherent to device.h along with > device_iommu_mapped() and others then No. It it is internal for a reason. It also doesn't actually work outside of the dma core. E.g. for non-swiotlb ARM

[PATCH 27/27] direct-io: remove random prefetches

2022-04-05 Thread Christoph Hellwig
Randomly poking into block device internals for manual prefetches isn't exactly a very maintainable thing to do. And none of the performance criticil direct I/O implementations still use this library function anyway, so just drop it. Signed-off-by: Christoph Hellwig --- fs/direct-io.c

[PATCH 26/27] block: uncouple REQ_OP_SECURE_ERASE from REQ_OP_DISCARD

2022-04-05 Thread Christoph Hellwig
Secure erase is a very different operation from discard in that it is a data integrity operation vs hint. Fully split the limits and helper infrastructure to make the separation more clear. Signed-off-by: Christoph Hellwig --- block/blk-core.c| 2 +- block/blk-lib.c

[PATCH 24/27] block: add a bdev_discard_granularity helper

2022-04-05 Thread Christoph Hellwig
Abstract away implementation details from file systems by providing a block_device based helper to retreive the discard granularity. Signed-off-by: Christoph Hellwig --- block/blk-lib.c | 5 ++--- drivers/block/drbd/drbd_nl.c| 9 + drivers/block/drbd

[PATCH 25/27] block: remove QUEUE_FLAG_DISCARD

2022-04-05 Thread Christoph Hellwig
allow for it. Signed-off-by: Christoph Hellwig --- arch/um/drivers/ubd_kern.c| 2 -- block/blk-mq-debugfs.c| 1 - drivers/block/drbd/drbd_nl.c | 15 --- drivers/block/loop.c | 2 -- drivers/block/nbd.c | 3 --- drivers/block/null_blk/main.c | 1

[PATCH 23/27] block: add a bdev_max_discard_sectors helper

2022-04-05 Thread Christoph Hellwig
-by: Christoph Hellwig --- block/blk-core.c| 2 +- block/blk-lib.c | 2 +- block/ioctl.c | 3 +-- drivers/block/drbd/drbd_main.c | 2 +- drivers/block/drbd/drbd_nl.c| 12 +++- drivers/block/drbd/drbd_receiver.c

[PATCH 22/27] block: refactor discard bio size limiting

2022-04-05 Thread Christoph Hellwig
Move all the logic to limit the discard bio size into a common helper so that it is better documented. Signed-off-by: Christoph Hellwig --- block/blk-lib.c | 59 - block/blk.h | 14 2 files changed, 29 insertions(+), 44 deletions

[PATCH 21/27] block: move {bdev, queue_limit}_discard_alignment out of line

2022-04-05 Thread Christoph Hellwig
No need to inline these fairly larger helpers. Also fix the return value to be unsigned, just like the field in struct queue_limits. Signed-off-by: Christoph Hellwig --- block/blk-settings.c | 35 +++ include/linux/blkdev.h | 34

[PATCH 20/27] block: use bdev_discard_alignment in part_discard_alignment_show

2022-04-05 Thread Christoph Hellwig
Use the bdev based alignment helper instead of open coding it. Signed-off-by: Christoph Hellwig --- block/partitions/core.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/block/partitions/core.c b/block/partitions/core.c index 240b3fff521e4..70dec1c78521d 100644 --- a

[PATCH 19/27] block: remove queue_discard_alignment

2022-04-05 Thread Christoph Hellwig
Just use bdev_alignment_offset in disk_discard_alignment_show instead. That helpers is the same except for an always false branch that doesn't matter in this slow path. Signed-off-by: Christoph Hellwig --- block/genhd.c | 2 +- include/linux/blkdev.h | 8 2 files chang

[PATCH 18/27] block: move bdev_alignment_offset and queue_limit_alignment_offset out of line

2022-04-05 Thread Christoph Hellwig
No need to inline these fairly larger helpers. Signed-off-by: Christoph Hellwig --- block/blk-settings.c | 23 +++ include/linux/blkdev.h | 21 + 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/block/blk-settings.c b/block/blk

[PATCH 17/27] block: use bdev_alignment_offset in disk_alignment_offset_show

2022-04-05 Thread Christoph Hellwig
This does the same as the open coded variant except for an extra branch, and allows to remove queue_alignment_offset entirely. Signed-off-by: Christoph Hellwig --- block/genhd.c | 2 +- include/linux/blkdev.h | 8 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a

[PATCH 15/27] block: use bdev_alignment_offset in part_alignment_offset_show

2022-04-05 Thread Christoph Hellwig
Replace the open coded offset calculation with the proper helper. This is an ABI change in that the -1 for a misaligned partition is properly propagated, which can be considered a bug fix and maches what is done on the whole device. Signed-off-by: Christoph Hellwig --- block/partitions/core.c

[PATCH 16/27] drbd: use bdev_alignment_offset instead of queue_alignment_offset

2022-04-05 Thread Christoph Hellwig
The bdev version does the right thing for partitions, so use that. Fixes: 9104d31a759f ("drbd: introduce WRITE_SAME support") Signed-off-by: Christoph Hellwig --- drivers/block/drbd/drbd_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/drbd/drb

[PATCH 14/27] block: add a bdev_max_zone_append_sectors helper

2022-04-05 Thread Christoph Hellwig
Add a helper to check the max supported sectors for zone append based on the block_device instead of having to poke into the block layer internal request_queue. Signed-off-by: Christoph Hellwig --- drivers/nvme/target/zns.c | 3 +-- fs/zonefs/super.c | 3 +-- include/linux/blkdev.h

[PATCH 13/27] block: add a bdev_stable_writes helper

2022-04-05 Thread Christoph Hellwig
Add a helper to check the stable writes flag based on the block_device instead of having to poke into the block layer internal request_queue. Signed-off-by: Christoph Hellwig --- drivers/md/dm-table.c | 4 +--- fs/super.c | 2 +- include/linux/blkdev.h | 6 ++ mm/swapfile.c

[PATCH 12/27] block: add a bdev_fua helper

2022-04-05 Thread Christoph Hellwig
Add a helper to check the FUA flag based on the block_device instead of having to poke into the block layer internal request_queue. Signed-off-by: Christoph Hellwig --- drivers/block/rnbd/rnbd-srv.c | 3 +-- drivers/target/target_core_iblock.c | 3 +-- fs/iomap/direct-io.c

[PATCH 11/27] block: add a bdev_write_cache helper

2022-04-05 Thread Christoph Hellwig
Add a helper to check the write cache flag based on the block_device instead of having to poke into the block layer internal request_queue. Signed-off-by: Christoph Hellwig --- drivers/block/rnbd/rnbd-srv.c | 2 +- drivers/block/xen-blkback/xenbus.c | 2 +- drivers/target

[PATCH 10/27] block: add a bdev_nonrot helper

2022-04-05 Thread Christoph Hellwig
Add a helper to check the nonrot flag based on the block_device instead of having to poke into the block layer internal request_queue. Signed-off-by: Christoph Hellwig --- block/ioctl.c | 2 +- drivers/block/loop.c| 2 +- drivers/md/dm-table.c

[PATCH 09/27] mm: use bdev_is_zoned in claim_swapfile

2022-04-05 Thread Christoph Hellwig
Use the bdev based helper instead of poking into the queue. Signed-off-by: Christoph Hellwig --- mm/swapfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/swapfile.c b/mm/swapfile.c index 63c61f8b26118..4c7537162af5e 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c

[PATCH 08/27] ntfs3: use bdev_logical_block_size instead of open coding it

2022-04-05 Thread Christoph Hellwig
Signed-off-by: Christoph Hellwig --- fs/ntfs3/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c index 278dcf5024102..cd30e81abbce0 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -920,7 +920,7 @@ static int ntfs_fill_super

[PATCH 07/27] btrfs: use bdev_max_active_zones instead of open coding it

2022-04-05 Thread Christoph Hellwig
Signed-off-by: Christoph Hellwig --- fs/btrfs/zoned.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c index b7b5fac1c7790..5b85004d85d6c 100644 --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -350,7 +350,6 @@ int btrfs_get_dev_zone_info

[PATCH 06/27] drbd: cleanup decide_on_discard_support

2022-04-05 Thread Christoph Hellwig
Sanitize the calling conventions and use a goto label to cleanup the code flow. Signed-off-by: Christoph Hellwig --- drivers/block/drbd/drbd_nl.c | 68 +++- 1 file changed, 35 insertions(+), 33 deletions(-) diff --git a/drivers/block/drbd/drbd_nl.c b/drivers

[PATCH 05/27] drbd: use bdev based limit helpers in drbd_send_sizes

2022-04-05 Thread Christoph Hellwig
Use the bdev based limits helpers where they exist. Signed-off-by: Christoph Hellwig --- drivers/block/drbd/drbd_main.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index 74b1b2424efff

[PATCH 03/27] target: fix discard alignment on partitions

2022-04-05 Thread Christoph Hellwig
Use the proper bdev_discard_alignment helper that accounts for partition offsets. Fіxes: c66ac9db8d4a ("[SCSI] target: Add LIO target core v4.0.0-rc6") Signed-off-by: Christoph Hellwig --- drivers/target/target_core_device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)

[PATCH 04/27] drbd: remove assign_p_sizes_qlim

2022-04-05 Thread Christoph Hellwig
Fold each branch into its only caller. Signed-off-by: Christoph Hellwig --- drivers/block/drbd/drbd_main.c | 50 -- 1 file changed, 23 insertions(+), 27 deletions(-) diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index 9676a1d214bc5

[PATCH 02/27] target: pass a block_device to target_configure_unmap_from_queue

2022-04-05 Thread Christoph Hellwig
The target code is a consumer of the block layer and should generally work on struct block_device. Signed-off-by: Christoph Hellwig --- drivers/target/target_core_device.c | 5 +++-- drivers/target/target_core_file.c| 7 --- drivers/target/target_core_iblock.c | 2 +- include/target

[PATCH 01/27] target: remove an incorrect unmap zeroes data deduction

2022-04-05 Thread Christoph Hellwig
nvert WRITE_SAME to blkdev_issue_zeroout") Signed-off-by: Christoph Hellwig --- drivers/target/target_core_device.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index 44bb380e7390c..fa866acef5bb2 100644 --- a/driv

use block_device based APIs in block layer consumers

2022-04-05 Thread Christoph Hellwig
Hi Jens, this series cleanups up the block layer API so that APIs consumed by file systems are (almost) only struct block_devic based, so that file systems don't have to poke into block layer internals like the request_queue. I also found a bunch of existing bugs related to partition offsets and

Re: [PATCH 1/5] iommu: Replace uses of IOMMU_CAP_CACHE_COHERENCY with dev_is_dma_coherent()

2022-04-05 Thread Christoph Hellwig
On Tue, Apr 05, 2022 at 01:16:00PM -0300, Jason Gunthorpe wrote: > diff --git a/drivers/infiniband/hw/usnic/usnic_uiom.c > b/drivers/infiniband/hw/usnic/usnic_uiom.c > index 760b254ba42d6b..24d118198ac756 100644 > --- a/drivers/infiniband/hw/usnic/usnic_uiom.c > +++ b/drivers/infiniband/hw/usnic/u

Re: [PATCH v5 2/2] virtio-blk: support mq_ops->queue_rqs()

2022-04-05 Thread Christoph Hellwig
Looks good: Reviewed-by: Christoph Hellwig ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization

Re: [PATCH v5 1/2] virtio-blk: support polling I/O

2022-04-05 Thread Christoph Hellwig
ld have just done a "positive" check here as that is ab it easier to read: if (i == HCTX_TYPE_POLL) blk_mq_map_queues(&set->map[i]); else blk_mq_virtio_map_queues(&set->map[i], vblk->vdev, 0); Otherwise looks good: Reviewed-by:

Re: [PATCH v4 2/2] virtio-blk: support mq_ops->queue_rqs()

2022-04-05 Thread Christoph Hellwig
On Tue, Apr 05, 2022 at 02:31:22PM +0900, Suwan Kim wrote: > This patch supports mq_ops->queue_rqs() hook. It has an advantage of > batch submission to virtio-blk driver. It also helps polling I/O because > polling uses batched completion of block layer. Batch submission in > queue_rqs() can boost

Re: [PATCH v4 1/2] virtio-blk: support polling I/O

2022-04-05 Thread Christoph Hellwig
On Tue, Apr 05, 2022 at 02:31:21PM +0900, Suwan Kim wrote: > This patch supports polling I/O via virtio-blk driver. Polling > feature is enabled by module parameter "num_poll_queues" and it > sets dedicated polling queues for virtio-blk. This patch improves > the polling I/O throughput and latency.

Re: [PATCH 8/8] virtio_ring.h: do not include from exported header

2022-04-05 Thread Christoph Hellwig
On Tue, Apr 05, 2022 at 08:29:36AM +0200, Arnd Bergmann wrote: > I think the users all have their own copies, at least the ones I could > find on codesearch.debian.org. However, there are 27 virtio_*.h > files in include/uapi/linux that probably should stay together for > the purpose of defining th

Re: [PATCH v2] virtio-blk: Remove BUG_ON() in virtio_queue_rq()

2022-03-01 Thread Christoph Hellwig
Looks good, Reviewed-by: Christoph Hellwig ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization

Re: [PATCH] virtio-blk: Check the max discard segment for discard request

2022-02-24 Thread Christoph Hellwig
On Wed, Feb 23, 2022 at 09:36:27PM +0800, Xie Yongji wrote: > Currently we have a BUG_ON() to make sure the number of sg list > does not exceed queue_max_segments() in virtio_queue_rq(). > However, the block layer uses queue_max_discard_segments() > instead of queue_max_segments() to limit the sg l

[PATCH] vhost: use bvec_kmap_local in {get,put}u16_iotlb

2022-02-22 Thread Christoph Hellwig
Using local kmaps slightly reduces the chances to stray writes, and the bvec interface cleans up the code a little bit. Signed-off-by: Christoph Hellwig --- drivers/vhost/vringh.c | 18 -- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/vhost/vringh.c b

Re: [PATCH RFC v1 0/5] Add SCSI per device tagsets

2022-02-18 Thread Christoph Hellwig
On Fri, Feb 18, 2022 at 06:41:52PM +, Melanie Plageman (Microsoft) wrote: > Currently a single blk_mq_tag_set is associated with a Scsi_Host. When SCSI > controllers are limited, attaching multiple devices to the same controller is > required. In cloud environments with relatively high latency

[PATCH 5/5] virtio_blk: simplify refcounting

2022-02-15 Thread Christoph Hellwig
Implement the ->free_disk method to free the virtio_blk structure only once the last gendisk reference goes away instead of keeping a local refcount. Signed-off-by: Christoph Hellwig Reviewed-by: Stefan Hajnoczi Acked-by: Michael S. Tsirkin --- drivers/block/virtio_blk.c |

[PATCH 4/5] memstick/mspro_block: simplify refcounting

2022-02-15 Thread Christoph Hellwig
Implement the ->free_disk method to free the msb_data structure only once the last gendisk reference goes away instead of keeping a local refcount. Signed-off-by: Christoph Hellwig --- drivers/memstick/core/mspro_block.c | 49 + 1 file changed, 7 insertions(+),

[PATCH 1/5] block: add a ->free_disk method

2022-02-15 Thread Christoph Hellwig
is only called after a successful call to add_disk, which significantly simplifies the error handling path during probing. Signed-off-by: Christoph Hellwig --- block/genhd.c | 5 + include/linux/blkdev.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/block/genhd.c b/bl

[PATCH 3/5] memstick/mspro_block: fix handling of read-only devices

2022-02-15 Thread Christoph Hellwig
Use set_disk_ro to propagate the read-only state to the block layer instead of checking for it in ->open and leaking a reference in case of a read-only device. Signed-off-by: Christoph Hellwig --- drivers/memstick/core/mspro_block.c | 10 -- 1 file changed, 4 insertions(+), 6 deleti

[PATCH 2/5] memstick/ms_block: simplify refcounting

2022-02-15 Thread Christoph Hellwig
Implement the ->free_disk method to free the msb_data structure only once the last gendisk reference goes away instead of keeping a local refcount. Signed-off-by: Christoph Hellwig --- drivers/memstick/core/ms_block.c | 64 drivers/memstick/core/ms_block.h |

add a ->free_disk block_device_operation v3

2022-02-15 Thread Christoph Hellwig
Hi Jens, this series adds a ->free_disk method to struct block_device_operation so that drivers can defer freeing their disk private data until the gendisk goes away and don't need to play games with the validity of ->private_data. This also converts three simple drivers over as example, but even

Re: [PATCH v5 3/6] mm: make alloc_contig_range work at pageblock granularity

2022-02-13 Thread Christoph Hellwig
> +int > +isolate_single_pageblock(unsigned long boundary_pfn, gfp_t gfp_flags, int > isolate_before_boundary); Please avoid the completely unreadably long line. i.e. int isolate_single_pageblock(unsigned long boundary_pfn, gfp_t gfp_flags, int isolate_before_boundary); Same in

[PATCH 5/5] virtio_blk: simplify refcounting

2022-02-09 Thread Christoph Hellwig
Implement the ->free_disk method to free the virtio_blk structure only once the last gendisk reference goes away instead of keeping a local refcount. Signed-off-by: Christoph Hellwig --- drivers/block/virtio_blk.c | 74 +++--- 1 file changed, 21 insertions(+),

[PATCH 2/5] memstick/ms_block: simplify refcounting

2022-02-09 Thread Christoph Hellwig
Implement the ->free_disk method to free the msb_data structure only once the last gendisk reference goes away instead of keeping a local refcount. Signed-off-by: Christoph Hellwig --- drivers/memstick/core/ms_block.c | 64 drivers/memstick/core/ms_block.h |

[PATCH 4/5] memstick/mspro_block: simplify refcounting

2022-02-09 Thread Christoph Hellwig
Implement the ->free_disk method to free the msb_data structure only once the last gendisk reference goes away instead of keeping a local refcount. Signed-off-by: Christoph Hellwig --- drivers/memstick/core/mspro_block.c | 49 + 1 file changed, 7 insertions(+),

[PATCH 3/5] memstick/mspro_block: fix handling of read-only devices

2022-02-09 Thread Christoph Hellwig
Use set_disk_ro to propagate the read-only state to the block layer instead of checking for it in ->open and leaking a reference in case of a read-only device. Signed-off-by: Christoph Hellwig --- drivers/memstick/core/mspro_block.c | 10 -- 1 file changed, 4 insertions(+), 6 deleti

add a ->free_disk block_device_operation v2

2022-02-09 Thread Christoph Hellwig
Hi Jens, this series adds a ->free_disk method to struct block_device_operation so that drivers can defer freeing their disk private data until the gendisk goes away and don't need to play games with the validity of ->private_data. This also converts three simple drivers over as example, but even

[PATCH 1/5] block: add a ->free_disk method

2022-02-09 Thread Christoph Hellwig
Add a method to notify the driver that the gendisk is about to be freed. This allows drivers to tie the lifetime of their private data to that of the gendisk and thus deal with device removal races without expensive synchronization and boilerplate code. Signed-off-by: Christoph Hellwig

Re: [PATCH 2/5] virtio_blk: simplify refcounting

2022-02-03 Thread Christoph Hellwig
On Thu, Feb 03, 2022 at 09:15:53AM +, Stefan Hajnoczi wrote: > /* Make sure no work handler is accessing the device. */ > flush_work(&vblk->config_work); > > del_gendisk(vblk->disk); > blk_cleanup_disk(vblk->disk); > ^--- is virtblk_fre

[PATCH 4/5] memstick/mspro_block: fix handling of read-only devices

2022-02-02 Thread Christoph Hellwig
Use set_disk_ro to propagate the read-only state to the block layer instead of checking for it in ->open and leaking a reference in case of a read-only device. Signed-off-by: Christoph Hellwig --- drivers/memstick/core/mspro_block.c | 10 -- 1 file changed, 4 insertions(+), 6 deleti

[PATCH 5/5] memstick/mspro_block: simplify refcounting

2022-02-02 Thread Christoph Hellwig
Implement the ->free_disk method to free the msb_data structure only once the last gendisk reference goes away instead of keeping a local refcount. Signed-off-by: Christoph Hellwig --- drivers/memstick/core/mspro_block.c | 49 + 1 file changed, 7 insertions(+),

[PATCH 3/5] memstick/ms_block: simplify refcounting

2022-02-02 Thread Christoph Hellwig
Implement the ->free_disk method to free the msb_data structure only once the last gendisk reference goes away instead of keeping a local refcount. Signed-off-by: Christoph Hellwig --- drivers/memstick/core/ms_block.c | 64 drivers/memstick/core/ms_block.h |

[PATCH 2/5] virtio_blk: simplify refcounting

2022-02-02 Thread Christoph Hellwig
Implement the ->free_disk method to free the virtio_blk structure only once the last gendisk reference goes away instead of keeping a local refcount. Signed-off-by: Christoph Hellwig --- drivers/block/virtio_blk.c | 64 +++--- 1 file changed, 12 insertions(+),

[PATCH 1/5] block: add a ->free_disk method

2022-02-02 Thread Christoph Hellwig
Add a method to notify the driver that the gendisk is about to be freed. This allows drivers to tie the lifetime of their private data to that of the gendisk and thus deal with device removal races without expensive synchronization and boilerplate code. Signed-off-by: Christoph Hellwig

add a ->free_disk block_device_operation

2022-02-02 Thread Christoph Hellwig
Hi Jens, this series adds a ->free_disk method to struct block_device_operation so that drivers can defer freeing their disk private data until the gendisk goes away and don't need to play games with the validity of ->private_data. This also converts three simple drivers over as example, but even

[PATCH 3/4] dax: remove the DAXDEV_F_SYNC flag

2021-12-15 Thread Christoph Hellwig
Remove the DAXDEV_F_SYNC flag and thus the flags argument to alloc_dax and just let the drivers call set_dax_synchronous directly. Signed-off-by: Christoph Hellwig Reviewed-by: Pankaj Gupta Reviewed-by: Dan Williams --- drivers/dax/bus.c| 3 ++- drivers/dax/super.c | 6

[PATCH 4/4] dax: remove the copy_from_iter and copy_to_iter methods

2021-12-15 Thread Christoph Hellwig
remove indirect call from the read/write fast path as well as a lot of boilerplate code. Signed-off-by: Christoph Hellwig Reviewed-by: Vivek Goyal [virtiofs] --- drivers/dax/bus.c | 2 + drivers/dax/super.c | 36 ++-- drivers/md/dm-linear.c| 20

[PATCH 2/4] dax: simplify dax_synchronous and set_dax_synchronous

2021-12-15 Thread Christoph Hellwig
Remove the pointless wrappers. Signed-off-by: Christoph Hellwig Reviewed-by: Pankaj Gupta Reviewed-by: Dan Williams --- drivers/dax/super.c | 8 include/linux/dax.h | 12 ++-- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/drivers/dax/super.c b/drivers/dax

[PATCH 1/4] uio: remove copy_from_iter_flushcache() and copy_mc_to_iter()

2021-12-15 Thread Christoph Hellwig
These two wrappers are never used. Signed-off-by: Christoph Hellwig --- drivers/nvdimm/pmem.c | 4 +--- include/linux/uio.h | 20 +--- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c index 4190c8c46ca88

devirtualize kernel access to DAX v2

2021-12-15 Thread Christoph Hellwig
Hi Dan, this series cleans up a few loose end ends and then removes the copy_from_iter and copy_to_iter dax_operations methods in favor of straight calls. Changes since v1: - reword a 'no check' comment - clean up the flags for the copy routine variants - drop the last patch Diffstat: driver

Re: [PATCH 1/5] uio: remove copy_from_iter_flushcache() and copy_mc_to_iter()

2021-12-13 Thread Christoph Hellwig
On Sun, Dec 12, 2021 at 06:22:20AM -0800, Dan Williams wrote: > > - * Use the 'no check' versions of copy_from_iter_flushcache() and > > - * copy_mc_to_iter() to bypass HARDENED_USERCOPY overhead. Bounds > > + * Use the 'no check' versions of _copy_from_iter_flushcache() and > > + * _copy_mc_to_ite

Re: [PATCH 4/5] dax: remove the copy_from_iter and copy_to_iter methods

2021-12-13 Thread Christoph Hellwig
On Sun, Dec 12, 2021 at 06:39:16AM -0800, Dan Williams wrote: > > /* flag to check if device supports synchronous flush */ > > DAXDEV_SYNC, > > + /* do not use uncached operations to write data */ > > + DAXDEV_CACHED, > > + /* do not use mcsafe operations to read d

Re: [PATCH 4/5] dax: remove the copy_from_iter and copy_to_iter methods

2021-12-13 Thread Christoph Hellwig
On Sun, Dec 12, 2021 at 06:44:26AM -0800, Dan Williams wrote: > On Fri, Dec 10, 2021 at 6:17 AM Vivek Goyal wrote: > > Going forward, I am wondering should virtiofs use flushcache version as > > well. What if host filesystem is using DAX and mapping persistent memory > > pfn directly into qemu add

Re: [PATCH 5/5] dax: always use _copy_mc_to_iter in dax_copy_to_iter

2021-12-13 Thread Christoph Hellwig
On Sun, Dec 12, 2021 at 06:48:05AM -0800, Dan Williams wrote: > On Fri, Dec 10, 2021 at 6:05 AM Vivek Goyal wrote: > > > > On Thu, Dec 09, 2021 at 07:38:28AM +0100, Christoph Hellwig wrote: > > > While using the MC-safe copy routines is rather pointless on a virtual

[PATCH 4/5] dax: remove the copy_from_iter and copy_to_iter methods

2021-12-08 Thread Christoph Hellwig
, then use them everywhere as they fall back to the plain ones on s390 anyway and remove an indirect call from the read/write path as well as a lot of boilerplate code. Signed-off-by: Christoph Hellwig --- drivers/dax/super.c | 36 ++-- drivers/md/dm-linear.c| 20

[PATCH 1/5] uio: remove copy_from_iter_flushcache() and copy_mc_to_iter()

2021-12-08 Thread Christoph Hellwig
These two wrappers are never used. Signed-off-by: Christoph Hellwig --- drivers/nvdimm/pmem.c | 4 ++-- include/linux/uio.h | 20 +--- 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c index 4190c8c46ca88

[PATCH 3/5] dax: remove the DAXDEV_F_SYNC flag

2021-12-08 Thread Christoph Hellwig
Remove the DAXDEV_F_SYNC flag and thus the flags argument to alloc_dax and just let the drivers call set_dax_synchronous directly. Signed-off-by: Christoph Hellwig --- drivers/dax/bus.c| 3 ++- drivers/dax/super.c | 6 +- drivers/md/dm.c | 2 +- drivers

[PATCH 5/5] dax: always use _copy_mc_to_iter in dax_copy_to_iter

2021-12-08 Thread Christoph Hellwig
While using the MC-safe copy routines is rather pointless on a virtual device like virtiofs, it also isn't harmful at all. So just use _copy_mc_to_iter unconditionally to simplify the code. Signed-off-by: Christoph Hellwig --- drivers/dax/super.c | 10 -- fs/fuse/virtio_fs.c

<    1   2   3   4   5   6   7   8   9   10   >