linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* linux-next: manual merge of the device-mapper tree with the block tree
@ 2010-07-06  4:33 Stephen Rothwell
  2010-07-06 14:30 ` Mike Snitzer
  0 siblings, 1 reply; 20+ messages in thread
From: Stephen Rothwell @ 2010-07-06  4:33 UTC (permalink / raw)
  To: Alasdair G Kergon
  Cc: linux-next, linux-kernel, FUJITA Tomonori, Jens Axboe, Mike Snitzer

Hi Alasdair,

Today's linux-next merge of the device-mapper tree got a conflict in
drivers/md/dm.c between commits 9add80db6089272d6bf13ef6b5dc7b3ddda1a887
("dm: stop using q->prepare_flush_fn") and
5e27e27e73b5bff903b3c30ffd5a0e17eb95c087 ("block: remove
q->prepare_flush_fn completely") from the block tree and commit
90c50ea6a71bcb1bdf1482007932cc7fb0902455
("dm-do-not-initialise-full-request-queue-when-bio-based") from the
device-mapper tree.

I fixed it up (see below) and can carry the fix as necessary.
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc drivers/md/dm.c
index d505a96,c49818a..0000000
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@@ -2116,6 -2165,73 +2154,72 @@@ int dm_create(int minor, struct mapped_
  	return 0;
  }
  
+ /*
+  * Functions to manage md->type.
+  * All are required to hold md->type_lock.
+  */
+ void dm_lock_md_type(struct mapped_device *md)
+ {
+ 	mutex_lock(&md->type_lock);
+ }
+ 
+ void dm_unlock_md_type(struct mapped_device *md)
+ {
+ 	mutex_unlock(&md->type_lock);
+ }
+ 
+ void dm_set_md_type(struct mapped_device *md, unsigned type)
+ {
+ 	md->type = type;
+ }
+ 
+ unsigned dm_get_md_type(struct mapped_device *md)
+ {
+ 	return md->type;
+ }
+ 
+ /*
+  * Fully initialize a request-based queue (->elevator, ->request_fn, etc).
+  */
+ static int dm_init_request_based_queue(struct mapped_device *md)
+ {
+ 	struct request_queue *q = NULL;
+ 
+ 	if (md->queue->elevator)
+ 		return 1;
+ 
+ 	/* Fully initialize the queue */
+ 	q = blk_init_allocated_queue(md->queue, dm_request_fn, NULL);
+ 	if (!q)
+ 		return 0;
+ 
+ 	md->queue = q;
+ 	md->saved_make_request_fn = md->queue->make_request_fn;
+ 	dm_init_md_queue(md);
+ 	blk_queue_softirq_done(md->queue, dm_softirq_done);
+ 	blk_queue_prep_rq(md->queue, dm_prep_fn);
+ 	blk_queue_lld_busy(md->queue, dm_lld_busy);
 -	blk_queue_ordered(md->queue, QUEUE_ORDERED_DRAIN_FLUSH,
 -			  dm_rq_prepare_flush);
++	blk_queue_ordered(md->queue, QUEUE_ORDERED_DRAIN_FLUSH);
+ 
+ 	elv_register_queue(md->queue);
+ 
+ 	return 1;
+ }
+ 
+ /*
+  * Setup the DM device's queue based on md's type
+  */
+ int dm_setup_md_queue(struct mapped_device *md)
+ {
+ 	if ((dm_get_md_type(md) == DM_TYPE_REQUEST_BASED) &&
+ 	    !dm_init_request_based_queue(md)) {
+ 		DMWARN("Cannot initialize queue for request-based mapped device");
+ 		return -EINVAL;
+ 	}
+ 
+ 	return 0;
+ }
+ 
  static struct mapped_device *dm_find_md(dev_t dev)
  {
  	struct mapped_device *md;

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: linux-next: manual merge of the device-mapper tree with the block tree
  2010-07-06  4:33 linux-next: manual merge of the device-mapper tree with the block tree Stephen Rothwell
@ 2010-07-06 14:30 ` Mike Snitzer
  0 siblings, 0 replies; 20+ messages in thread
From: Mike Snitzer @ 2010-07-06 14:30 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Alasdair G Kergon, linux-next, linux-kernel, FUJITA Tomonori, Jens Axboe

On Tue, Jul 06 2010 at 12:33am -0400,
Stephen Rothwell <sfr@canb.auug.org.au> wrote:

