aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2008-08-25 06:30:12 -0400
committerJens Axboe <jens.axboe@oracle.com>2008-10-09 02:56:04 -0400
commitac65ece4eee10b03ac29ee925cadc179dc810bab (patch)
tree529f3a2c212aaa6aa5010c41aa9ec59bd6635c17 /block
parent5a3ceb861663040f9ef0176df4aaa494bba5e352 (diff)
block: fix partition info printouts
Recent block_class iteration updates 5c6f35c5..27f3025 broke partition info printouts. * printk_all_partitions(): Partition print out stops when it meets a partition hole. Partition printing inner loop should continue instead of exiting on empty partition slot. * /proc/partitions and /proc/diskstats: If all information can't be read in single read(), the information is truncated. This is because find_start() doesn't actually update the counter containing the initial seek. It runs to the end and ends up always reporting EOF on the second read. This patch fixes both problems. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block')
-rw-r--r--block/genhd.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/block/genhd.c b/block/genhd.c
index c114a43052de..0be95135c404 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -236,7 +236,7 @@ static int printk_partition(struct device *dev, void *data)
236 int n; 236 int n;
237 237
238 if (dev->type != &disk_type) 238 if (dev->type != &disk_type)
239 goto exit; 239 return 0;
240 240
241 sgp = dev_to_disk(dev); 241 sgp = dev_to_disk(dev);
242 /* 242 /*
@@ -244,7 +244,7 @@ static int printk_partition(struct device *dev, void *data)
244 */ 244 */
245 if (get_capacity(sgp) == 0 || 245 if (get_capacity(sgp) == 0 ||
246 (sgp->flags & GENHD_FL_SUPPRESS_PARTITION_INFO)) 246 (sgp->flags & GENHD_FL_SUPPRESS_PARTITION_INFO))
247 goto exit; 247 return 0;
248 248
249 /* 249 /*
250 * Note, unlike /proc/partitions, I am showing the numbers in 250 * Note, unlike /proc/partitions, I am showing the numbers in
@@ -264,15 +264,15 @@ static int printk_partition(struct device *dev, void *data)
264 /* now show the partitions */ 264 /* now show the partitions */
265 for (n = 0; n < sgp->minors - 1; ++n) { 265 for (n = 0; n < sgp->minors - 1; ++n) {
266 if (sgp->part[n] == NULL) 266 if (sgp->part[n] == NULL)
267 goto exit; 267 continue;
268 if (sgp->part[n]->nr_sects == 0) 268 if (sgp->part[n]->nr_sects == 0)
269 goto exit; 269 continue;
270 printk(" %02x%02x %10llu %s\n", 270 printk(" %02x%02x %10llu %s\n",
271 sgp->major, n + 1 + sgp->first_minor, 271 sgp->major, n + 1 + sgp->first_minor,
272 (unsigned long long)sgp->part[n]->nr_sects >> 1, 272 (unsigned long long)sgp->part[n]->nr_sects >> 1,
273 disk_name(sgp, n + 1, buf)); 273 disk_name(sgp, n + 1, buf));
274 } 274 }
275exit: 275
276 return 0; 276 return 0;
277} 277}
278 278