linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Coly Li <colyli@suse.de>
To: Christoph Hellwig <hch@lst.de>
Cc: dm-devel@redhat.com, linux-xfs@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, linux-um@lists.infradead.org,
	linux-block@vger.kernel.org, drbd-dev@lists.linbit.com,
	nbd@other.debian.org, ceph-devel@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	xen-devel@lists.xenproject.org, linux-bcache@vger.kernel.org,
	linux-raid@vger.kernel.org, linux-mmc@vger.kernel.org,
	linux-mtd@lists.infradead.org, linux-nvme@lists.infradead.org,
	linux-s390@vger.kernel.org, linux-scsi@vger.kernel.org,
	Jens Axboe <axboe@kernel.dk>,
	target-devel@vger.kernel.org, linux-btrfs@vger.kernel.org,
	linux-ext4@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com,
	jfs-discussion@lists.sourceforge.net,
	linux-nilfs@vger.kernel.org, ntfs3@lists.linux.dev,
	ocfs2-devel@oss.oracle.com, linux-mm@kvack.org
Subject: Re: [PATCH 23/27] block: add a bdev_max_discard_sectors helper
Date: Thu, 7 Apr 2022 13:16:12 +0800	[thread overview]
Message-ID: <2aee78dd-d5b6-5444-da28-34ab2631b264@suse.de> (raw)
In-Reply-To: <20220406060516.409838-24-hch@lst.de>

On 4/6/22 2:05 PM, Christoph Hellwig wrote:
> Add a helper to query the number of sectors support per each discard bio
> based on the block device and use this helper to stop various places from
> poking into the request_queue to see if discard is supported and if so how
> much.  This mirrors what is done e.g. for write zeroes as well.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>


For the bcache part,

Acked-by: Coly Li <colyli@suse.de>


Thanks.


Coly Li



> ---
>   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  |  5 ++---
>   drivers/block/loop.c                |  9 +++------
>   drivers/block/rnbd/rnbd-srv-dev.h   |  6 +-----
>   drivers/block/xen-blkback/xenbus.c  |  2 +-
>   drivers/md/bcache/request.c         |  4 ++--
>   drivers/md/bcache/super.c           |  2 +-
>   drivers/md/bcache/sysfs.c           |  2 +-
>   drivers/md/dm-cache-target.c        |  9 +--------
>   drivers/md/dm-clone-target.c        |  9 +--------
>   drivers/md/dm-io.c                  |  2 +-
>   drivers/md/dm-log-writes.c          |  3 +--
>   drivers/md/dm-raid.c                |  9 ++-------
>   drivers/md/dm-table.c               |  4 +---
>   drivers/md/dm-thin.c                |  9 +--------
>   drivers/md/dm.c                     |  2 +-
>   drivers/md/md-linear.c              |  4 ++--
>   drivers/md/raid0.c                  |  2 +-
>   drivers/md/raid1.c                  |  6 +++---
>   drivers/md/raid10.c                 |  8 ++++----
>   drivers/md/raid5-cache.c            |  2 +-
>   drivers/target/target_core_device.c |  8 +++-----
>   fs/btrfs/extent-tree.c              |  4 ++--
>   fs/btrfs/ioctl.c                    |  2 +-
>   fs/exfat/file.c                     |  2 +-
>   fs/exfat/super.c                    | 10 +++-------
>   fs/ext4/ioctl.c                     | 10 +++-------
>   fs/ext4/super.c                     | 10 +++-------
>   fs/f2fs/f2fs.h                      |  3 +--
>   fs/f2fs/segment.c                   |  6 ++----
>   fs/fat/file.c                       |  2 +-
>   fs/fat/inode.c                      | 10 +++-------
>   fs/gfs2/rgrp.c                      |  2 +-
>   fs/jbd2/journal.c                   |  7 ++-----
>   fs/jfs/ioctl.c                      |  2 +-
>   fs/jfs/super.c                      |  8 ++------
>   fs/nilfs2/ioctl.c                   |  2 +-
>   fs/ntfs3/file.c                     |  2 +-
>   fs/ntfs3/super.c                    |  2 +-
>   fs/ocfs2/ioctl.c                    |  2 +-
>   fs/xfs/xfs_discard.c                |  2 +-
>   fs/xfs/xfs_super.c                  | 12 ++++--------
>   include/linux/blkdev.h              |  5 +++++
>   mm/swapfile.c                       | 17 ++---------------
>   48 files changed, 87 insertions(+), 163 deletions(-)

[snipped]


> diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
> index fdd0194f84dd0..e27f67f06a428 100644
> --- a/drivers/md/bcache/request.c
> +++ b/drivers/md/bcache/request.c
> @@ -1005,7 +1005,7 @@ static void cached_dev_write(struct cached_dev *dc, struct search *s)
>   		bio_get(s->iop.bio);
>   
>   		if (bio_op(bio) == REQ_OP_DISCARD &&
> -		    !blk_queue_discard(bdev_get_queue(dc->bdev)))
> +		    !bdev_max_discard_sectors(dc->bdev))
>   			goto insert_data;
>   
>   		/* I/O request sent to backing device */
> @@ -1115,7 +1115,7 @@ static void detached_dev_do_request(struct bcache_device *d, struct bio *bio,
>   	bio->bi_private = ddip;
>   
>   	if ((bio_op(bio) == REQ_OP_DISCARD) &&
> -	    !blk_queue_discard(bdev_get_queue(dc->bdev)))
> +	    !bdev_max_discard_sectors(dc->bdev))
>   		bio->bi_end_io(bio);
>   	else
>   		submit_bio_noacct(bio);
> diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
> index bf3de149d3c9f..296f200b2e208 100644
> --- a/drivers/md/bcache/super.c
> +++ b/drivers/md/bcache/super.c
> @@ -2350,7 +2350,7 @@ static int register_cache(struct cache_sb *sb, struct cache_sb_disk *sb_disk,
>   	ca->bdev->bd_holder = ca;
>   	ca->sb_disk = sb_disk;
>   
> -	if (blk_queue_discard(bdev_get_queue(bdev)))
> +	if (bdev_max_discard_sectors((bdev)))
>   		ca->discard = CACHE_DISCARD(&ca->sb);
>   
>   	ret = cache_alloc(ca);
> diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c
> index d1029d71ff3bc..c6f677059214d 100644
> --- a/drivers/md/bcache/sysfs.c
> +++ b/drivers/md/bcache/sysfs.c
> @@ -1151,7 +1151,7 @@ STORE(__bch_cache)
>   	if (attr == &sysfs_discard) {
>   		bool v = strtoul_or_return(buf);
>   
> -		if (blk_queue_discard(bdev_get_queue(ca->bdev)))
> +		if (bdev_max_discard_sectors(ca->bdev))
>   			ca->discard = v;
>   
>   		if (v != CACHE_DISCARD(&ca->sb)) {


[snipped]


  parent reply	other threads:[~2022-04-07  5:16 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-06  6:04 use block_device based APIs in block layer consumers Christoph Hellwig
2022-04-06  6:04 ` [PATCH 01/27] target: remove an incorrect unmap zeroes data deduction Christoph Hellwig
2022-04-07  3:05   ` [dm-devel] " Martin K. Petersen
2022-04-07  3:06   ` Martin K. Petersen
2022-04-06  6:04 ` [PATCH 02/27] target: pass a block_device to target_configure_unmap_from_queue Christoph Hellwig
2022-04-07  3:07   ` Martin K. Petersen
2022-04-06  6:04 ` [PATCH 03/27] target: fix discard alignment on partitions Christoph Hellwig
2022-04-07  3:14   ` [dm-devel] " Martin K. Petersen
2022-04-06  6:04 ` [PATCH 04/27] drbd: remove assign_p_sizes_qlim Christoph Hellwig
2022-04-06  6:04 ` [PATCH 05/27] drbd: use bdev based limit helpers in drbd_send_sizes Christoph Hellwig
2022-04-06  6:04 ` [PATCH 06/27] drbd: cleanup decide_on_discard_support Christoph Hellwig
2022-04-06  6:04 ` [PATCH 07/27] btrfs: use bdev_max_active_zones instead of open coding it Christoph Hellwig
2022-04-06  9:56   ` Johannes Thumshirn
2022-04-07 15:20   ` David Sterba
2022-04-07 15:26     ` Christoph Hellwig
2022-04-06  6:04 ` [PATCH 08/27] ntfs3: use bdev_logical_block_size " Christoph Hellwig
2022-04-06  6:04 ` [PATCH 09/27] mm: use bdev_is_zoned in claim_swapfile Christoph Hellwig
2022-04-06  6:04 ` [PATCH 10/27] block: add a bdev_nonrot helper Christoph Hellwig
2022-04-07  3:16   ` [Ocfs2-devel] " Martin K. Petersen
2022-04-07 15:21   ` David Sterba
2022-04-06  6:05 ` [PATCH 11/27] block: add a bdev_write_cache helper Christoph Hellwig
2022-04-07  3:17   ` [Ocfs2-devel] " Martin K. Petersen
2022-04-07 15:21   ` David Sterba
2022-04-06  6:05 ` [PATCH 12/27] block: add a bdev_fua helper Christoph Hellwig
2022-04-07  3:17   ` [Ocfs2-devel] " Martin K. Petersen
2022-04-06  6:05 ` [PATCH 13/27] block: add a bdev_stable_writes helper Christoph Hellwig
2022-04-07  3:18   ` [Ocfs2-devel] " Martin K. Petersen
2022-04-06  6:05 ` [PATCH 14/27] block: add a bdev_max_zone_append_sectors helper Christoph Hellwig
2022-04-06  8:52   ` Damien Le Moal
2022-04-06  9:58   ` Johannes Thumshirn
2022-04-07  3:15   ` [dm-devel] " Martin K. Petersen
2022-04-06  6:05 ` [PATCH 15/27] block: use bdev_alignment_offset in part_alignment_offset_show Christoph Hellwig
2022-04-07  3:19   ` [Ocfs2-devel] " Martin K. Petersen
2022-04-06  6:05 ` [PATCH 16/27] drbd: use bdev_alignment_offset instead of queue_alignment_offset Christoph Hellwig
2022-04-06  6:05 ` [PATCH 17/27] block: use bdev_alignment_offset in disk_alignment_offset_show Christoph Hellwig
2022-04-07  3:20   ` [Ocfs2-devel] " Martin K. Petersen
2022-04-06  6:05 ` [PATCH 18/27] block: move bdev_alignment_offset and queue_limit_alignment_offset out of line Christoph Hellwig
2022-04-07  3:21   ` [Ocfs2-devel] " Martin K. Petersen
2022-04-06  6:05 ` [PATCH 19/27] block: remove queue_discard_alignment Christoph Hellwig
2022-04-07  3:21   ` [Ocfs2-devel] " Martin K. Petersen
2022-04-06  6:05 ` [PATCH 20/27] block: use bdev_discard_alignment in part_discard_alignment_show Christoph Hellwig
2022-04-07  3:22   ` [Ocfs2-devel] " Martin K. Petersen
2022-04-06  6:05 ` [PATCH 21/27] block: move {bdev,queue_limit}_discard_alignment out of line Christoph Hellwig
2022-04-07  3:27   ` [Ocfs2-devel] [PATCH 21/27] block: move {bdev, queue_limit}_discard_alignment " Martin K. Petersen
2022-04-06  6:05 ` [PATCH 22/27] block: refactor discard bio size limiting Christoph Hellwig
2022-04-07  3:29   ` [Ocfs2-devel] " Martin K. Petersen
2022-04-07  8:03   ` Coly Li
2022-04-06  6:05 ` [PATCH 23/27] block: add a bdev_max_discard_sectors helper Christoph Hellwig
2022-04-06  9:53   ` [Cluster-devel] " Andreas Gruenbacher
2022-04-06 17:28   ` Ryusuke Konishi
2022-04-07  3:30   ` [Ocfs2-devel] " Martin K. Petersen
2022-04-07  5:16   ` Coly Li [this message]
2022-04-07 15:22   ` David Sterba
2022-04-06  6:05 ` [PATCH 24/27] block: add a bdev_discard_granularity helper Christoph Hellwig
2022-04-06 18:26   ` Ryusuke Konishi
2022-04-07  3:32   ` [Ocfs2-devel] " Martin K. Petersen
2022-04-07 15:26   ` David Sterba
2022-04-06  6:05 ` [PATCH 25/27] block: remove QUEUE_FLAG_DISCARD Christoph Hellwig
2022-04-07  3:34   ` [Ocfs2-devel] " Martin K. Petersen
2022-04-07  5:18   ` Coly Li
2022-04-06  6:05 ` [PATCH 26/27] block: uncouple REQ_OP_SECURE_ERASE from REQ_OP_DISCARD Christoph Hellwig
2022-04-07  3:36   ` [Ocfs2-devel] " Martin K. Petersen
2022-04-07  6:09   ` Coly Li
2022-04-07  7:01   ` Ryusuke Konishi
2022-04-07 15:26   ` David Sterba
2022-04-11 18:24   ` [f2fs-dev] " Jaegeuk Kim
2022-04-06  6:05 ` [PATCH 27/27] direct-io: remove random prefetches Christoph Hellwig
     [not found] ` <0b7ae3df301c4fdd8d37f773d8d1eb93@FR3P281MB0843.DEUP281.PROD.OUTLOOK.COM>
2022-04-06  7:04   ` [PATCH 15/27] block: use bdev_alignment_offset in part_alignment_offset_show Alan Robinson
2022-04-09  4:50 use block_device based APIs in block layer consumers v2 Christoph Hellwig
2022-04-09  4:50 ` [PATCH 23/27] block: add a bdev_max_discard_sectors helper Christoph Hellwig
2022-04-15  4:52 use block_device based APIs in block layer consumers v3 Christoph Hellwig
2022-04-15  4:52 ` [PATCH 23/27] block: add a bdev_max_discard_sectors helper Christoph Hellwig
2022-04-15  5:47   ` Chaitanya Kulkarni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2aee78dd-d5b6-5444-da28-34ab2631b264@suse.de \
    --to=colyli@suse.de \
    --cc=axboe@kernel.dk \
    --cc=ceph-devel@vger.kernel.org \
    --cc=cluster-devel@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=drbd-dev@lists.linbit.com \
    --cc=hch@lst.de \
    --cc=jfs-discussion@lists.sourceforge.net \
    --cc=linux-bcache@vger.kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-nilfs@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linux-um@lists.infradead.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=nbd@other.debian.org \
    --cc=ntfs3@lists.linux.dev \
    --cc=ocfs2-devel@oss.oracle.com \
    --cc=target-devel@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).