aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-08-10 18:22:42 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-10 18:22:42 -0400
commit2f9e825d3e0e2b407ae8f082de5c00afcf7378fb (patch)
treef8b3ee40674ce4acd5508a0a0bf52a30904caf6c /drivers/md/md.c
parent7ae0dea900b027cd90e8a3e14deca9a19e17638b (diff)
parentde75d60d5ea235e6e09f4962ab22541ce0fe176a (diff)
Merge branch 'for-2.6.36' of git://git.kernel.dk/linux-2.6-block
* 'for-2.6.36' of git://git.kernel.dk/linux-2.6-block: (149 commits) block: make sure that REQ_* types are seen even with CONFIG_BLOCK=n xen-blkfront: fix missing out label blkdev: fix blkdev_issue_zeroout return value block: update request stacking methods to support discards block: fix missing export of blk_types.h writeback: fix bad _bh spinlock nesting drbd: revert "delay probes", feature is being re-implemented differently drbd: Initialize all members of sync_conf to their defaults [Bugz 315] drbd: Disable delay probes for the upcomming release writeback: cleanup bdi_register writeback: add new tracepoints writeback: remove unnecessary init_timer call writeback: optimize periodic bdi thread wakeups writeback: prevent unnecessary bdi threads wakeups writeback: move bdi threads exiting logic to the forker thread writeback: restructure bdi forker loop a little writeback: move last_active to bdi writeback: do not remove bdi from bdi_list writeback: simplify bdi code a little writeback: do not lose wake-ups in bdi threads ... Fixed up pretty trivial conflicts in drivers/block/virtio_blk.c and drivers/scsi/scsi_error.c as per Jens.
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index cb20d0b0555a..700c96edf9b2 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -36,6 +36,7 @@
36#include <linux/blkdev.h> 36#include <linux/blkdev.h>
37#include <linux/sysctl.h> 37#include <linux/sysctl.h>
38#include <linux/seq_file.h> 38#include <linux/seq_file.h>
39#include <linux/smp_lock.h>
39#include <linux/buffer_head.h> /* for invalidate_bdev */ 40#include <linux/buffer_head.h> /* for invalidate_bdev */
40#include <linux/poll.h> 41#include <linux/poll.h>
41#include <linux/ctype.h> 42#include <linux/ctype.h>
@@ -353,7 +354,7 @@ static void md_submit_barrier(struct work_struct *ws)
353 /* an empty barrier - all done */ 354 /* an empty barrier - all done */
354 bio_endio(bio, 0); 355 bio_endio(bio, 0);
355 else { 356 else {
356 bio->bi_rw &= ~(1<<BIO_RW_BARRIER); 357 bio->bi_rw &= ~REQ_HARDBARRIER;
357 if (mddev->pers->make_request(mddev, bio)) 358 if (mddev->pers->make_request(mddev, bio))
358 generic_make_request(bio); 359 generic_make_request(bio);
359 mddev->barrier = POST_REQUEST_BARRIER; 360 mddev->barrier = POST_REQUEST_BARRIER;
@@ -675,11 +676,11 @@ void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev,
675 * if zero is reached. 676 * if zero is reached.
676 * If an error occurred, call md_error 677 * If an error occurred, call md_error
677 * 678 *
678 * As we might need to resubmit the request if BIO_RW_BARRIER 679 * As we might need to resubmit the request if REQ_HARDBARRIER
679 * causes ENOTSUPP, we allocate a spare bio... 680 * causes ENOTSUPP, we allocate a spare bio...
680 */ 681 */
681 struct bio *bio = bio_alloc(GFP_NOIO, 1); 682 struct bio *bio = bio_alloc(GFP_NOIO, 1);
682 int rw = (1<<BIO_RW) | (1<<BIO_RW_SYNCIO) | (1<<BIO_RW_UNPLUG); 683 int rw = REQ_WRITE | REQ_SYNC | REQ_UNPLUG;
683 684
684 bio->bi_bdev = rdev->bdev; 685 bio->bi_bdev = rdev->bdev;
685 bio->bi_sector = sector; 686 bio->bi_sector = sector;
@@ -691,7 +692,7 @@ void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev,
691 atomic_inc(&mddev->pending_writes); 692 atomic_inc(&mddev->pending_writes);
692 if (!test_bit(BarriersNotsupp, &rdev->flags)) { 693 if (!test_bit(BarriersNotsupp, &rdev->flags)) {
693 struct bio *rbio; 694 struct bio *rbio;
694 rw |= (1<<BIO_RW_BARRIER); 695 rw |= REQ_HARDBARRIER;
695 rbio = bio_clone(bio, GFP_NOIO); 696 rbio = bio_clone(bio, GFP_NOIO);
696 rbio->bi_private = bio; 697 rbio->bi_private = bio;
697 rbio->bi_end_io = super_written_barrier; 698 rbio->bi_end_io = super_written_barrier;
@@ -736,7 +737,7 @@ int sync_page_io(struct block_device *bdev, sector_t sector, int size,
736 struct completion event; 737 struct completion event;
737 int ret; 738 int ret;
738 739
739 rw |= (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG); 740 rw |= REQ_SYNC | REQ_UNPLUG;
740 741
741 bio->bi_bdev = bdev; 742 bio->bi_bdev = bdev;
742 bio->bi_sector = sector; 743 bio->bi_sector = sector;
@@ -5902,6 +5903,7 @@ static int md_open(struct block_device *bdev, fmode_t mode)
5902 mddev_t *mddev = mddev_find(bdev->bd_dev); 5903 mddev_t *mddev = mddev_find(bdev->bd_dev);
5903 int err; 5904 int err;
5904 5905
5906 lock_kernel();
5905 if (mddev->gendisk != bdev->bd_disk) { 5907 if (mddev->gendisk != bdev->bd_disk) {
5906 /* we are racing with mddev_put which is discarding this 5908 /* we are racing with mddev_put which is discarding this
5907 * bd_disk. 5909 * bd_disk.
@@ -5910,6 +5912,7 @@ static int md_open(struct block_device *bdev, fmode_t mode)
5910 /* Wait until bdev->bd_disk is definitely gone */ 5912 /* Wait until bdev->bd_disk is definitely gone */
5911 flush_scheduled_work(); 5913 flush_scheduled_work();
5912 /* Then retry the open from the top */ 5914 /* Then retry the open from the top */
5915 unlock_kernel();
5913 return -ERESTARTSYS; 5916 return -ERESTARTSYS;
5914 } 5917 }
5915 BUG_ON(mddev != bdev->bd_disk->private_data); 5918 BUG_ON(mddev != bdev->bd_disk->private_data);
@@ -5923,6 +5926,7 @@ static int md_open(struct block_device *bdev, fmode_t mode)
5923 5926
5924 check_disk_size_change(mddev->gendisk, bdev); 5927 check_disk_size_change(mddev->gendisk, bdev);
5925 out: 5928 out:
5929 unlock_kernel();
5926 return err; 5930 return err;
5927} 5931}
5928 5932
@@ -5931,8 +5935,10 @@ static int md_release(struct gendisk *disk, fmode_t mode)
5931 mddev_t *mddev = disk->private_data; 5935 mddev_t *mddev = disk->private_data;
5932 5936
5933 BUG_ON(!mddev); 5937 BUG_ON(!mddev);
5938 lock_kernel();
5934 atomic_dec(&mddev->openers); 5939 atomic_dec(&mddev->openers);
5935 mddev_put(mddev); 5940 mddev_put(mddev);
5941 unlock_kernel();
5936 5942
5937 return 0; 5943 return 0;
5938} 5944}