Commit b0d78ee8 authored by Linus Torvalds's avatar Linus Torvalds

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

* 'for-linus' of git://git.kernel.dk/linux-block:
  block: don't kick empty queue in blk_drain_queue()
  block/swim3: Locking fixes
  loop: Fix discard_alignment default setting
  cfq-iosched: fix cfq_cic_link() race confition
  cfq-iosched: free cic_index if blkio_alloc_blkg_stats fails
  cciss: fix flush cache transfer length
  cciss: Add IRQF_SHARED back in for the non-MSI(X) interrupt handler
  loop: fix loop block driver discard and encryption comment
  block: initialize request_queue's numa node during
parents 6f12d2ee 4eabc941
...@@ -366,7 +366,14 @@ void blk_drain_queue(struct request_queue *q, bool drain_all) ...@@ -366,7 +366,14 @@ void blk_drain_queue(struct request_queue *q, bool drain_all)
if (drain_all) if (drain_all)
blk_throtl_drain(q); blk_throtl_drain(q);
__blk_run_queue(q); /*
* This function might be called on a queue which failed
* driver init after queue creation. Some drivers
* (e.g. fd) get unhappy in such cases. Kick queue iff
* dispatch queue has something on it.
*/
if (!list_empty(&q->queue_head))
__blk_run_queue(q);
if (drain_all) if (drain_all)
nr_rqs = q->rq.count[0] + q->rq.count[1]; nr_rqs = q->rq.count[0] + q->rq.count[1];
...@@ -467,6 +474,7 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id) ...@@ -467,6 +474,7 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id)
q->backing_dev_info.state = 0; q->backing_dev_info.state = 0;
q->backing_dev_info.capabilities = BDI_CAP_MAP_COPY; q->backing_dev_info.capabilities = BDI_CAP_MAP_COPY;
q->backing_dev_info.name = "block"; q->backing_dev_info.name = "block";
q->node = node_id;
err = bdi_init(&q->backing_dev_info); err = bdi_init(&q->backing_dev_info);
if (err) { if (err) {
...@@ -551,7 +559,7 @@ blk_init_queue_node(request_fn_proc *rfn, spinlock_t *lock, int node_id) ...@@ -551,7 +559,7 @@ blk_init_queue_node(request_fn_proc *rfn, spinlock_t *lock, int node_id)
if (!uninit_q) if (!uninit_q)
return NULL; return NULL;
q = blk_init_allocated_queue_node(uninit_q, rfn, lock, node_id); q = blk_init_allocated_queue(uninit_q, rfn, lock);
if (!q) if (!q)
blk_cleanup_queue(uninit_q); blk_cleanup_queue(uninit_q);
...@@ -562,19 +570,10 @@ EXPORT_SYMBOL(blk_init_queue_node); ...@@ -562,19 +570,10 @@ EXPORT_SYMBOL(blk_init_queue_node);
struct request_queue * struct request_queue *
blk_init_allocated_queue(struct request_queue *q, request_fn_proc *rfn, blk_init_allocated_queue(struct request_queue *q, request_fn_proc *rfn,
spinlock_t *lock) spinlock_t *lock)
{
return blk_init_allocated_queue_node(q, rfn, lock, -1);
}
EXPORT_SYMBOL(blk_init_allocated_queue);
struct request_queue *
blk_init_allocated_queue_node(struct request_queue *q, request_fn_proc *rfn,
spinlock_t *lock, int node_id)
{ {
if (!q) if (!q)
return NULL; return NULL;
q->node = node_id;
if (blk_init_free_list(q)) if (blk_init_free_list(q))
return NULL; return NULL;
...@@ -604,7 +603,7 @@ blk_init_allocated_queue_node(struct request_queue *q, request_fn_proc *rfn, ...@@ -604,7 +603,7 @@ blk_init_allocated_queue_node(struct request_queue *q, request_fn_proc *rfn,
return NULL; return NULL;
} }
EXPORT_SYMBOL(blk_init_allocated_queue_node); EXPORT_SYMBOL(blk_init_allocated_queue);
int blk_get_queue(struct request_queue *q) int blk_get_queue(struct request_queue *q)
{ {
......
...@@ -3184,7 +3184,7 @@ static int cfq_cic_link(struct cfq_data *cfqd, struct io_context *ioc, ...@@ -3184,7 +3184,7 @@ static int cfq_cic_link(struct cfq_data *cfqd, struct io_context *ioc,
} }
} }
if (ret) if (ret && ret != -EEXIST)
printk(KERN_ERR "cfq: cic link failed!\n"); printk(KERN_ERR "cfq: cic link failed!\n");
return ret; return ret;
...@@ -3200,6 +3200,7 @@ cfq_get_io_context(struct cfq_data *cfqd, gfp_t gfp_mask) ...@@ -3200,6 +3200,7 @@ cfq_get_io_context(struct cfq_data *cfqd, gfp_t gfp_mask)
{ {
struct io_context *ioc = NULL; struct io_context *ioc = NULL;
struct cfq_io_context *cic; struct cfq_io_context *cic;
int ret;
might_sleep_if(gfp_mask & __GFP_WAIT); might_sleep_if(gfp_mask & __GFP_WAIT);
...@@ -3207,6 +3208,7 @@ cfq_get_io_context(struct cfq_data *cfqd, gfp_t gfp_mask) ...@@ -3207,6 +3208,7 @@ cfq_get_io_context(struct cfq_data *cfqd, gfp_t gfp_mask)
if (!ioc) if (!ioc)
return NULL; return NULL;
retry:
cic = cfq_cic_lookup(cfqd, ioc); cic = cfq_cic_lookup(cfqd, ioc);
if (cic) if (cic)
goto out; goto out;
...@@ -3215,7 +3217,12 @@ cfq_get_io_context(struct cfq_data *cfqd, gfp_t gfp_mask) ...@@ -3215,7 +3217,12 @@ cfq_get_io_context(struct cfq_data *cfqd, gfp_t gfp_mask)
if (cic == NULL) if (cic == NULL)
goto err; goto err;
if (cfq_cic_link(cfqd, ioc, cic, gfp_mask)) ret = cfq_cic_link(cfqd, ioc, cic, gfp_mask);
if (ret == -EEXIST) {
/* someone has linked cic to ioc already */
cfq_cic_free(cic);
goto retry;
} else if (ret)
goto err_free; goto err_free;
out: out:
...@@ -4036,6 +4043,11 @@ static void *cfq_init_queue(struct request_queue *q) ...@@ -4036,6 +4043,11 @@ static void *cfq_init_queue(struct request_queue *q)
if (blkio_alloc_blkg_stats(&cfqg->blkg)) { if (blkio_alloc_blkg_stats(&cfqg->blkg)) {
kfree(cfqg); kfree(cfqg);
spin_lock(&cic_index_lock);
ida_remove(&cic_index_ida, cfqd->cic_index);
spin_unlock(&cic_index_lock);
kfree(cfqd); kfree(cfqd);
return NULL; return NULL;
} }
......
...@@ -2601,6 +2601,8 @@ static int fill_cmd(ctlr_info_t *h, CommandList_struct *c, __u8 cmd, void *buff, ...@@ -2601,6 +2601,8 @@ static int fill_cmd(ctlr_info_t *h, CommandList_struct *c, __u8 cmd, void *buff,
c->Request.Timeout = 0; c->Request.Timeout = 0;
c->Request.CDB[0] = BMIC_WRITE; c->Request.CDB[0] = BMIC_WRITE;
c->Request.CDB[6] = BMIC_CACHE_FLUSH; c->Request.CDB[6] = BMIC_CACHE_FLUSH;
c->Request.CDB[7] = (size >> 8) & 0xFF;
c->Request.CDB[8] = size & 0xFF;
break; break;
case TEST_UNIT_READY: case TEST_UNIT_READY:
c->Request.CDBLen = 6; c->Request.CDBLen = 6;
...@@ -4880,7 +4882,7 @@ static int cciss_request_irq(ctlr_info_t *h, ...@@ -4880,7 +4882,7 @@ static int cciss_request_irq(ctlr_info_t *h,
{ {
if (h->msix_vector || h->msi_vector) { if (h->msix_vector || h->msi_vector) {
if (!request_irq(h->intr[h->intr_mode], msixhandler, if (!request_irq(h->intr[h->intr_mode], msixhandler,
IRQF_DISABLED, h->devname, h)) 0, h->devname, h))
return 0; return 0;
dev_err(&h->pdev->dev, "Unable to get msi irq %d" dev_err(&h->pdev->dev, "Unable to get msi irq %d"
" for %s\n", h->intr[h->intr_mode], " for %s\n", h->intr[h->intr_mode],
...@@ -4889,7 +4891,7 @@ static int cciss_request_irq(ctlr_info_t *h, ...@@ -4889,7 +4891,7 @@ static int cciss_request_irq(ctlr_info_t *h,
} }
if (!request_irq(h->intr[h->intr_mode], intxhandler, if (!request_irq(h->intr[h->intr_mode], intxhandler,
IRQF_DISABLED, h->devname, h)) IRQF_SHARED, h->devname, h))
return 0; return 0;
dev_err(&h->pdev->dev, "Unable to get irq %d for %s\n", dev_err(&h->pdev->dev, "Unable to get irq %d for %s\n",
h->intr[h->intr_mode], h->devname); h->intr[h->intr_mode], h->devname);
......
...@@ -422,7 +422,7 @@ static int do_bio_filebacked(struct loop_device *lo, struct bio *bio) ...@@ -422,7 +422,7 @@ static int do_bio_filebacked(struct loop_device *lo, struct bio *bio)
/* /*
* We use punch hole to reclaim the free space used by the * We use punch hole to reclaim the free space used by the
* image a.k.a. discard. However we do support discard if * image a.k.a. discard. However we do not support discard if
* encryption is enabled, because it may give an attacker * encryption is enabled, because it may give an attacker
* useful information. * useful information.
*/ */
...@@ -797,7 +797,7 @@ static void loop_config_discard(struct loop_device *lo) ...@@ -797,7 +797,7 @@ static void loop_config_discard(struct loop_device *lo)
} }
q->limits.discard_granularity = inode->i_sb->s_blocksize; q->limits.discard_granularity = inode->i_sb->s_blocksize;
q->limits.discard_alignment = inode->i_sb->s_blocksize; q->limits.discard_alignment = 0;
q->limits.max_discard_sectors = UINT_MAX >> 9; q->limits.max_discard_sectors = UINT_MAX >> 9;
q->limits.discard_zeroes_data = 1; q->limits.discard_zeroes_data = 1;
queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, q); queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, q);
......
This diff is collapsed.
...@@ -805,9 +805,6 @@ extern void blk_unprep_request(struct request *); ...@@ -805,9 +805,6 @@ extern void blk_unprep_request(struct request *);
*/ */
extern struct request_queue *blk_init_queue_node(request_fn_proc *rfn, extern struct request_queue *blk_init_queue_node(request_fn_proc *rfn,
spinlock_t *lock, int node_id); spinlock_t *lock, int node_id);
extern struct request_queue *blk_init_allocated_queue_node(struct request_queue *,
request_fn_proc *,
spinlock_t *, int node_id);
extern struct request_queue *blk_init_queue(request_fn_proc *, spinlock_t *); extern struct request_queue *blk_init_queue(request_fn_proc *, spinlock_t *);
extern struct request_queue *blk_init_allocated_queue(struct request_queue *, extern struct request_queue *blk_init_allocated_queue(struct request_queue *,
request_fn_proc *, spinlock_t *); request_fn_proc *, spinlock_t *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment