All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mikulas Patocka <mpatocka@redhat.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, dm-devel@redhat.com,
	Zdenek Kabelac <zkabelac@redhat.com>
Subject: Re: [dm-devel] [PATCH 3/4] brd: enable discard
Date: Tue, 20 Sep 2022 13:47:27 -0400 (EDT)	[thread overview]
Message-ID: <alpine.LRH.2.02.2209201309270.22306@file01.intranet.prod.int.rdu2.redhat.com> (raw)
In-Reply-To: <YyluKtwOaLSPvNmI@infradead.org>



On Tue, 20 Sep 2022, Christoph Hellwig wrote:

> > @@ -289,6 +308,23 @@ static void brd_submit_bio(struct bio *b
> >  	struct bio_vec bvec;
> >  	struct bvec_iter iter;
> >  
> > +	if (bio_op(bio) == REQ_OP_DISCARD) {
> > +		sector_t len = bio_sectors(bio);
> > +		sector_t front_pad = -sector & (PAGE_SECTORS - 1);
> > +		sector += front_pad;
> > +		if (unlikely(len <= front_pad))
> > +			goto endio;
> > +		len -= front_pad;
> > +		len = round_down(len, PAGE_SECTORS);
> > +		while (len) {
> > +			brd_free_page(brd, sector);
> > +			sector += PAGE_SECTORS;
> > +			len -= PAGE_SECTORS;
> > +			cond_resched();
> > +		}
> > +		goto endio;
> > +	}
> > +
> >  	bio_for_each_segment(bvec, bio, iter) {
> 
> Please add separate helpers to each type of IO and just make the
> main submit_bio method a dispatch on the types instead of this
> spaghetti code.
> 
> > +	disk->queue->limits.discard_granularity = PAGE_SIZE;
> > +	blk_queue_max_discard_sectors(disk->queue, UINT_MAX);
> 
> We'll probably want an opt in for this new feature.

OK. I addressed these concerns and I'll send a second version of the patch 
set.

Mikulas
--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


WARNING: multiple messages have this Message-ID (diff)
From: Mikulas Patocka <mpatocka@redhat.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: Jens Axboe <axboe@kernel.dk>,
	Zdenek Kabelac <zkabelac@redhat.com>,
	linux-block@vger.kernel.org, dm-devel@redhat.com
Subject: Re: [PATCH 3/4] brd: enable discard
Date: Tue, 20 Sep 2022 13:47:27 -0400 (EDT)	[thread overview]
Message-ID: <alpine.LRH.2.02.2209201309270.22306@file01.intranet.prod.int.rdu2.redhat.com> (raw)
In-Reply-To: <YyluKtwOaLSPvNmI@infradead.org>



On Tue, 20 Sep 2022, Christoph Hellwig wrote:

> > @@ -289,6 +308,23 @@ static void brd_submit_bio(struct bio *b
> >  	struct bio_vec bvec;
> >  	struct bvec_iter iter;
> >  
> > +	if (bio_op(bio) == REQ_OP_DISCARD) {
> > +		sector_t len = bio_sectors(bio);
> > +		sector_t front_pad = -sector & (PAGE_SECTORS - 1);
> > +		sector += front_pad;
> > +		if (unlikely(len <= front_pad))
> > +			goto endio;
> > +		len -= front_pad;
> > +		len = round_down(len, PAGE_SECTORS);
> > +		while (len) {
> > +			brd_free_page(brd, sector);
> > +			sector += PAGE_SECTORS;
> > +			len -= PAGE_SECTORS;
> > +			cond_resched();
> > +		}
> > +		goto endio;
> > +	}
> > +
> >  	bio_for_each_segment(bvec, bio, iter) {
> 
> Please add separate helpers to each type of IO and just make the
> main submit_bio method a dispatch on the types instead of this
> spaghetti code.
> 
> > +	disk->queue->limits.discard_granularity = PAGE_SIZE;
> > +	blk_queue_max_discard_sectors(disk->queue, UINT_MAX);
> 
> We'll probably want an opt in for this new feature.

OK. I addressed these concerns and I'll send a second version of the patch 
set.

Mikulas


  reply	other threads:[~2022-09-20 17:47 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-16  8:58 [PATCH 0/4] brd: implement discard Mikulas Patocka
2022-09-16  8:58 ` [dm-devel] " Mikulas Patocka
2022-09-16  8:59 ` [PATCH 1/4] brd: make brd_insert_page return bool Mikulas Patocka
2022-09-16  8:59   ` [dm-devel] " Mikulas Patocka
2022-09-20  7:28   ` Christoph Hellwig
2022-09-20  7:28     ` [dm-devel] " Christoph Hellwig
2022-09-16  8:59 ` [PATCH 2/4] brd: extend the rcu regions to cover read and write Mikulas Patocka
2022-09-16  8:59   ` [dm-devel] " Mikulas Patocka
2022-09-20  7:38   ` Christoph Hellwig
2022-09-20  7:38     ` [dm-devel] " Christoph Hellwig
2022-09-16  9:00 ` [dm-devel] [PATCH 3/4] brd: enable discard Mikulas Patocka
2022-09-16  9:00   ` Mikulas Patocka
2022-09-20  7:39   ` [dm-devel] " Christoph Hellwig
2022-09-20  7:39     ` Christoph Hellwig
2022-09-20 17:47     ` Mikulas Patocka [this message]
2022-09-20 17:47       ` Mikulas Patocka
2022-09-16  9:00 ` [dm-devel] [PATCH 4/4] brd: implement secure erase and write zeroes Mikulas Patocka
2022-09-16  9:00   ` Mikulas Patocka
2022-09-20  7:29   ` Christoph Hellwig
2022-09-20  7:29     ` [dm-devel] " Christoph Hellwig
2022-09-20 17:46     ` Mikulas Patocka
2022-09-20 17:46       ` Mikulas Patocka

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=alpine.LRH.2.02.2209201309270.22306@file01.intranet.prod.int.rdu2.redhat.com \
    --to=mpatocka@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=dm-devel@redhat.com \
    --cc=hch@infradead.org \
    --cc=linux-block@vger.kernel.org \
    --cc=zkabelac@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.