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

Commit 4f1ba49e authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge branch 'for-linus' of git://git.kernel.dk/linux-block

* 'for-linus' of git://git.kernel.dk/linux-block:
  block: Use hlist_entry() for io_context.cic_list.first
  cfq-iosched: Remove bogus check in queue_fail path
  xen/blkback: potential null dereference in error handling
  xen/blkback: don't call vbd_size() if bd_disk is NULL
  block: blkdev_get() should access ->bd_disk only after success
  CFQ: Fix typo and remove unnecessary semicolon
  block: remove unwanted semicolons
  Revert "block: Remove extra discard_alignment from hd_struct."
  nbd: adjust 'max_part' according to part_shift
  nbd: limit module parameters to a sane value
  nbd: pass MSG_* flags to kernel_recvmsg()
  block: improve the bio_add_page() and bio_add_pc_page() descriptions
parents 39b4a46f e3a57b3c
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -21,7 +21,7 @@ static void cfq_dtor(struct io_context *ioc)
	if (!hlist_empty(&ioc->cic_list)) {
	if (!hlist_empty(&ioc->cic_list)) {
		struct cfq_io_context *cic;
		struct cfq_io_context *cic;


		cic = list_entry(ioc->cic_list.first, struct cfq_io_context,
		cic = hlist_entry(ioc->cic_list.first, struct cfq_io_context,
								cic_list);
								cic_list);
		cic->dtor(ioc);
		cic->dtor(ioc);
	}
	}
@@ -57,7 +57,7 @@ static void cfq_exit(struct io_context *ioc)
	if (!hlist_empty(&ioc->cic_list)) {
	if (!hlist_empty(&ioc->cic_list)) {
		struct cfq_io_context *cic;
		struct cfq_io_context *cic;


		cic = list_entry(ioc->cic_list.first, struct cfq_io_context,
		cic = hlist_entry(ioc->cic_list.first, struct cfq_io_context,
								cic_list);
								cic_list);
		cic->exit(ioc);
		cic->exit(ioc);
	}
	}
