Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 11efae35 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'for-5.1/block-post-20190315' of git://git.kernel.dk/linux-block

Pull more block layer changes from Jens Axboe:
 "This is a collection of both stragglers, and fixes that came in after
  I finalized the initial pull. This contains:

   - An MD pull request from Song, with a few minor fixes

   - Set of NVMe patches via Christoph

   - Pull request from Konrad, with a few fixes for xen/blkback

   - pblk fix IO calculation fix (Javier)

   - Segment calculation fix for pass-through (Ming)

   - Fallthrough annotation for blkcg (Mathieu)"

* tag 'for-5.1/block-post-20190315' of git://git.kernel.dk/linux-block: (25 commits)
  blkcg: annotate implicit fall through
  nvme-tcp: support C2HData with SUCCESS flag
  nvmet: ignore EOPNOTSUPP for discard
  nvme: add proper write zeroes setup for the multipath device
  nvme: add proper discard setup for the multipath device
  nvme: remove nvme_ns_config_oncs
  nvme: disable Write Zeroes for qemu controllers
  nvmet-fc: bring Disconnect into compliance with FC-NVME spec
  nvmet-fc: fix issues with targetport assoc_list list walking
  nvme-fc: reject reconnect if io queue count is reduced to zero
  nvme-fc: fix numa_node when dev is null
  nvme-fc: use nr_phys_segments to determine existence of sgl
  nvme-loop: init nvmet_ctrl fatal_err_work when allocate
  nvme: update comment to make the code easier to read
  nvme: put ns_head ref if namespace fails allocation
  nvme-trace: fix cdw10 buffer overrun
  nvme: don't warn on block content change effects
  nvme: add get-feature to admin cmds tracer
  md: Fix failed allocation of md_register_thread
  It's wrong to add len to sector_nr in raid10 reshape twice
  ...
parents 465c209d f6d85f04
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -756,3 +756,6 @@ These currently include:
      The cache mode for raid5. raid5 could include an extra disk for
      caching. The mode can be "write-throuth" and "write-back". The
      default is "write-through".

  ppl_write_hint
      NVMe stream ID to be set for each PPL write request.