> Hi Alasdair,
> 
> Today's linux-next merge of the device-mapper tree got a conflict in
> drivers/md/dm.c between commits 9add80db6089272d6bf13ef6b5dc7b3ddda1a887
> ("dm: stop using q->prepare_flush_fn") and
> 5e27e27e73b5bff903b3c30ffd5a0e17eb95c087 ("block: remove
> q->prepare_flush_fn completely") from the block tree and commit
> 90c50ea6a71bcb1bdf1482007932cc7fb0902455
> ("dm-do-not-initialise-full-request-queue-when-bio-based") from the
> device-mapper tree.
> 
> I fixed it up (see below) and can carry the fix as necessary.

Hi Stephen,

Your fix is correct, thanks for carrying this until Alasdair gets a
chance to pick it up.

Mike

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: linux-next: manual merge of the device-mapper tree with the block tree
  2022-07-28  3:14 Stephen Rothwell
@ 2022-07-28  3:23 ` Ming Lei
  0 siblings, 0 replies; 20+ messages in thread
From: Ming Lei @ 2022-07-28  3:23 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Alasdair G Kergon, Mike Snitzer, Jens Axboe, Christoph Hellwig,
	Linux Kernel Mailing List, Linux Next Mailing List

On Thu, Jul 28, 2022 at 01:14:59PM +1000, Stephen Rothwell wrote:
> Hi all,
> 
> Today's linux-next merge of the device-mapper tree got a conflict in:
> 
>   drivers/md/dm.c
> 
> between commit:
> 
>   1be3479b8533 ("block: move ->bio_split to the gendisk")
> 
> from the block tree and commit:
> 
>   8b211aaccb91 ("dm: add two stage requeue mechanism")
> 
> from the device-mapper tree.
> 
> I fixed it up (see below) and can carry the fix as necessary. This
> is now fixed as far as linux-next is concerned, but any non trivial
> conflicts should be mentioned to your upstream maintainer when your tree
> is submitted for merging.  You may also want to consider cooperating
> with the maintainer of the conflicting tree to minimise any particularly
> complex conflicts.
> 
> -- 
> Cheers,
> Stephen Rothwell
> 
> diff --cc drivers/md/dm.c
> index b7458f2dd3e4,47bcc5081b2b..000000000000
> --- a/drivers/md/dm.c
> +++ b/drivers/md/dm.c
> @@@ -962,6 -1001,58 +1001,58 @@@ static void __dm_io_complete(struct dm_
>   	}
>   }
>   
> + static void dm_wq_requeue_work(struct work_struct *work)
> + {
> + 	struct mapped_device *md = container_of(work, struct mapped_device,
> + 						requeue_work);
> + 	unsigned long flags;
> + 	struct dm_io *io;
> + 
> + 	/* reuse deferred lock to simplify dm_handle_requeue */
> + 	spin_lock_irqsave(&md->deferred_lock, flags);
> + 	io = md->requeue_list;
> + 	md->requeue_list = NULL;
> + 	spin_unlock_irqrestore(&md->deferred_lock, flags);
> + 
> + 	while (io) {
> + 		struct dm_io *next = io->next;
> + 
>  -		dm_io_rewind(io, &md->queue->bio_split);
> ++		dm_io_rewind(io, &md->disk->bio_split);

This fix looks fine.


Thanks,
Ming


^ permalink raw reply	[flat|nested] 20+ messages in thread

* linux-next: manual merge of the device-mapper tree with the block tree
@ 2022-07-28  3:14 Stephen Rothwell
  2022-07-28  3:23 ` Ming Lei
  0 siblings, 1 reply; 20+ messages in thread
From: Stephen Rothwell @ 2022-07-28  3:14 UTC (permalink / raw)
  To: Alasdair G Kergon, Mike Snitzer, Jens Axboe
  Cc: Christoph Hellwig, Linux Kernel Mailing List,
	Linux Next Mailing List, Ming Lei

[-- Attachment #1: Type: text/plain, Size: 2584 bytes --]

Hi all,

Today's linux-next merge of the device-mapper tree got a conflict in:

  drivers/md/dm.c

between commit:

  1be3479b8533 ("block: move ->bio_split to the gendisk")

from the block tree and commit:

  8b211aaccb91 ("dm: add two stage requeue mechanism")

from the device-mapper tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc drivers/md/dm.c
index b7458f2dd3e4,47bcc5081b2b..000000000000
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@@ -962,6 -1001,58 +1001,58 @@@ static void __dm_io_complete(struct dm_
  	}
  }
  
+ static void dm_wq_requeue_work(struct work_struct *work)
+ {
+ 	struct mapped_device *md = container_of(work, struct mapped_device,
+ 						requeue_work);
+ 	unsigned long flags;
+ 	struct dm_io *io;
+ 
+ 	/* reuse deferred lock to simplify dm_handle_requeue */
+ 	spin_lock_irqsave(&md->deferred_lock, flags);
+ 	io = md->requeue_list;
+ 	md->requeue_list = NULL;
+ 	spin_unlock_irqrestore(&md->deferred_lock, flags);
+ 
+ 	while (io) {
+ 		struct dm_io *next = io->next;
+ 
 -		dm_io_rewind(io, &md->queue->bio_split);
++		dm_io_rewind(io, &md->disk->bio_split);
+ 
+ 		io->next = NULL;
+ 		__dm_io_complete(io, false);
+ 		io = next;
+ 	}
+ }
+ 
+ /*
+  * Two staged requeue:
+  *
+  * 1) io->orig_bio points to the real original bio, and the part mapped to
+  *    this io must be requeued, instead of other parts of the original bio.
+  *
+  * 2) io->orig_bio points to new cloned bio which matches the requeued dm_io.
+  */
+ static void dm_io_complete(struct dm_io *io)
+ {
+ 	bool first_requeue;
+ 
+ 	/*
+ 	 * Only dm_io that has been split needs two stage requeue, otherwise
+ 	 * we may run into long bio clone chain during suspend and OOM could
+ 	 * be triggered.
+ 	 *
+ 	 * Also flush data dm_io won't be marked as DM_IO_WAS_SPLIT, so they
+ 	 * also aren't handled via the first stage requeue.
+ 	 */
+ 	if (dm_io_flagged(io, DM_IO_WAS_SPLIT))
+ 		first_requeue = true;
+ 	else
+ 		first_requeue = false;
+ 
+ 	__dm_io_complete(io, first_requeue);
+ }
+ 
  /*
   * Decrements the number of outstanding ios that a bio has been
   * cloned into, completing the original io if necc.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: linux-next: manual merge of the device-mapper tree with the block tree
  2022-04-01  5:20 ` Christoph Hellwig
@ 2022-04-01 16:28   ` Mike Snitzer
  0 siblings, 0 replies; 20+ messages in thread
From: Mike Snitzer @ 2022-04-01 16:28 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Stephen Rothwell, Alasdair G Kergon, Jens Axboe,
	Linux Kernel Mailing List, Linux Next Mailing List

On Fri, Apr 01 2022 at  1:20P -0400,
Christoph Hellwig <hch@lst.de> wrote:

> On Thu, Mar 31, 2022 at 09:44:25AM +1100, Stephen Rothwell wrote:
> > Hi all,
> > 
> > Today's linux-next merge of the device-mapper tree got a conflict in:
> > 
> >   include/linux/bio.h
> > 
> > between commit:
> > 
> >   57c47b42f454 ("block: turn bio_kmalloc into a simple kmalloc wrapper")
> > 
> > from the block tree and commit:
> > 
> >   135eaaabd22a ("block: allow using the per-cpu bio cache from bio_alloc_bioset")
> 
> Isn't this something Jens already had queued up in the block tree?
> 

Yes, but Jens hasn't staged 5.19 commits taken early in linux-next
yet.  So I just left the changes in linux-dm.git's for-next to get
coverage in the interim.

Mike

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: linux-next: manual merge of the device-mapper tree with the block tree
  2022-03-30 22:44 Stephen Rothwell
@ 2022-04-01  5:20 ` Christoph Hellwig
  2022-04-01 16:28   ` Mike Snitzer
  0 siblings, 1 reply; 20+ messages in thread
From: Christoph Hellwig @ 2022-04-01  5:20 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Alasdair G Kergon, Mike Snitzer, Jens Axboe, Christoph Hellwig,
	Linux Kernel Mailing List, Linux Next Mailing List

On Thu, Mar 31, 2022 at 09:44:25AM +1100, Stephen Rothwell wrote:
> Hi all,
> 
> Today's linux-next merge of the device-mapper tree got a conflict in:
> 
>   include/linux/bio.h
> 
> between commit:
> 
>   57c47b42f454 ("block: turn bio_kmalloc into a simple kmalloc wrapper")
> 
> from the block tree and commit:
> 
>   135eaaabd22a ("block: allow using the per-cpu bio cache from bio_alloc_bioset")

Isn't this something Jens already had queued up in the block tree?

^ permalink raw reply	[flat|nested] 20+ messages in thread

* linux-next: manual merge of the device-mapper tree with the block tree
@ 2022-03-30 22:44 Stephen Rothwell
  2022-04-01  5:20 ` Christoph Hellwig
  0 siblings, 1 reply; 20+ messages in thread
From: Stephen Rothwell @ 2022-03-30 22:44 UTC (permalink / raw)
  To: Alasdair G Kergon, Mike Snitzer, Jens Axboe
  Cc: Christoph Hellwig, Linux Kernel Mailing List, Linux Next Mailing List

[-- Attachment #1: Type: text/plain, Size: 1535 bytes --]

Hi all,

Today's linux-next merge of the device-mapper tree got a conflict in:

  include/linux/bio.h

between commit:

  57c47b42f454 ("block: turn bio_kmalloc into a simple kmalloc wrapper")

from the block tree and commit:

  135eaaabd22a ("block: allow using the per-cpu bio cache from bio_alloc_bioset")

from the device-mapper tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc include/linux/bio.h
index ab77473c855b,8c42b67c41c7..000000000000
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@@ -405,9 -408,7 +405,7 @@@ extern int bioset_init_from_src(struct 
  struct bio *bio_alloc_bioset(struct block_device *bdev, unsigned short nr_vecs,
  			     unsigned int opf, gfp_t gfp_mask,
  			     struct bio_set *bs);
- struct bio *bio_alloc_kiocb(struct kiocb *kiocb, struct block_device *bdev,
- 		unsigned short nr_vecs, unsigned int opf, struct bio_set *bs);
 -struct bio *bio_kmalloc(gfp_t gfp_mask, unsigned short nr_iovecs);
 +struct bio *bio_kmalloc(unsigned short nr_vecs, gfp_t gfp_mask);
  extern void bio_put(struct bio *);
  
  struct bio *bio_alloc_clone(struct block_device *bdev, struct bio *bio_src,

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* linux-next: manual merge of the device-mapper tree with the block tree
@ 2021-08-10  1:55 Stephen Rothwell
  0 siblings, 0 replies; 20+ messages in thread
From: Stephen Rothwell @ 2021-08-10  1:55 UTC (permalink / raw)
  To: Alasdair G Kergon, Mike Snitzer, Jens Axboe
  Cc: Christoph Hellwig, Linux Kernel Mailing List,
	Linux Next Mailing List, Tushar Sugandhi

[-- Attachment #1: Type: text/plain, Size: 1098 bytes --]

Hi all,

Today's linux-next merge of the device-mapper tree got a conflict in:

  drivers/md/dm.c

between commit:

  89f871af1b26 ("dm: delay registering the gendisk")

from the block tree and commit:

  0a3bec81a409 ("dm ima: measure data on table load")

from the device-mapper tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc drivers/md/dm.c
index 7981b7287628,2e82757b4ab7..000000000000
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@@ -1997,6 -2001,14 +1998,8 @@@ int dm_create(int minor, struct mapped_
  	if (!md)
  		return -ENXIO;
  
 -	r = dm_sysfs_init(md);
 -	if (r) {
 -		free_dev(md);
 -		return r;
 -	}
 -
+ 	dm_ima_reset_data(md);
+ 
  	*result = md;
  	return 0;
  }

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* linux-next: manual merge of the device-mapper tree with the block tree
@ 2020-07-09  3:21 Stephen Rothwell
  0 siblings, 0 replies; 20+ messages in thread
From: Stephen Rothwell @ 2020-07-09  3:21 UTC (permalink / raw)
  To: Alasdair G Kergon, Mike Snitzer, Jens Axboe
  Cc: Linux Next Mailing List, Linux Kernel Mailing List,
	Christoph Hellwig, Ignat Korchagin

[-- Attachment #1: Type: text/plain, Size: 1335 bytes --]

Hi all,

Today's linux-next merge of the device-mapper tree got a conflict in:

  drivers/md/dm-crypt.c

between commit:

  ed00aabd5eb9 ("block: rename generic_make_request to submit_bio_noacct")

from the block tree and commit:

  202b8d712016 ("dm crypt: add flags to optionally bypass kcryptd workqueues")

from the device-mapper tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc drivers/md/dm-crypt.c
index b437a14c4942,bad05c5ed3b5..000000000000
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@@ -1892,8 -1896,9 +1896,9 @@@ static void kcryptd_crypt_write_io_subm
  
  	clone->bi_iter.bi_sector = cc->start + io->sector;
  
- 	if (likely(!async) && test_bit(DM_CRYPT_NO_OFFLOAD, &cc->flags)) {
+ 	if ((likely(!async) && test_bit(DM_CRYPT_NO_OFFLOAD, &cc->flags)) ||
+ 	    test_bit(DM_CRYPT_NO_WRITE_WORKQUEUE, &cc->flags)) {
 -		generic_make_request(clone);
 +		submit_bio_noacct(clone);
  		return;
  	}
  

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* linux-next: manual merge of the device-mapper tree with the block tree
@ 2020-05-22  5:17 Stephen Rothwell
  0 siblings, 0 replies; 20+ messages in thread
From: Stephen Rothwell @ 2020-05-22  5:17 UTC (permalink / raw)
  To: Alasdair G Kergon, Mike Snitzer, Jens Axboe
  Cc: Linux Next Mailing List, Linux Kernel Mailing List,
	Christoph Hellwig, Hannes Reinecke

[-- Attachment #1: Type: text/plain, Size: 2182 bytes --]

Hi all,

Today's linux-next merge of the device-mapper tree got a conflict in:

  drivers/md/dm-zoned-metadata.c

between commit:

  c64644ce363b ("block: remove the error_sector argument to blkdev_issue_flush")

from the block tree and commit:

  bf28a3ba0986 ("dm zoned: store device in struct dmz_sb")

from the device-mapper tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc drivers/md/dm-zoned-metadata.c
index bf2245370305,db0dc2b5d44d..000000000000
--- a/drivers/md/dm-zoned-metadata.c
+++ b/drivers/md/dm-zoned-metadata.c
@@@ -659,9 -816,10 +816,10 @@@ static int dmz_write_sb(struct dmz_meta
  	sb->crc = 0;
  	sb->crc = cpu_to_le32(crc32_le(sb_gen, (unsigned char *)sb, DMZ_BLOCK_SIZE));
  
- 	ret = dmz_rdwr_block(zmd, REQ_OP_WRITE, block, mblk->page);
+ 	ret = dmz_rdwr_block(dev, REQ_OP_WRITE, zmd->sb[set].block,
+ 			     mblk->page);
  	if (ret == 0)
- 		ret = blkdev_issue_flush(zmd->dev->bdev, GFP_NOIO);
 -		ret = blkdev_issue_flush(dev->bdev, GFP_NOIO, NULL);
++		ret = blkdev_issue_flush(dev->bdev, GFP_NOIO);
  
  	return ret;
  }
@@@ -703,7 -862,7 +862,7 @@@ static int dmz_write_dirty_mblocks(stru
  
  	/* Flush drive cache (this will also sync data) */
  	if (ret == 0)
- 		ret = blkdev_issue_flush(zmd->dev->bdev, GFP_NOIO);
 -		ret = blkdev_issue_flush(dev->bdev, GFP_NOIO, NULL);
++		ret = blkdev_issue_flush(dev->bdev, GFP_NOIO);
  
  	return ret;
  }