+4 −7
Original line number Original line Diff line number Diff line
@@ -185,7 +185,7 @@ struct cfq_group {
	int nr_cfqq;
	int nr_cfqq;


	/*
	/*
	 * Per group busy queus average. Useful for workload slice calc. We
	 * Per group busy queues average. Useful for workload slice calc. We
	 * create the array for each prio class but at run time it is used
	 * create the array for each prio class but at run time it is used
	 * only for RT and BE class and slot for IDLE class remains unused.
	 * only for RT and BE class and slot for IDLE class remains unused.
	 * This is primarily done to avoid confusion and a gcc warning.
	 * This is primarily done to avoid confusion and a gcc warning.
@@ -369,16 +369,16 @@ CFQ_CFQQ_FNS(wait_busy);
#define cfq_log_cfqq(cfqd, cfqq, fmt, args...)	\
#define cfq_log_cfqq(cfqd, cfqq, fmt, args...)	\
	blk_add_trace_msg((cfqd)->queue, "cfq%d%c %s " fmt, (cfqq)->pid, \
	blk_add_trace_msg((cfqd)->queue, "cfq%d%c %s " fmt, (cfqq)->pid, \
			cfq_cfqq_sync((cfqq)) ? 'S' : 'A', \
			cfq_cfqq_sync((cfqq)) ? 'S' : 'A', \
			blkg_path(&(cfqq)->cfqg->blkg), ##args);
			blkg_path(&(cfqq)->cfqg->blkg), ##args)


#define cfq_log_cfqg(cfqd, cfqg, fmt, args...)				\
#define cfq_log_cfqg(cfqd, cfqg, fmt, args...)				\
	blk_add_trace_msg((cfqd)->queue, "%s " fmt,			\
	blk_add_trace_msg((cfqd)->queue, "%s " fmt,			\
				blkg_path(&(cfqg)->blkg), ##args);      \
				blkg_path(&(cfqg)->blkg), ##args)       \


#else
#else
#define cfq_log_cfqq(cfqd, cfqq, fmt, args...)	\
#define cfq_log_cfqq(cfqd, cfqq, fmt, args...)	\
	blk_add_trace_msg((cfqd)->queue, "cfq%d " fmt, (cfqq)->pid, ##args)
	blk_add_trace_msg((cfqd)->queue, "cfq%d " fmt, (cfqq)->pid, ##args)
#define cfq_log_cfqg(cfqd, cfqg, fmt, args...)		do {} while (0);
#define cfq_log_cfqg(cfqd, cfqg, fmt, args...)		do {} while (0)
#endif
#endif
#define cfq_log(cfqd, fmt, args...)	\
#define cfq_log(cfqd, fmt, args...)	\
	blk_add_trace_msg((cfqd)->queue, "cfq " fmt, ##args)
	blk_add_trace_msg((cfqd)->queue, "cfq " fmt, ##args)
@@ -3786,9 +3786,6 @@ cfq_set_request(struct request_queue *q, struct request *rq, gfp_t gfp_mask)
	return 0;
	return 0;


queue_fail:
queue_fail:
	if (cic)
		put_io_context(cic->ioc);

	cfq_schedule_dispatch(cfqd);
	cfq_schedule_dispatch(cfqd);
	spin_unlock_irqrestore(q->queue_lock, flags);
	spin_unlock_irqrestore(q->queue_lock, flags);
	cfq_log(cfqd, "set_request fail");
	cfq_log(cfqd, "set_request fail");
+20 −2
Original line number Original line Diff line number Diff line
@@ -192,7 +192,8 @@ static int sock_xmit(struct nbd_device *lo, int send, void *buf, int size,
			if (lo->xmit_timeout)
			if (lo->xmit_timeout)
				del_timer_sync(&ti);
				del_timer_sync(&ti);
		} else
		} else
			result = kernel_recvmsg(sock, &msg, &iov, 1, size, 0);
			result = kernel_recvmsg(sock, &msg, &iov, 1, size,
						msg.msg_flags);


		if (signal_pending(current)) {
		if (signal_pending(current)) {
			siginfo_t info;
			siginfo_t info;
@@ -753,9 +754,26 @@ static int __init nbd_init(void)
		return -ENOMEM;
		return -ENOMEM;


	part_shift = 0;
	part_shift = 0;
	if (max_part > 0)
	if (max_part > 0) {
		part_shift = fls(max_part);
		part_shift = fls(max_part);


		/*
		 * Adjust max_part according to part_shift as it is exported
		 * to user space so that user can know the max number of
		 * partition kernel should be able to manage.
		 *
		 * Note that -1 is required because partition 0 is reserved
		 * for the whole disk.
		 */
		max_part = (1UL << part_shift) - 1;
	}

	if ((1UL << part_shift) > DISK_MAX_PARTS)
		return -EINVAL;

	if (nbds_max > 1UL << (MINORBITS - part_shift))
		return -EINVAL;

	for (i = 0; i < nbds_max; i++) {
	for (i = 0; i < nbds_max; i++) {
		struct gendisk *disk = alloc_disk(1 << part_shift);
		struct gendisk *disk = alloc_disk(1 << part_shift);
		if (!disk)
		if (!disk)
+6 −4
Original line number Original line Diff line number Diff line
@@ -809,11 +809,13 @@ static int __init xen_blkif_init(void)
 failed_init:
 failed_init:
	kfree(blkbk->pending_reqs);
	kfree(blkbk->pending_reqs);
	kfree(blkbk->pending_grant_handles);
	kfree(blkbk->pending_grant_handles);
	if (blkbk->pending_pages) {
		for (i = 0; i < mmap_pages; i++) {
		for (i = 0; i < mmap_pages; i++) {
			if (blkbk->pending_pages[i])
			if (blkbk->pending_pages[i])
				__free_page(blkbk->pending_pages[i]);
				__free_page(blkbk->pending_pages[i]);
		}
		}
		kfree(blkbk->pending_pages);
		kfree(blkbk->pending_pages);
	}
	kfree(blkbk);
	kfree(blkbk);
	blkbk = NULL;
	blkbk = NULL;
	return rc;
	return rc;
+1 −2
Original line number Original line Diff line number Diff line
@@ -357,14 +357,13 @@ static int xen_vbd_create(struct xen_blkif *blkif, blkif_vdev_t handle,
	}
	}


	vbd->bdev = bdev;
	vbd->bdev = bdev;
	vbd->size = vbd_sz(vbd);

	if (vbd->bdev->bd_disk == NULL) {
	if (vbd->bdev->bd_disk == NULL) {
		DPRINTK("xen_vbd_create: device %08x doesn't exist.\n",
		DPRINTK("xen_vbd_create: device %08x doesn't exist.\n",
			vbd->pdevice);
			vbd->pdevice);
		xen_vbd_free(vbd);
		xen_vbd_free(vbd);
		return -ENOENT;
		return -ENOENT;
	}
	}
	vbd->size = vbd_sz(vbd);


	if (vbd->bdev->bd_disk->flags & GENHD_FL_CD || cdrom)
	if (vbd->bdev->bd_disk->flags & GENHD_FL_CD || cdrom)
		vbd->type |= VDISK_CDROM;
		vbd->type |= VDISK_CDROM;
Loading