aboutsummaryrefslogtreecommitdiffstats
path: root/fs/block_dev.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2011-05-23 07:26:07 -0400
committerJens Axboe <jaxboe@fusionio.com>2011-05-23 07:26:07 -0400
commit7e69723fef8771a9d57bd27d36281d756130b4b5 (patch)
tree0b43d02f5c2eccb932564ed7c3999eb4e649b066 /fs/block_dev.c
parent95cf3dd9dbe6883a0328724e2110e3fc6465630b (diff)
block: move bd_set_size() above rescan_partitions() in __blkdev_get()
02e352287a4 (block: rescan partitions on invalidated devices on -ENOMEDIA too) relocated partition rescan above explicit bd_set_size() to simplify condition check. As rescan_partitions() does its own bdev size setting, this doesn't break anything; however, rescan_partitions() prints out the following messages when adjusting bdev size, which can be confusing. sda: detected capacity change from 0 to 146815737856 sdb: detected capacity change from 0 to 146815737856 This patch restores the original order and remove the warning messages. stable: Please apply together with 02e352287a4 (block: rescan partitions on invalidated devices on -ENOMEDIA too). Signed-off-by: Tejun Heo <tj@kernel.org> Reported-by: Tony Luck <tony.luck@gmail.com> Tested-by: Tony Luck <tony.luck@gmail.com> Cc: stable@kernel.org Stable note: 2.6.39 only. Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'fs/block_dev.c')
-rw-r--r--fs/block_dev.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c
index d7c2e0fddc6f..1f2b19978333 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1120,6 +1120,15 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
1120 goto restart; 1120 goto restart;
1121 } 1121 }
1122 } 1122 }
1123
1124 if (!ret && !bdev->bd_openers) {
1125 bd_set_size(bdev,(loff_t)get_capacity(disk)<<9);
1126 bdi = blk_get_backing_dev_info(bdev);
1127 if (bdi == NULL)
1128 bdi = &default_backing_dev_info;
1129 bdev_inode_switch_bdi(bdev->bd_inode, bdi);
1130 }
1131
1123 /* 1132 /*
1124 * If the device is invalidated, rescan partition 1133 * If the device is invalidated, rescan partition
1125 * if open succeeded or failed with -ENOMEDIUM. 1134 * if open succeeded or failed with -ENOMEDIUM.
@@ -1130,14 +1139,6 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
1130 rescan_partitions(disk, bdev); 1139 rescan_partitions(disk, bdev);
1131 if (ret) 1140 if (ret)
1132 goto out_clear; 1141 goto out_clear;
1133
1134 if (!bdev->bd_openers) {
1135 bd_set_size(bdev,(loff_t)get_capacity(disk)<<9);
1136 bdi = blk_get_backing_dev_info(bdev);
1137 if (bdi == NULL)
1138 bdi = &default_backing_dev_info;
1139 bdev_inode_switch_bdi(bdev->bd_inode, bdi);
1140 }
1141 } else { 1142 } else {
1142 struct block_device *whole; 1143 struct block_device *whole;
1143 whole = bdget_disk(disk, 0); 1144 whole = bdget_disk(disk, 0);