@@@ -772,7 -933,7 +933,7 @@@ int dmz_flush_metadata(struct dmz_metad
  
  	/* If there are no dirty metadata blocks, just flush the device cache */
  	if (list_empty(&write_list)) {
- 		ret = blkdev_issue_flush(zmd->dev->bdev, GFP_NOIO);
 -		ret = blkdev_issue_flush(dev->bdev, GFP_NOIO, NULL);
++		ret = blkdev_issue_flush(dev->bdev, GFP_NOIO);
  		goto err;
  	}
  

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: linux-next: manual merge of the device-mapper tree with the block tree
  2018-12-10  3:55 ` Jens Axboe
@ 2018-12-10  5:13   ` Mike Snitzer
  0 siblings, 0 replies; 20+ messages in thread
From: Mike Snitzer @ 2018-12-10  5:13 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Stephen Rothwell, Alasdair G Kergon, Linux Next Mailing List,
	Linux Kernel Mailing List

On Sun, Dec 09 2018 at 10:55pm -0500,
Jens Axboe <axboe@kernel.dk> wrote:

> On 12/9/18 8:43 PM, Stephen Rothwell wrote:
> > Hi all,
> > 
> > It appears that there are a series of shared patches between the block
> > and device-mapper trees that are not the same commits.  I assume that the
> > block tree has been rebased, while the device mapper tree that was based
> > (or includes) part of the block tree has not bee rebased (yet).
> 
> Yep that's my fault, due to a stupid mistake I had to rebase the
> block tree. Didn't realize that Mike's tree was based on it. Mike,
> would it be a big issue for you to rebase the dm tree?

No problem, just did it and pushed to linux-dm.git's for-next.
(I was already anticipating rebasing dm's for-next again once the
bio-based percpu in_flight was merged into linux-block, hopefully we can
get that to land)

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: linux-next: manual merge of the device-mapper tree with the block tree
  2018-12-10  3:43 Stephen Rothwell
@ 2018-12-10  3:55 ` Jens Axboe
  2018-12-10  5:13   ` Mike Snitzer
  0 siblings, 1 reply; 20+ messages in thread
From: Jens Axboe @ 2018-12-10  3:55 UTC (permalink / raw)
  To: Stephen Rothwell, Alasdair G Kergon, Mike Snitzer
  Cc: Linux Next Mailing List, Linux Kernel Mailing List

On 12/9/18 8:43 PM, Stephen Rothwell wrote:
> Hi all,
> 
> It appears that there are a series of shared patches between the block
> and device-mapper trees that are not the same commits.  I assume that the
> block tree has been rebased, while the device mapper tree that was based
> (or includes) part of the block tree has not bee rebased (yet).

Yep that's my fault, due to a stupid mistake I had to rebase the
block tree. Didn't realize that Mike's tree was based on it. Mike,
would it be a big issue for you to rebase the dm tree?

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 20+ messages in thread

* linux-next: manual merge of the device-mapper tree with the block tree
@ 2018-12-10  3:43 Stephen Rothwell
  2018-12-10  3:55 ` Jens Axboe
  0 siblings, 1 reply; 20+ messages in thread
From: Stephen Rothwell @ 2018-12-10  3:43 UTC (permalink / raw)
  To: Alasdair G Kergon, Mike Snitzer, Jens Axboe
  Cc: Linux Next Mailing List, Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 331 bytes --]

Hi all,

It appears that there are a series of shared patches between the block
and device-mapper trees that are not the same commits.  I assume that the
block tree has been rebased, while the device mapper tree that was based
(or includes) part of the block tree has not bee rebased (yet).

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* linux-next: manual merge of the device-mapper tree with the block tree
@ 2016-07-21  3:27 Stephen Rothwell
  0 siblings, 0 replies; 20+ messages in thread
From: Stephen Rothwell @ 2016-07-21  3:27 UTC (permalink / raw)
  To: Alasdair G Kergon, Mike Snitzer, Jens Axboe
  Cc: linux-next, linux-kernel, Christoph Hellwig

Hi all,

Today's linux-next merge of the device-mapper tree got a conflict in:

  drivers/md/dm.c

between commit:

  4cc96131afce ("dm: move request-based code out to dm-rq.[hc]")

from the block tree and commit:

  70246286e94c ("block: get rid of bio_rw and READA")

from the device-mapper tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc drivers/md/dm.c
index 812fd5984eea,4dca5a792e4b..000000000000
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@@ -1684,512 -1141,165 +1141,165 @@@ static unsigned get_num_write_same_bios
  	return ti->num_write_same_bios;
  }
  
- typedef bool (*is_split_required_fn)(struct dm_target *ti);
- 
- static bool is_split_required_for_discard(struct dm_target *ti)
- {
- 	return ti->split_discard_bios;
- }
- 
- static int __send_changing_extent_only(struct clone_info *ci,
- 				       get_num_bios_fn get_num_bios,
- 				       is_split_required_fn is_split_required)
- {
- 	struct dm_target *ti;
- 	unsigned len;
- 	unsigned num_bios;
- 
- 	do {
- 		ti = dm_table_find_target(ci->map, ci->sector);
- 		if (!dm_target_is_valid(ti))
- 			return -EIO;
- 
- 		/*
- 		 * Even though the device advertised support for this type of
- 		 * request, that does not mean every target supports it, and
- 		 * reconfiguration might also have changed that since the
- 		 * check was performed.
- 		 */
- 		num_bios = get_num_bios ? get_num_bios(ti) : 0;
- 		if (!num_bios)
- 			return -EOPNOTSUPP;
- 
- 		if (is_split_required && !is_split_required(ti))
- 			len = min((sector_t)ci->sector_count, max_io_len_target_boundary(ci->sector, ti));
- 		else
- 			len = min((sector_t)ci->sector_count, max_io_len(ci->sector, ti));
- 
- 		__send_duplicate_bios(ci, ti, num_bios, &len);
- 
- 		ci->sector += len;
- 	} while (ci->sector_count -= len);
- 
- 	return 0;
- }
- 
- static int __send_discard(struct clone_info *ci)
- {
- 	return __send_changing_extent_only(ci, get_num_discard_bios,
- 					   is_split_required_for_discard);
- }
- 
- static int __send_write_same(struct clone_info *ci)
- {
- 	return __send_changing_extent_only(ci, get_num_write_same_bios, NULL);
- }
- 
- /*
-  * Select the correct strategy for processing a non-flush bio.
-  */
- static int __split_and_process_non_flush(struct clone_info *ci)
- {
- 	struct bio *bio = ci->bio;
- 	struct dm_target *ti;
- 	unsigned len;
- 	int r;
- 
- 	if (unlikely(bio_op(bio) == REQ_OP_DISCARD))
- 		return __send_discard(ci);
- 	else if (unlikely(bio_op(bio) == REQ_OP_WRITE_SAME))
- 		return __send_write_same(ci);
- 
- 	ti = dm_table_find_target(ci->map, ci->sector);
- 	if (!dm_target_is_valid(ti))
- 		return -EIO;
- 
- 	len = min_t(sector_t, max_io_len(ci->sector, ti), ci->sector_count);
- 
- 	r = __clone_and_map_data_bio(ci, ti, ci->sector, &len);
- 	if (r < 0)
- 		return r;
- 
- 	ci->sector += len;
- 	ci->sector_count -= len;
- 
- 	return 0;
- }
- 
- /*
-  * Entry point to split a bio into clones and submit them to the targets.
-  */
- static void __split_and_process_bio(struct mapped_device *md,
- 				    struct dm_table *map, struct bio *bio)
- {
- 	struct clone_info ci;
- 	int error = 0;
- 
- 	if (unlikely(!map)) {
- 		bio_io_error(bio);
- 		return;
- 	}
- 
- 	ci.map = map;
- 	ci.md = md;
- 	ci.io = alloc_io(md);
- 	ci.io->error = 0;
- 	atomic_set(&ci.io->io_count, 1);
- 	ci.io->bio = bio;
- 	ci.io->md = md;
- 	spin_lock_init(&ci.io->endio_lock);
- 	ci.sector = bio->bi_iter.bi_sector;
- 
- 	start_io_acct(ci.io);
- 
- 	if (bio->bi_rw & REQ_PREFLUSH) {
- 		ci.bio = &ci.md->flush_bio;
- 		ci.sector_count = 0;
- 		error = __send_empty_flush(&ci);
- 		/* dec_pending submits any data associated with flush */
- 	} else {
- 		ci.bio = bio;
- 		ci.sector_count = bio_sectors(bio);
- 		while (ci.sector_count && !error)
- 			error = __split_and_process_non_flush(&ci);
- 	}
- 
- 	/* drop the extra reference count */
- 	dec_pending(ci.io, error);
- }
- /*-----------------------------------------------------------------
-  * CRUD END
-  *---------------------------------------------------------------*/
- 
- /*
-  * The request function that just remaps the bio built up by
-  * dm_merge_bvec.
-  */
- static blk_qc_t dm_make_request(struct request_queue *q, struct bio *bio)
- {
- 	int rw = bio_data_dir(bio);
- 	struct mapped_device *md = q->queuedata;
- 	int srcu_idx;
- 	struct dm_table *map;
- 
- 	map = dm_get_live_table(md, &srcu_idx);
- 
- 	generic_start_io_acct(rw, bio_sectors(bio), &dm_disk(md)->part0);
- 
- 	/* if we're suspended, we have to queue this io for later */
- 	if (unlikely(test_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags))) {
- 		dm_put_live_table(md, srcu_idx);
- 
- 		if (!(bio->bi_rw & REQ_RAHEAD))
- 			queue_io(md, bio);
- 		else
- 			bio_io_error(bio);
- 		return BLK_QC_T_NONE;
- 	}
- 
- 	__split_and_process_bio(md, map, bio);
- 	dm_put_live_table(md, srcu_idx);
- 	return BLK_QC_T_NONE;
- }
- 
- int dm_request_based(struct mapped_device *md)
- {
- 	return blk_queue_stackable(md->queue);
- }
- 
- static void dm_dispatch_clone_request(struct request *clone, struct request *rq)
- {
- 	int r;
- 
- 	if (blk_queue_io_stat(clone->q))
- 		clone->cmd_flags |= REQ_IO_STAT;
- 
- 	clone->start_time = jiffies;
- 	r = blk_insert_cloned_request(clone->q, clone);
- 	if (r)
- 		/* must complete clone in terms of original request */
- 		dm_complete_request(rq, r);
- }
- 
- static int dm_rq_bio_constructor(struct bio *bio, struct bio *bio_orig,
- 				 void *data)
- {
- 	struct dm_rq_target_io *tio = data;
- 	struct dm_rq_clone_bio_info *info =
- 		container_of(bio, struct dm_rq_clone_bio_info, clone);
- 
- 	info->orig = bio_orig;
- 	info->tio = tio;
- 	bio->bi_end_io = end_clone_bio;
- 
- 	return 0;
- }
- 
- static int setup_clone(struct request *clone, struct request *rq,
- 		       struct dm_rq_target_io *tio, gfp_t gfp_mask)
- {
- 	int r;
- 
- 	r = blk_rq_prep_clone(clone, rq, tio->md->bs, gfp_mask,
- 			      dm_rq_bio_constructor, tio);
- 	if (r)
- 		return r;
- 
- 	clone->cmd = rq->cmd;
- 	clone->cmd_len = rq->cmd_len;
- 	clone->sense = rq->sense;
- 	clone->end_io = end_clone_request;
- 	clone->end_io_data = tio;
- 
- 	tio->clone = clone;
- 
- 	return 0;
- }
- 
- static struct request *clone_old_rq(struct request *rq, struct mapped_device *md,
- 				    struct dm_rq_target_io *tio, gfp_t gfp_mask)
- {
- 	/*
- 	 * Create clone for use with .request_fn request_queue
- 	 */
- 	struct request *clone;
- 
- 	clone = alloc_old_clone_request(md, gfp_mask);
- 	if (!clone)
- 		return NULL;
- 
- 	blk_rq_init(NULL, clone);
- 	if (setup_clone(clone, rq, tio, gfp_mask)) {
- 		/* -ENOMEM */
- 		free_old_clone_request(md, clone);
- 		return NULL;
- 	}
- 
- 	return clone;
- }
- 
- static void map_tio_request(struct kthread_work *work);
- 
- static void init_tio(struct dm_rq_target_io *tio, struct request *rq,
- 		     struct mapped_device *md)
- {
- 	tio->md = md;
- 	tio->ti = NULL;
- 	tio->clone = NULL;
- 	tio->orig = rq;
- 	tio->error = 0;
- 	/*
- 	 * Avoid initializing info for blk-mq; it passes
- 	 * target-specific data through info.ptr
- 	 * (see: dm_mq_init_request)
- 	 */
- 	if (!md->init_tio_pdu)
- 		memset(&tio->info, 0, sizeof(tio->info));
- 	if (md->kworker_task)
- 		init_kthread_work(&tio->work, map_tio_request);
- }
- 
- static struct dm_rq_target_io *dm_old_prep_tio(struct request *rq,
- 					       struct mapped_device *md,
- 					       gfp_t gfp_mask)
- {
- 	struct dm_rq_target_io *tio;
- 	int srcu_idx;
- 	struct dm_table *table;
- 
- 	tio = alloc_old_rq_tio(md, gfp_mask);
- 	if (!tio)
- 		return NULL;
- 
- 	init_tio(tio, rq, md);
- 
- 	table = dm_get_live_table(md, &srcu_idx);
- 	/*
- 	 * Must clone a request if this .request_fn DM device
- 	 * is stacked on .request_fn device(s).
- 	 */
- 	if (!dm_table_mq_request_based(table)) {
- 		if (!clone_old_rq(rq, md, tio, gfp_mask)) {
- 			dm_put_live_table(md, srcu_idx);
- 			free_old_rq_tio(tio);
- 			return NULL;
- 		}
- 	}
- 	dm_put_live_table(md, srcu_idx);
- 
- 	return tio;
- }
- 
- /*
-  * Called with the queue lock held.
-  */
- static int dm_old_prep_fn(struct request_queue *q, struct request *rq)
- {
- 	struct mapped_device *md = q->queuedata;
- 	struct dm_rq_target_io *tio;
- 
- 	if (unlikely(rq->special)) {
- 		DMWARN("Already has something in rq->special.");
- 		return BLKPREP_KILL;
- 	}
- 
- 	tio = dm_old_prep_tio(rq, md, GFP_ATOMIC);
- 	if (!tio)
- 		return BLKPREP_DEFER;
- 
- 	rq->special = tio;
- 	rq->cmd_flags |= REQ_DONTPREP;
- 
- 	return BLKPREP_OK;
- }
- 
- /*
-  * Returns:
-  * 0                : the request has been processed
-  * DM_MAPIO_REQUEUE : the original request needs to be requeued
-  * < 0              : the request was completed due to failure
-  */
- static int map_request(struct dm_rq_target_io *tio, struct request *rq,
- 		       struct mapped_device *md)
- {
- 	int r;
- 	struct dm_target *ti = tio->ti;
- 	struct request *clone = NULL;
- 
- 	if (tio->clone) {
- 		clone = tio->clone;
- 		r = ti->type->map_rq(ti, clone, &tio->info);
- 	} else {
- 		r = ti->type->clone_and_map_rq(ti, rq, &tio->info, &clone);
- 		if (r < 0) {
- 			/* The target wants to complete the I/O */
- 			dm_kill_unmapped_request(rq, r);
- 			return r;
- 		}
- 		if (r != DM_MAPIO_REMAPPED)
- 			return r;
- 		if (setup_clone(clone, rq, tio, GFP_ATOMIC)) {
- 			/* -ENOMEM */
- 			ti->type->release_clone_rq(clone);
- 			return DM_MAPIO_REQUEUE;
- 		}
- 	}
- 
- 	switch (r) {
- 	case DM_MAPIO_SUBMITTED:
- 		/* The target has taken the I/O to submit by itself later */
- 		break;
- 	case DM_MAPIO_REMAPPED:
- 		/* The target has remapped the I/O so dispatch it */
- 		trace_block_rq_remap(clone->q, clone, disk_devt(dm_disk(md)),
- 				     blk_rq_pos(rq));
- 		dm_dispatch_clone_request(clone, rq);
- 		break;
- 	case DM_MAPIO_REQUEUE:
- 		/* The target wants to requeue the I/O */
- 		dm_requeue_original_request(md, tio->orig);
- 		break;
- 	default:
- 		if (r > 0) {
- 			DMWARN("unimplemented target map return value: %d", r);
- 			BUG();
- 		}
- 
- 		/* The target wants to complete the I/O */
- 		dm_kill_unmapped_request(rq, r);
- 		return r;
- 	}
+ typedef bool (*is_split_required_fn)(struct dm_target *ti);
  
- 	return 0;
+ static bool is_split_required_for_discard(struct dm_target *ti)
+ {
+ 	return ti->split_discard_bios;
  }
  
- static void map_tio_request(struct kthread_work *work)
+ static int __send_changing_extent_only(struct clone_info *ci,
+ 				       get_num_bios_fn get_num_bios,
+ 				       is_split_required_fn is_split_required)
  {
- 	struct dm_rq_target_io *tio = container_of(work, struct dm_rq_target_io, work);
- 	struct request *rq = tio->orig;
- 	struct mapped_device *md = tio->md;
+ 	struct dm_target *ti;
+ 	unsigned len;
+ 	unsigned num_bios;
  
- 	if (map_request(tio, rq, md) == DM_MAPIO_REQUEUE)
- 		dm_requeue_original_request(md, rq);
- }
+ 	do {
+ 		ti = dm_table_find_target(ci->map, ci->sector);
+ 		if (!dm_target_is_valid(ti))
+ 			return -EIO;
  
- static void dm_start_request(struct mapped_device *md, struct request *orig)
- {
- 	if (!orig->q->mq_ops)
- 		blk_start_request(orig);
- 	else
- 		blk_mq_start_request(orig);
- 	atomic_inc(&md->pending[rq_data_dir(orig)]);
+ 		/*
+ 		 * Even though the device advertised support for this type of
+ 		 * request, that does not mean every target supports it, and
+ 		 * reconfiguration might also have changed that since the
+ 		 * check was performed.
+ 		 */
+ 		num_bios = get_num_bios ? get_num_bios(ti) : 0;
+ 		if (!num_bios)
+ 			return -EOPNOTSUPP;
  
- 	if (md->seq_rq_merge_deadline_usecs) {
- 		md->last_rq_pos = rq_end_sector(orig);
- 		md->last_rq_rw = rq_data_dir(orig);
- 		md->last_rq_start_time = ktime_get();
- 	}
+ 		if (is_split_required && !is_split_required(ti))
+ 			len = min((sector_t)ci->sector_count, max_io_len_target_boundary(ci->sector, ti));
+ 		else
+ 			len = min((sector_t)ci->sector_count, max_io_len(ci->sector, ti));
  
- 	if (unlikely(dm_stats_used(&md->stats))) {
- 		struct dm_rq_target_io *tio = tio_from_request(orig);
- 		tio->duration_jiffies = jiffies;
- 		tio->n_sectors = blk_rq_sectors(orig);
- 		dm_stats_account_io(&md->stats, rq_data_dir(orig),
- 				    blk_rq_pos(orig), tio->n_sectors, false, 0,
- 				    &tio->stats_aux);
- 	}
+ 		__send_duplicate_bios(ci, ti, num_bios, &len);
  
- 	/*
- 	 * Hold the md reference here for the in-flight I/O.
- 	 * We can't rely on the reference count by device opener,
- 	 * because the device may be closed during the request completion
- 	 * when all bios are completed.
- 	 * See the comment in rq_completed() too.
- 	 */
- 	dm_get(md);
+ 		ci->sector += len;
+ 	} while (ci->sector_count -= len);
+ 
+ 	return 0;
  }
  
- #define MAX_SEQ_RQ_MERGE_DEADLINE_USECS 100000
+ static int __send_discard(struct clone_info *ci)
+ {
+ 	return __send_changing_extent_only(ci, get_num_discard_bios,
+ 					   is_split_required_for_discard);
+ }
  
- ssize_t dm_attr_rq_based_seq_io_merge_deadline_show(struct mapped_device *md, char *buf)
+ static int __send_write_same(struct clone_info *ci)
  {
- 	return sprintf(buf, "%u\n", md->seq_rq_merge_deadline_usecs);
+ 	return __send_changing_extent_only(ci, get_num_write_same_bios, NULL);
  }
  
- ssize_t dm_attr_rq_based_seq_io_merge_deadline_store(struct mapped_device *md,
- 						     const char *buf, size_t count)
+ /*
+  * Select the correct strategy for processing a non-flush bio.
+  */
+ static int __split_and_process_non_flush(struct clone_info *ci)
  {
- 	unsigned deadline;
+ 	struct bio *bio = ci->bio;
+ 	struct dm_target *ti;
+ 	unsigned len;
+ 	int r;
  
- 	if (!dm_request_based(md) || md->use_blk_mq)
- 		return count;
+ 	if (unlikely(bio_op(bio) == REQ_OP_DISCARD))
+ 		return __send_discard(ci);
+ 	else if (unlikely(bio_op(bio) == REQ_OP_WRITE_SAME))
+ 		return __send_write_same(ci);
  
- 	if (kstrtouint(buf, 10, &deadline))
- 		return -EINVAL;
+ 	ti = dm_table_find_target(ci->map, ci->sector);
+ 	if (!dm_target_is_valid(ti))
+ 		return -EIO;
+ 
+ 	len = min_t(sector_t, max_io_len(ci->sector, ti), ci->sector_count);
  
- 	if (deadline > MAX_SEQ_RQ_MERGE_DEADLINE_USECS)
- 		deadline = MAX_SEQ_RQ_MERGE_DEADLINE_USECS;
+ 	r = __clone_and_map_data_bio(ci, ti, ci->sector, &len);
+ 	if (r < 0)
+ 		return r;
  
- 	md->seq_rq_merge_deadline_usecs = deadline;
+ 	ci->sector += len;
+ 	ci->sector_count -= len;
  
- 	return count;
+ 	return 0;
  }
  
- static bool dm_request_peeked_before_merge_deadline(struct mapped_device *md)
+ /*
+  * Entry point to split a bio into clones and submit them to the targets.
+  */
+ static void __split_and_process_bio(struct mapped_device *md,
+ 				    struct dm_table *map, struct bio *bio)
  {
- 	ktime_t kt_deadline;
+ 	struct clone_info ci;
+ 	int error = 0;
+ 
+ 	if (unlikely(!map)) {
+ 		bio_io_error(bio);
+ 		return;
+ 	}
+ 
+ 	ci.map = map;
+ 	ci.md = md;
+ 	ci.io = alloc_io(md);
+ 	ci.io->error = 0;
+ 	atomic_set(&ci.io->io_count, 1);
+ 	ci.io->bio = bio;
+ 	ci.io->md = md;
+ 	spin_lock_init(&ci.io->endio_lock);
+ 	ci.sector = bio->bi_iter.bi_sector;
  
- 	if (!md->seq_rq_merge_deadline_usecs)
- 		return false;
+ 	start_io_acct(ci.io);
  
- 	kt_deadline = ns_to_ktime((u64)md->seq_rq_merge_deadline_usecs * NSEC_PER_USEC);
- 	kt_deadline = ktime_add_safe(md->last_rq_start_time, kt_deadline);
+ 	if (bio->bi_rw & REQ_PREFLUSH) {
+ 		ci.bio = &ci.md->flush_bio;
+ 		ci.sector_count = 0;
+ 		error = __send_empty_flush(&ci);
+ 		/* dec_pending submits any data associated with flush */
+ 	} else {
+ 		ci.bio = bio;
+ 		ci.sector_count = bio_sectors(bio);
+ 		while (ci.sector_count && !error)
+ 			error = __split_and_process_non_flush(&ci);
+ 	}
  
- 	return !ktime_after(ktime_get(), kt_deadline);
+ 	/* drop the extra reference count */
+ 	dec_pending(ci.io, error);
  }
+ /*-----------------------------------------------------------------
+  * CRUD END
+  *---------------------------------------------------------------*/
  
  /*
-  * q->request_fn for request-based dm.
-  * Called with the queue lock held.
+  * The request function that just remaps the bio built up by
+  * dm_merge_bvec.
   */
- static void dm_request_fn(struct request_queue *q)
+ static blk_qc_t dm_make_request(struct request_queue *q, struct bio *bio)
  {
+ 	int rw = bio_data_dir(bio);
  	struct mapped_device *md = q->queuedata;
- 	struct dm_target *ti = md->immutable_target;
- 	struct request *rq;
- 	struct dm_rq_target_io *tio;
- 	sector_t pos = 0;
- 
- 	if (unlikely(!ti)) {
- 		int srcu_idx;
- 		struct dm_table *map = dm_get_live_table(md, &srcu_idx);
- 
- 		ti = dm_table_find_target(map, pos);
- 		dm_put_live_table(md, srcu_idx);
- 	}
- 
- 	/*
- 	 * For suspend, check blk_queue_stopped() and increment
- 	 * ->pending within a single queue_lock not to increment the
- 	 * number of in-flight I/Os after the queue is stopped in
- 	 * dm_suspend().
- 	 */
- 	while (!blk_queue_stopped(q)) {
- 		rq = blk_peek_request(q);
- 		if (!rq)
- 			return;
+ 	int srcu_idx;
+ 	struct dm_table *map;
  
- 		/* always use block 0 to find the target for flushes for now */
- 		pos = 0;
- 		if (req_op(rq) != REQ_OP_FLUSH)
- 			pos = blk_rq_pos(rq);
+ 	map = dm_get_live_table(md, &srcu_idx);
  
- 		if ((dm_request_peeked_before_merge_deadline(md) &&
- 		     md_in_flight(md) && rq->bio && rq->bio->bi_vcnt == 1 &&
- 		     md->last_rq_pos == pos && md->last_rq_rw == rq_data_dir(rq)) ||
- 		    (ti->type->busy && ti->type->busy(ti))) {
- 			blk_delay_queue(q, HZ / 100);
- 			return;
- 		}
+ 	generic_start_io_acct(rw, bio_sectors(bio), &dm_disk(md)->part0);
  
- 		dm_start_request(md, rq);
+ 	/* if we're suspended, we have to queue this io for later */
+ 	if (unlikely(test_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags))) {
+ 		dm_put_live_table(md, srcu_idx);
  
- 		tio = tio_from_request(rq);
- 		/* Establish tio->ti before queuing work (map_tio_request) */
- 		tio->ti = ti;
- 		queue_kthread_work(&md->kworker, &tio->work);
- 		BUG_ON(!irqs_disabled());
 -		if (bio_rw(bio) != READA)
++		if (!(bio->bi_rw & REQ_RAHEAD))
+ 			queue_io(md, bio);
+ 		else
+ 			bio_io_error(bio);
+ 		return BLK_QC_T_NONE;
  	}
+ 
+ 	__split_and_process_bio(md, map, bio);
+ 	dm_put_live_table(md, srcu_idx);
+ 	return BLK_QC_T_NONE;
  }
  
  static int dm_any_congested(void *congested_data, int bdi_bits)

^ permalink raw reply	[flat|nested] 20+ messages in thread

* linux-next: manual merge of the device-mapper tree with the block tree
@ 2016-07-18  4:09 Stephen Rothwell
  0 siblings, 0 replies; 20+ messages in thread
From: Stephen Rothwell @ 2016-07-18  4:09 UTC (permalink / raw)
  To: Alasdair G Kergon, Mike Snitzer, Jens Axboe
  Cc: linux-next, linux-kernel, Toshi Kani, Christoph Hellwig

Hi all,

Today's linux-next merge of the device-mapper tree got a conflict in:

  include/linux/blkdev.h

between commit:

  288dab8a35a0 ("block: add a separate operation type for secure erase")

from the block tree and commit:

  ff6bbdd8ef75 ("block: add QUEUE_FLAG_DAX for devices to advertise their DAX support")

from the device-mapper tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc include/linux/blkdev.h
index 9ae49ccaac95,1493ab3a537f..000000000000
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@@ -592,8 -593,9 +593,9 @@@ static inline void queue_flag_clear(uns
  #define blk_queue_stackable(q)	\
  	test_bit(QUEUE_FLAG_STACKABLE, &(q)->queue_flags)
  #define blk_queue_discard(q)	test_bit(QUEUE_FLAG_DISCARD, &(q)->queue_flags)
 -#define blk_queue_secdiscard(q)	(blk_queue_discard(q) && \
 -	test_bit(QUEUE_FLAG_SECDISCARD, &(q)->queue_flags))
 +#define blk_queue_secure_erase(q) \
 +	(test_bit(QUEUE_FLAG_SECERASE, &(q)->queue_flags))
+ #define blk_queue_dax(q)	test_bit(QUEUE_FLAG_DAX, &(q)->queue_flags)
  
  #define blk_noretry_request(rq) \
  	((rq)->cmd_flags & (REQ_FAILFAST_DEV|REQ_FAILFAST_TRANSPORT| \

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: linux-next: manual merge of the device-mapper tree with the block tree
  2016-06-09  4:02 ` Stephen Rothwell
@ 2016-06-10 17:01   ` Mike Snitzer
  0 siblings, 0 replies; 20+ messages in thread
From: Mike Snitzer @ 2016-06-10 17:01 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: Alasdair G Kergon, Jens Axboe, linux-next, linux-kernel

On Thu, Jun 09 2016 at 12:02am -0400,
Stephen Rothwell <sfr@canb.auug.org.au> wrote:

> Hi all,
> 
> On Thu, 9 Jun 2016 13:59:32 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> >
> >   50d14ab0130a ("dm: move request-based code out to dm-rq.[hc]")
> 
> By the way, resolving these conflicts would have been easier if this
> commit had been split into "move with no changes" followed by "small
> changes" commits.

Yeap, I understand.  I've folded your fix into the appropriate commit
and rebased DM's for-next (and dm-4.8) ontop of block's for-4.8/core.

Thanks,
Mike

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: linux-next: manual merge of the device-mapper tree with the block tree
  2016-06-09  3:59 Stephen Rothwell
@ 2016-06-09  4:02 ` Stephen Rothwell
  2016-06-10 17:01   ` Mike Snitzer
  0 siblings, 1 reply; 20+ messages in thread
From: Stephen Rothwell @ 2016-06-09  4:02 UTC (permalink / raw)
  To: Alasdair G Kergon, Mike Snitzer, Jens Axboe; +Cc: linux-next, linux-kernel

Hi all,

On Thu, 9 Jun 2016 13:59:32 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
>   50d14ab0130a ("dm: move request-based code out to dm-rq.[hc]")

By the way, resolving these conflicts would have been easier if this
commit had been split into "move with no changes" followed by "small
changes" commits.

-- 
Cheers,
Stephen Rothwell

^ permalink raw reply	[flat|nested] 20+ messages in thread

* linux-next: manual merge of the device-mapper tree with the block tree
@ 2016-06-09  3:59 Stephen Rothwell
  2016-06-09  4:02 ` Stephen Rothwell
  0 siblings, 1 reply; 20+ messages in thread
From: Stephen Rothwell @ 2016-06-09  3:59 UTC (permalink / raw)
  To: Alasdair G Kergon, Mike Snitzer, Jens Axboe; +Cc: linux-next, linux-kernel

Hi all,

Today's linux-next merge of the device-mapper tree got a conflict in:

  drivers/md/dm.c

between commit:

  528ec5abe680 ("dm: pass dm stats data dir instead of bi_rw")
  c2df40dfb8c0 ("drivers: use req op accessor")
  3a5e02ced11e ("block, drivers: add REQ_OP_FLUSH operation")

from the block tree and commit:

  50d14ab0130a ("dm: move request-based code out to dm-rq.[hc]")

from the device-mapper tree.

I fixed it up (I used the device-mapper tree version of dm.c and then
applied the following patch) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Thu, 9 Jun 2016 13:47:03 +1000
Subject: [PATCH] dm: fix merge of drivers/dm/dm-rq.c

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 drivers/md/dm-rq.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/md/dm-rq.c b/drivers/md/dm-rq.c
index dfb0721a87fe..266f7b674108 100644
--- a/drivers/md/dm-rq.c
+++ b/drivers/md/dm-rq.c
@@ -189,9 +189,9 @@ static void rq_end_stats(struct mapped_device *md, struct request *orig)
 	if (unlikely(dm_stats_used(&md->stats))) {
 		struct dm_rq_target_io *tio = tio_from_request(orig);
 		tio->duration_jiffies = jiffies - tio->duration_jiffies;
-		dm_stats_account_io(&md->stats, orig->cmd_flags, blk_rq_pos(orig),
-				    tio->n_sectors, true, tio->duration_jiffies,
-				    &tio->stats_aux);
+		dm_stats_account_io(&md->stats, rq_data_dir(orig),
+				    blk_rq_pos(orig), tio->n_sectors, true,
+				    tio->duration_jiffies, &tio->stats_aux);
 	}
 }
 
