Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block
Browse files Browse the repository at this point in the history
* 'for-linus' of git://git.kernel.dk/linux-2.6-block:
  block: fix missing bio back/front segment size setting in blk_recount_segments()
  loop: don't increment p->offset with (size_t) -EINVAL
  cciss: remove 30 second initial timeout on controller reset
  Fix kernel NULL pointer dereference in xen-blkfront
  • Loading branch information
Linus Torvalds committed Mar 8, 2009
2 parents d3dea1e + 59247ea commit 81d1ab8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 23 deletions.
25 changes: 9 additions & 16 deletions block/blk-merge.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,13 @@ void blk_recalc_rq_sectors(struct request *rq, int nsect)
}

static unsigned int __blk_recalc_rq_segments(struct request_queue *q,
struct bio *bio,
unsigned int *seg_size_ptr)
struct bio *bio)
{
unsigned int phys_size;
struct bio_vec *bv, *bvprv = NULL;
int cluster, i, high, highprv = 1;
unsigned int seg_size, nr_phys_segs;
struct bio *fbio;
struct bio *fbio, *bbio;

if (!bio)
return 0;
Expand Down Expand Up @@ -87,34 +86,28 @@ static unsigned int __blk_recalc_rq_segments(struct request_queue *q,
seg_size = bv->bv_len;
highprv = high;
}
bbio = bio;
}

if (seg_size_ptr)
*seg_size_ptr = seg_size;
if (nr_phys_segs == 1 && seg_size > fbio->bi_seg_front_size)
fbio->bi_seg_front_size = seg_size;
if (seg_size > bbio->bi_seg_back_size)
bbio->bi_seg_back_size = seg_size;

return nr_phys_segs;
}

void blk_recalc_rq_segments(struct request *rq)
{
unsigned int seg_size = 0, phys_segs;

phys_segs = __blk_recalc_rq_segments(rq->q, rq->bio, &seg_size);

if (phys_segs == 1 && seg_size > rq->bio->bi_seg_front_size)
rq->bio->bi_seg_front_size = seg_size;
if (seg_size > rq->biotail->bi_seg_back_size)
rq->biotail->bi_seg_back_size = seg_size;

rq->nr_phys_segments = phys_segs;
rq->nr_phys_segments = __blk_recalc_rq_segments(rq->q, rq->bio);
}

void blk_recount_segments(struct request_queue *q, struct bio *bio)
{
struct bio *nxt = bio->bi_next;

bio->bi_next = NULL;
bio->bi_phys_segments = __blk_recalc_rq_segments(q, bio, NULL);
bio->bi_phys_segments = __blk_recalc_rq_segments(q, bio);
bio->bi_next = nxt;
bio->bi_flags |= (1 << BIO_SEG_VALID);
}
Expand Down
8 changes: 3 additions & 5 deletions drivers/block/cciss.c
Original file line number Diff line number Diff line change
Expand Up @@ -3606,11 +3606,9 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
if (cciss_hard_reset_controller(pdev) || cciss_reset_msi(pdev))
return -ENODEV;

/* Some devices (notably the HP Smart Array 5i Controller)
need a little pause here */
schedule_timeout_uninterruptible(30*HZ);

/* Now try to get the controller to respond to a no-op */
/* Now try to get the controller to respond to a no-op. Some
devices (notably the HP Smart Array 5i Controller) need
up to 30 seconds to respond. */
for (i=0; i<30; i++) {
if (cciss_noop(pdev) == 0)
break;
Expand Down
3 changes: 1 addition & 2 deletions drivers/block/loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,7 @@ lo_splice_actor(struct pipe_inode_info *pipe, struct pipe_buffer *buf,
struct loop_device *lo = p->lo;
struct page *page = buf->page;
sector_t IV;
size_t size;
int ret;
int size, ret;

ret = buf->ops->confirm(pipe, buf);
if (unlikely(ret))
Expand Down
2 changes: 2 additions & 0 deletions drivers/block/xen-blkfront.c
Original file line number Diff line number Diff line change
Expand Up @@ -977,6 +977,8 @@ static void backend_changed(struct xenbus_device *dev,
break;

case XenbusStateClosing:
if (info->gd == NULL)
xenbus_dev_fatal(dev, -ENODEV, "gd is NULL");
bd = bdget_disk(info->gd, 0);
if (bd == NULL)
xenbus_dev_fatal(dev, -ENODEV, "bdget failed");
Expand Down

0 comments on commit 81d1ab8

Please sign in to comment.