+8 −7
Original line number Diff line number Diff line
@@ -180,7 +180,7 @@ static unsigned get_max_segment_size(struct request_queue *q,
 */
static bool bvec_split_segs(struct request_queue *q, struct bio_vec *bv,
		unsigned *nsegs, unsigned *last_seg_size,
		unsigned *front_seg_size, unsigned *sectors)
		unsigned *front_seg_size, unsigned *sectors, unsigned max_segs)
{
	unsigned len = bv->bv_len;
	unsigned total_len = 0;
@@ -190,7 +190,7 @@ static bool bvec_split_segs(struct request_queue *q, struct bio_vec *bv,
	 * Multi-page bvec may be too big to hold in one segment, so the
	 * current bvec has to be splitted as multiple segments.
	 */
	while (len && new_nsegs + *nsegs < queue_max_segments(q)) {
	while (len && new_nsegs + *nsegs < max_segs) {
		seg_size = get_max_segment_size(q, bv->bv_offset + total_len);
		seg_size = min(seg_size, len);

@@ -240,6 +240,7 @@ static struct bio *blk_bio_segment_split(struct request_queue *q,
	bool do_split = true;
	struct bio *new = NULL;
	const unsigned max_sectors = get_max_io_size(q, bio);
	const unsigned max_segs = queue_max_segments(q);

	bio_for_each_bvec(bv, bio, iter) {
		/*
@@ -254,14 +255,14 @@ static struct bio *blk_bio_segment_split(struct request_queue *q,
			 * Consider this a new segment if we're splitting in
			 * the middle of this vector.
			 */
			if (nsegs < queue_max_segments(q) &&
			if (nsegs < max_segs &&
			    sectors < max_sectors) {
				/* split in the middle of bvec */
				bv.bv_len = (max_sectors - sectors) << 9;
				bvec_split_segs(q, &bv, &nsegs,
						&seg_size,
						&front_seg_size,
						&sectors);
						&sectors, max_segs);
			}
			goto split;
		}
@@ -283,7 +284,7 @@ static struct bio *blk_bio_segment_split(struct request_queue *q,
			continue;
		}
new_segment:
		if (nsegs == queue_max_segments(q))
		if (nsegs == max_segs)
			goto split;

		bvprv = bv;
@@ -296,7 +297,7 @@ static struct bio *blk_bio_segment_split(struct request_queue *q,
			if (nsegs == 1 && seg_size > front_seg_size)
				front_seg_size = seg_size;
		} else if (bvec_split_segs(q, &bv, &nsegs, &seg_size,
				    &front_seg_size, &sectors)) {
				    &front_seg_size, &sectors, max_segs)) {
			goto split;
		}
	}
@@ -415,7 +416,7 @@ static unsigned int __blk_recalc_rq_segments(struct request_queue *q,
			bvprv = bv;
			prev = 1;
			bvec_split_segs(q, &bv, &nr_phys_segs, &seg_size,
					&front_seg_size, NULL);
					&front_seg_size, NULL, UINT_MAX);
		}
		bbio = bio;
	}
+57 −42
Original line number Diff line number Diff line
@@ -926,7 +926,7 @@ static int read_per_ring_refs(struct xen_blkif_ring *ring, const char *dir)
	int err, i, j;
	struct xen_blkif *blkif = ring->blkif;
	struct xenbus_device *dev = blkif->be->dev;
	unsigned int ring_page_order, nr_grefs, evtchn;
	unsigned int nr_grefs, evtchn;

	err = xenbus_scanf(XBT_NIL, dir, "event-channel", "%u",
			  &evtchn);
@@ -936,43 +936,42 @@ static int read_per_ring_refs(struct xen_blkif_ring *ring, const char *dir)
		return err;
	}

	err = xenbus_scanf(XBT_NIL, dev->otherend, "ring-page-order", "%u",
			  &ring_page_order);
	if (err != 1) {
		err = xenbus_scanf(XBT_NIL, dir, "ring-ref", "%u", &ring_ref[0]);
		if (err != 1) {
			err = -EINVAL;
			xenbus_dev_fatal(dev, err, "reading %s/ring-ref", dir);
			return err;
		}
		nr_grefs = 1;
	} else {
		unsigned int i;
	nr_grefs = blkif->nr_ring_pages;

		if (ring_page_order > xen_blkif_max_ring_order) {
			err = -EINVAL;
			xenbus_dev_fatal(dev, err, "%s/request %d ring page order exceed max:%d",
					 dir, ring_page_order,
					 xen_blkif_max_ring_order);
			return err;
	if (unlikely(!nr_grefs)) {
		WARN_ON(true);
		return -EINVAL;
	}

		nr_grefs = 1 << ring_page_order;
	for (i = 0; i < nr_grefs; i++) {
		char ring_ref_name[RINGREF_NAME_LEN];

		snprintf(ring_ref_name, RINGREF_NAME_LEN, "ring-ref%u", i);
		err = xenbus_scanf(XBT_NIL, dir, ring_ref_name,
				   "%u", &ring_ref[i]);

		if (err != 1) {
			if (nr_grefs == 1)
				break;

			err = -EINVAL;
			xenbus_dev_fatal(dev, err, "reading %s/%s",
					 dir, ring_ref_name);
			return err;
		}
	}

	if (err != 1) {
		WARN_ON(nr_grefs != 1);

		err = xenbus_scanf(XBT_NIL, dir, "ring-ref", "%u",
				   &ring_ref[0]);
		if (err != 1) {
			err = -EINVAL;
			xenbus_dev_fatal(dev, err, "reading %s/ring-ref", dir);
			return err;
		}
	}
	blkif->nr_ring_pages = nr_grefs;

	for (i = 0; i < nr_grefs * XEN_BLKIF_REQS_PER_PAGE; i++) {
		req = kzalloc(sizeof(*req), GFP_KERNEL);
@@ -1023,6 +1022,7 @@ static int read_per_ring_refs(struct xen_blkif_ring *ring, const char *dir)
static int connect_ring(struct backend_info *be)
{
	struct xenbus_device *dev = be->dev;
	struct xen_blkif *blkif = be->blkif;
	unsigned int pers_grants;
	char protocol[64] = "";
	int err, i;
@@ -1030,28 +1030,29 @@ static int connect_ring(struct backend_info *be)
	size_t xspathsize;
	const size_t xenstore_path_ext_size = 11; /* sufficient for "/queue-NNN" */
	unsigned int requested_num_queues = 0;
	unsigned int ring_page_order;

	pr_debug("%s %s\n", __func__, dev->otherend);

	be->blkif->blk_protocol = BLKIF_PROTOCOL_DEFAULT;
	blkif->blk_protocol = BLKIF_PROTOCOL_DEFAULT;
	err = xenbus_scanf(XBT_NIL, dev->otherend, "protocol",
			   "%63s", protocol);
	if (err <= 0)
		strcpy(protocol, "unspecified, assuming default");
	else if (0 == strcmp(protocol, XEN_IO_PROTO_ABI_NATIVE))
		be->blkif->blk_protocol = BLKIF_PROTOCOL_NATIVE;
		blkif->blk_protocol = BLKIF_PROTOCOL_NATIVE;
	else if (0 == strcmp(protocol, XEN_IO_PROTO_ABI_X86_32))
		be->blkif->blk_protocol = BLKIF_PROTOCOL_X86_32;
		blkif->blk_protocol = BLKIF_PROTOCOL_X86_32;
	else if (0 == strcmp(protocol, XEN_IO_PROTO_ABI_X86_64))
		be->blkif->blk_protocol = BLKIF_PROTOCOL_X86_64;
		blkif->blk_protocol = BLKIF_PROTOCOL_X86_64;
	else {
		xenbus_dev_fatal(dev, err, "unknown fe protocol %s", protocol);
		return -ENOSYS;
	}
	pers_grants = xenbus_read_unsigned(dev->otherend, "feature-persistent",
					   0);
	be->blkif->vbd.feature_gnt_persistent = pers_grants;
	be->blkif->vbd.overflow_max_grants = 0;
	blkif->vbd.feature_gnt_persistent = pers_grants;
	blkif->vbd.overflow_max_grants = 0;

	/*
	 * Read the number of hardware queues from frontend.
@@ -1067,16 +1068,30 @@ static int connect_ring(struct backend_info *be)
				requested_num_queues, xenblk_max_queues);
		return -ENOSYS;
	}
	be->blkif->nr_rings = requested_num_queues;
	if (xen_blkif_alloc_rings(be->blkif))
	blkif->nr_rings = requested_num_queues;
	if (xen_blkif_alloc_rings(blkif))
		return -ENOMEM;

	pr_info("%s: using %d queues, protocol %d (%s) %s\n", dev->nodename,
		 be->blkif->nr_rings, be->blkif->blk_protocol, protocol,
		 blkif->nr_rings, blkif->blk_protocol, protocol,
		 pers_grants ? "persistent grants" : "");

	if (be->blkif->nr_rings == 1)
		return read_per_ring_refs(&be->blkif->rings[0], dev->otherend);
	ring_page_order = xenbus_read_unsigned(dev->otherend,
					       "ring-page-order", 0);

	if (ring_page_order > xen_blkif_max_ring_order) {
		err = -EINVAL;
		xenbus_dev_fatal(dev, err,
				 "requested ring page order %d exceed max:%d",
				 ring_page_order,
				 xen_blkif_max_ring_order);
		return err;
	}

	blkif->nr_ring_pages = 1 << ring_page_order;

	if (blkif->nr_rings == 1)
		return read_per_ring_refs(&blkif->rings[0], dev->otherend);
	else {
		xspathsize = strlen(dev->otherend) + xenstore_path_ext_size;
		xspath = kmalloc(xspathsize, GFP_KERNEL);
@@ -1085,10 +1100,10 @@ static int connect_ring(struct backend_info *be)
			return -ENOMEM;
		}

		for (i = 0; i < be->blkif->nr_rings; i++) {
		for (i = 0; i < blkif->nr_rings; i++) {
			memset(xspath, 0, xspathsize);
			snprintf(xspath, xspathsize, "%s/queue-%u", dev->otherend, i);
			err = read_per_ring_refs(&be->blkif->rings[i], xspath);
			err = read_per_ring_refs(&blkif->rings[i], xspath);
			if (err) {
				kfree(xspath);
				return err;
+6 −1
Original line number Diff line number Diff line
@@ -233,10 +233,15 @@ void pblk_rl_init(struct pblk_rl *rl, int budget, int threshold)
	/* To start with, all buffer is available to user I/O writers */
	rl->rb_budget = budget;
	rl->rb_user_max = budget;
	rl->rb_max_io = threshold ? (budget - threshold) : (budget - 1);
	rl->rb_gc_max = 0;
	rl->rb_state = PBLK_RL_HIGH;

	/* Maximize I/O size and ansure that back threshold is respected */
	if (threshold)
		rl->rb_max_io = budget - pblk->min_write_pgs_data - threshold;
	else
		rl->rb_max_io = budget - pblk->min_write_pgs_data - 1;

	atomic_set(&rl->rb_user_cnt, 0);
	atomic_set(&rl->rb_gc_cnt, 0);
	atomic_set(&rl->rb_space, -1);
+2 −1
Original line number Diff line number Diff line
@@ -3939,6 +3939,8 @@ static int raid10_run(struct mddev *mddev)
		set_bit(MD_RECOVERY_RUNNING, &mddev->recovery);
		mddev->sync_thread = md_register_thread(md_do_sync, mddev,
							"reshape");
		if (!mddev->sync_thread)
			goto out_free_conf;
	}

	return 0;
@@ -4670,7 +4672,6 @@ static sector_t reshape_request(struct mddev *mddev, sector_t sector_nr,
	atomic_inc(&r10_bio->remaining);
	read_bio->bi_next = NULL;
	generic_make_request(read_bio);
	sector_nr += nr_sectors;
	sectors_done += nr_sectors;
	if (sector_nr <= last)
		goto read_more;
Loading