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
This commit is contained in:
commit
4f1ba49efa
9 changed files with 41 additions and 28 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 @@ new_queue:
|
||||||
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");
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -1272,8 +1272,8 @@ int blkdev_get(struct block_device *bdev, fmode_t mode, void *holder)
|
||||||
* individual writeable reference is too fragile given the
|
* individual writeable reference is too fragile given the
|
||||||
* way @mode is used in blkdev_get/put().
|
* way @mode is used in blkdev_get/put().
|
||||||
*/
|
*/
|
||||||
if ((disk->flags & GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE) &&
|
if (!res && (mode & FMODE_WRITE) && !bdev->bd_write_holder &&
|
||||||
!res && (mode & FMODE_WRITE) && !bdev->bd_write_holder) {
|
(disk->flags & GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE)) {
|
||||||
bdev->bd_write_holder = true;
|
bdev->bd_write_holder = true;
|
||||||
disk_block_events(disk);
|
disk_block_events(disk);
|
||||||
}
|
}
|
||||||
|
|
|
@ -255,13 +255,7 @@ ssize_t part_discard_alignment_show(struct device *dev,
|
||||||
struct device_attribute *attr, char *buf)
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct hd_struct *p = dev_to_part(dev);
|
struct hd_struct *p = dev_to_part(dev);
|
||||||
struct gendisk *disk = dev_to_disk(dev);
|
return sprintf(buf, "%u\n", p->discard_alignment);
|
||||||
unsigned int alignment = 0;
|
|
||||||
|
|
||||||
if (disk->queue)
|
|
||||||
alignment = queue_limit_discard_alignment(&disk->queue->limits,
|
|
||||||
p->start_sect);
|
|
||||||
return sprintf(buf, "%u\n", alignment);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ssize_t part_stat_show(struct device *dev,
|
ssize_t part_stat_show(struct device *dev,
|
||||||
|
@ -455,6 +449,8 @@ struct hd_struct *add_partition(struct gendisk *disk, int partno,
|
||||||
p->start_sect = start;
|
p->start_sect = start;
|
||||||
p->alignment_offset =
|
p->alignment_offset =
|
||||||
queue_limit_alignment_offset(&disk->queue->limits, start);
|
queue_limit_alignment_offset(&disk->queue->limits, start);
|
||||||
|
p->discard_alignment =
|
||||||
|
queue_limit_discard_alignment(&disk->queue->limits, start);
|
||||||
p->nr_sects = len;
|
p->nr_sects = len;
|
||||||
p->partno = partno;
|
p->partno = partno;
|
||||||
p->policy = get_disk_ro(disk);
|
p->policy = get_disk_ro(disk);
|
||||||
|
|
|
@ -1282,8 +1282,8 @@ queue_max_integrity_segments(struct request_queue *q)
|
||||||
#define blk_get_integrity(a) (0)
|
#define blk_get_integrity(a) (0)
|
||||||
#define blk_integrity_compare(a, b) (0)
|
#define blk_integrity_compare(a, b) (0)
|
||||||
#define blk_integrity_register(a, b) (0)
|
#define blk_integrity_register(a, b) (0)
|
||||||
#define blk_integrity_unregister(a) do { } while (0);
|
#define blk_integrity_unregister(a) do { } while (0)
|
||||||
#define blk_queue_max_integrity_segments(a, b) do { } while (0);
|
#define blk_queue_max_integrity_segments(a, b) do { } while (0)
|
||||||
#define queue_max_integrity_segments(a) (0)
|
#define queue_max_integrity_segments(a) (0)
|
||||||
#define blk_integrity_merge_rq(a, b, c) (0)
|
#define blk_integrity_merge_rq(a, b, c) (0)
|
||||||
#define blk_integrity_merge_bio(a, b, c) (0)
|
#define blk_integrity_merge_bio(a, b, c) (0)
|
||||||
|
|
|
@ -100,6 +100,7 @@ struct hd_struct {
|
||||||
sector_t start_sect;
|
sector_t start_sect;
|
||||||
sector_t nr_sects;
|
sector_t nr_sects;
|
||||||
sector_t alignment_offset;
|
sector_t alignment_offset;
|
||||||
|
unsigned int discard_alignment;
|
||||||
struct device __dev;
|
struct device __dev;
|
||||||
struct kobject *holder_dir;
|
struct kobject *holder_dir;
|
||||||
int policy, partno;
|
int policy, partno;
|
||||||
|
|
Loading…
Reference in a new issue