aboutsummaryrefslogtreecommitdiffstats
path: root/block/genhd.c
diff options
context:
space:
mode:
Diffstat (limited to 'block/genhd.c')
-rw-r--r--block/genhd.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/block/genhd.c b/block/genhd.c
index a9ec910974c1..1a4916e01732 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -98,7 +98,7 @@ void disk_part_iter_init(struct disk_part_iter *piter, struct gendisk *disk,
98 98
99 if (flags & DISK_PITER_REVERSE) 99 if (flags & DISK_PITER_REVERSE)
100 piter->idx = ptbl->len - 1; 100 piter->idx = ptbl->len - 1;
101 else if (flags & DISK_PITER_INCL_PART0) 101 else if (flags & (DISK_PITER_INCL_PART0 | DISK_PITER_INCL_EMPTY_PART0))
102 piter->idx = 0; 102 piter->idx = 0;
103 else 103 else
104 piter->idx = 1; 104 piter->idx = 1;
@@ -134,7 +134,8 @@ struct hd_struct *disk_part_iter_next(struct disk_part_iter *piter)
134 /* determine iteration parameters */ 134 /* determine iteration parameters */
135 if (piter->flags & DISK_PITER_REVERSE) { 135 if (piter->flags & DISK_PITER_REVERSE) {
136 inc = -1; 136 inc = -1;
137 if (piter->flags & DISK_PITER_INCL_PART0) 137 if (piter->flags & (DISK_PITER_INCL_PART0 |
138 DISK_PITER_INCL_EMPTY_PART0))
138 end = -1; 139 end = -1;
139 else 140 else
140 end = 0; 141 end = 0;
@@ -150,7 +151,10 @@ struct hd_struct *disk_part_iter_next(struct disk_part_iter *piter)
150 part = rcu_dereference(ptbl->part[piter->idx]); 151 part = rcu_dereference(ptbl->part[piter->idx]);
151 if (!part) 152 if (!part)
152 continue; 153 continue;
153 if (!(piter->flags & DISK_PITER_INCL_EMPTY) && !part->nr_sects) 154 if (!part->nr_sects &&
155 !(piter->flags & DISK_PITER_INCL_EMPTY) &&
156 !(piter->flags & DISK_PITER_INCL_EMPTY_PART0 &&
157 piter->idx == 0))
154 continue; 158 continue;
155 159
156 get_device(part_to_dev(part)); 160 get_device(part_to_dev(part));
@@ -1011,7 +1015,7 @@ static int diskstats_show(struct seq_file *seqf, void *v)
1011 "\n\n"); 1015 "\n\n");
1012 */ 1016 */
1013 1017
1014 disk_part_iter_init(&piter, gp, DISK_PITER_INCL_PART0); 1018 disk_part_iter_init(&piter, gp, DISK_PITER_INCL_EMPTY_PART0);
1015 while ((hd = disk_part_iter_next(&piter))) { 1019 while ((hd = disk_part_iter_next(&piter))) {
1016 cpu = part_stat_lock(); 1020 cpu = part_stat_lock();
1017 part_round_stats(cpu, hd); 1021 part_round_stats(cpu, hd);