@@ -353,7 +353,7 @@ static void dm_done(struct request *clone, int error, bool mapped)
 			r = rq_end_io(tio->ti, clone, error, &tio->info);
 	}
 
-	if (unlikely(r == -EREMOTEIO && (clone->cmd_flags & REQ_WRITE_SAME) &&
+	if (unlikely(r == -EREMOTEIO && (req_op(clone) == REQ_OP_WRITE_SAME) &&
 		     !clone->q->limits.max_write_same_sectors))
 		disable_write_same(tio->md);
 
@@ -681,8 +681,9 @@ static void dm_start_request(struct mapped_device *md, struct request *orig)
 		struct dm_rq_target_io *tio = tio_from_request(orig);
 		tio->duration_jiffies = jiffies;
 		tio->n_sectors = blk_rq_sectors(orig);
-		dm_stats_account_io(&md->stats, orig->cmd_flags, blk_rq_pos(orig),
-				    tio->n_sectors, false, 0, &tio->stats_aux);
+		dm_stats_account_io(&md->stats, rq_data_dir(orig),
+				    blk_rq_pos(orig), tio->n_sectors, false, 0,
+				    &tio->stats_aux);
 	}
 
 	/*
@@ -777,7 +778,7 @@ static void dm_old_request_fn(struct request_queue *q)
 
 		/* always use block 0 to find the target for flushes for now */
 		pos = 0;
-		if (!(rq->cmd_flags & REQ_FLUSH))
+		if (req_op(rq) != REQ_OP_FLUSH)
 			pos = blk_rq_pos(rq);
 
 		if ((dm_old_request_peeked_before_merge_deadline(md) &&
-- 
2.8.1

-- 
Cheers,
Stephen Rothwell

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* linux-next: manual merge of the device-mapper tree with the block tree
@ 2015-09-02  2:39 Stephen Rothwell
  0 siblings, 0 replies; 20+ messages in thread
From: Stephen Rothwell @ 2015-09-02  2:39 UTC (permalink / raw)
  To: Alasdair G Kergon, Mike Snitzer, Jens Axboe
  Cc: linux-next, linux-kernel, Joe Thornber, Christoph Hellwig

Hi all,

Today's linux-next merge of the device-mapper tree got a conflict in:

  drivers/md/dm-cache-target.c

between commit:

  4246a0b63bd8 ("block: add a bi_error field to struct bio")

from the block tree and commit:

  cc7da0ba9c96 ("dm cache: fix use after freeing migrations")

from the device-mapper tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc drivers/md/dm-cache-target.c
index 7245071778db,f9d9cc6a094b..000000000000
--- a/drivers/md/dm-cache-target.c
+++ b/drivers/md/dm-cache-target.c
@@@ -1358,9 -1352,10 +1352,10 @@@ static void issue_discard(struct dm_cac
  		b = to_dblock(from_dblock(b) + 1);
  	}
  
 -	bio_endio(bio, 0);
 +	bio_endio(bio);
- 	cell_defer(mg->cache, mg->new_ocell, false);
+ 	cell_defer(cache, mg->new_ocell, false);
  	free_migration(mg);
+ 	wake_worker(cache);
  }
  
  static void issue_copy_or_discard(struct dm_cache_migration *mg)

^ permalink raw reply	[flat|nested] 20+ messages in thread

* linux-next: manual merge of the device-mapper tree with the block tree
@ 2013-12-17  2:16 Stephen Rothwell
  0 siblings, 0 replies; 20+ messages in thread
From: Stephen Rothwell @ 2013-12-17  2:16 UTC (permalink / raw)
  To: Alasdair G Kergon, Mike Snitzer, Jens Axboe
  Cc: linux-next, linux-kernel, Kent Overstreet

[-- Attachment #1: Type: text/plain, Size: 1101 bytes --]

Hi all,

Today's linux-next merge of the device-mapper tree got a conflict in
drivers/md/dm-thin.c between commit 4f024f3797c4 ("block: Abstract out
bvec iterator") from the block tree and commit 1d8b40855c42 ("dm thin:
requeue bios to DM core if may_requeue_bios and in read-only mode") from
the device-mapper tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc drivers/md/dm-thin.c
index 357eb272dbd9,dde2b1eddbce..000000000000
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@@ -1262,8 -1260,8 +1266,8 @@@ static void process_bio_read_only(struc
  	r = dm_thin_find_block(tc->td, block, 1, &lookup_result);
  	switch (r) {
  	case 0:
 -		if (lookup_result.shared && (rw == WRITE) && bio->bi_size)
 +		if (lookup_result.shared && (rw == WRITE) && bio->bi_iter.bi_size)
- 			bio_io_error(bio);
+ 			handle_unserviceable_bio(tc->pool, bio);
  		else {
  			inc_all_io_entry(tc->pool, bio);
  			remap_and_issue(tc, bio, lookup_result.block);

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2022-07-28  3:23 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-06  4:33 linux-next: manual merge of the device-mapper tree with the block tree Stephen Rothwell
2010-07-06 14:30 ` Mike Snitzer
2013-12-17  2:16 Stephen Rothwell
2015-09-02  2:39 Stephen Rothwell
2016-06-09  3:59 Stephen Rothwell
2016-06-09  4:02 ` Stephen Rothwell
2016-06-10 17:01   ` Mike Snitzer
2016-07-18  4:09 Stephen Rothwell
2016-07-21  3:27 Stephen Rothwell
2018-12-10  3:43 Stephen Rothwell
2018-12-10  3:55 ` Jens Axboe
2018-12-10  5:13   ` Mike Snitzer
2020-05-22  5:17 Stephen Rothwell
2020-07-09  3:21 Stephen Rothwell
2021-08-10  1:55 Stephen Rothwell
2022-03-30 22:44 Stephen Rothwell
2022-04-01  5:20 ` Christoph Hellwig
2022-04-01 16:28   ` Mike Snitzer
2022-07-28  3:14 Stephen Rothwell
2022-07-28  3:23 ` Ming Lei

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).