* 2.6.28 /proc/diskstats
@ 2009-04-12 1:00 Daniel Collins
2009-04-12 1:50 ` Andrew Morton
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: Daniel Collins @ 2009-04-12 1:00 UTC (permalink / raw)
To: linux-kernel
Hi
Since 2.6.28, fd0 isn't visible in /proc/diskstats from boot, only after
access/mount. It is visible in /sys/block/ from boot, so there are no
issues detecting it. This may also affect other devices such as hda but
I haven't tested this yet, my test system and QEMU both only have
ram0-ram15 from boot. I have tested 2.6.30-rc1 and found the same
behavior. Is this a bug or a deliberate change?
Thanks
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: 2.6.28 /proc/diskstats 2009-04-12 1:00 2.6.28 /proc/diskstats Daniel Collins @ 2009-04-12 1:50 ` Andrew Morton 2009-04-12 18:50 ` Daniel Collins ` (2 subsequent siblings) 3 siblings, 0 replies; 10+ messages in thread From: Andrew Morton @ 2009-04-12 1:50 UTC (permalink / raw) To: Daniel Collins; +Cc: linux-kernel, Tejun Heo On Sun, 12 Apr 2009 02:00:08 +0100 Daniel Collins <solemnwarning@solemnwarning.no-ip.org> wrote: > Hi > > Since 2.6.28, fd0 isn't visible in /proc/diskstats from boot, only after > access/mount. It is visible in /sys/block/ from boot, so there are no > issues detecting it. This may also affect other devices such as hda but > I haven't tested this yet, my test system and QEMU both only have > ram0-ram15 from boot. I have tested 2.6.30-rc1 and found the same > behavior. Is this a bug or a deliberate change? > Tejun touched it last :) ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: 2.6.28 /proc/diskstats 2009-04-12 1:00 2.6.28 /proc/diskstats Daniel Collins 2009-04-12 1:50 ` Andrew Morton @ 2009-04-12 18:50 ` Daniel Collins 2009-04-13 1:21 ` Daniel Collins 2009-04-14 7:52 ` Tejun Heo 3 siblings, 0 replies; 10+ messages in thread From: Daniel Collins @ 2009-04-12 18:50 UTC (permalink / raw) To: linux-kernel Reposting since I don't think anyone will see it ~150 messages down, sorry if this is the wrong way to draw attention to a bug. Daniel Collins wrote: > Hi > > Since 2.6.28, fd0 isn't visible in /proc/diskstats from boot, only > after access/mount. It is visible in /sys/block/ from boot, so there > are no issues detecting it. This may also affect other devices such as > hda but I haven't tested this yet, my test system and QEMU both only > have ram0-ram15 from boot. I have tested 2.6.30-rc1 and found the same > behavior. Is this a bug or a deliberate change? > > Thanks ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: 2.6.28 /proc/diskstats 2009-04-12 1:00 2.6.28 /proc/diskstats Daniel Collins 2009-04-12 1:50 ` Andrew Morton 2009-04-12 18:50 ` Daniel Collins @ 2009-04-13 1:21 ` Daniel Collins 2009-04-13 6:16 ` Sam Ravnborg 2009-04-14 7:52 ` Tejun Heo 3 siblings, 1 reply; 10+ messages in thread From: Daniel Collins @ 2009-04-13 1:21 UTC (permalink / raw) To: linux-kernel I've stepped through the commits in linux-2.6, the first revision with this behavior is 074a7aca7afa6f230104e8e65eba3420263714a5 Daniel Collins wrote: > Hi > > Since 2.6.28, fd0 isn't visible in /proc/diskstats from boot, only > after access/mount. It is visible in /sys/block/ from boot, so there > are no issues detecting it. This may also affect other devices such as > hda but I haven't tested this yet, my test system and QEMU both only > have ram0-ram15 from boot. I have tested 2.6.30-rc1 and found the same > behavior. Is this a bug or a deliberate change? > > Thanks ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: 2.6.28 /proc/diskstats 2009-04-13 1:21 ` Daniel Collins @ 2009-04-13 6:16 ` Sam Ravnborg 0 siblings, 0 replies; 10+ messages in thread From: Sam Ravnborg @ 2009-04-13 6:16 UTC (permalink / raw) To: Daniel Collins; +Cc: linux-kernel, Tejun Heo, Jens Axboe On Mon, Apr 13, 2009 at 02:21:10AM +0100, Daniel Collins wrote: > I've stepped through the commits in linux-2.6, the first revision with > this behavior is 074a7aca7afa6f230104e8e65eba3420263714a5 It would be a good idea to: 1) mention the subject of said path as no-one remember all these SHA-1 anyway (but include the SHA-1 for reference. 2) copy the author of said patch. The relevant patch is: "block: move stats from disk to part0" I have copied Tejun and JEns. The rest of the mail kept for reference. Sam > > Daniel Collins wrote: > >Hi > > > >Since 2.6.28, fd0 isn't visible in /proc/diskstats from boot, only > >after access/mount. It is visible in /sys/block/ from boot, so there > >are no issues detecting it. This may also affect other devices such as > >hda but I haven't tested this yet, my test system and QEMU both only > >have ram0-ram15 from boot. I have tested 2.6.30-rc1 and found the same > >behavior. Is this a bug or a deliberate change? > > > >Thanks > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: 2.6.28 /proc/diskstats 2009-04-12 1:00 2.6.28 /proc/diskstats Daniel Collins ` (2 preceding siblings ...) 2009-04-13 1:21 ` Daniel Collins @ 2009-04-14 7:52 ` Tejun Heo 2009-04-14 8:58 ` Tejun Heo 2009-04-14 8:59 ` [PATCH] block: include empty disks in /proc/diskstats Tejun Heo 3 siblings, 2 replies; 10+ messages in thread From: Tejun Heo @ 2009-04-14 7:52 UTC (permalink / raw) To: Daniel Collins; +Cc: linux-kernel Daniel Collins wrote: > Hi > > Since 2.6.28, fd0 isn't visible in /proc/diskstats from boot, only after > access/mount. It is visible in /sys/block/ from boot, so there are no > issues detecting it. This may also affect other devices such as hda but > I haven't tested this yet, my test system and QEMU both only have > ram0-ram15 from boot. I have tested 2.6.30-rc1 and found the same > behavior. Is this a bug or a deliberate change? Hmm... the reason why fd device is skipped before the first open is because diskstats_show() skips zero sized devices and open is when the floppy driver sets the capacity. I think the original code also skipped zero sized device. It could be that the original code triggered revalidation while the current one doesn't. I'll dig deeper. Thanks. -- tejun ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: 2.6.28 /proc/diskstats 2009-04-14 7:52 ` Tejun Heo @ 2009-04-14 8:58 ` Tejun Heo 2009-04-14 8:59 ` [PATCH] block: include empty disks in /proc/diskstats Tejun Heo 1 sibling, 0 replies; 10+ messages in thread From: Tejun Heo @ 2009-04-14 8:58 UTC (permalink / raw) To: Daniel Collins, Jens Axboe, Andrew Morton, Sam Ravnborg Cc: linux-kernel, stable /proc/diskstats used to show stats for all disks whether they're zero-sized or not and their non-zero partitions. Commit 074a7aca7afa6f230104e8e65eba3420263714a5 accidentally changed the behavior such that it doesn't print out zero sized disks. This patch implements DISK_PITER_INCL_EMPTY_PART0 flag to partition iterator and uses it in diskstats_show() such that empty part0 is shown in /proc/diskstats. Reported and bisectd by Dianel Collins. Signed-off-by: Tejun Heo <tj@kernel.org> Reported-by: Daniel Collins <solemnwarning@solemnwarning.no-ip.org> --- It was my bad. I missed that diskstats showed empty disks too. This fixes the problem. block/genhd.c | 12 ++++++++---- include/linux/genhd.h | 1 + 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/block/genhd.c b/block/genhd.c index a9ec910..1a4916e 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, if (flags & DISK_PITER_REVERSE) piter->idx = ptbl->len - 1; - else if (flags & DISK_PITER_INCL_PART0) + else if (flags & (DISK_PITER_INCL_PART0 | DISK_PITER_INCL_EMPTY_PART0)) piter->idx = 0; else piter->idx = 1; @@ -134,7 +134,8 @@ struct hd_struct *disk_part_iter_next(struct disk_part_iter *piter) /* determine iteration parameters */ if (piter->flags & DISK_PITER_REVERSE) { inc = -1; - if (piter->flags & DISK_PITER_INCL_PART0) + if (piter->flags & (DISK_PITER_INCL_PART0 | + DISK_PITER_INCL_EMPTY_PART0)) end = -1; else end = 0; @@ -150,7 +151,10 @@ struct hd_struct *disk_part_iter_next(struct disk_part_iter *piter) part = rcu_dereference(ptbl->part[piter->idx]); if (!part) continue; - if (!(piter->flags & DISK_PITER_INCL_EMPTY) && !part->nr_sects) + if (!part->nr_sects && + !(piter->flags & DISK_PITER_INCL_EMPTY) && + !(piter->flags & DISK_PITER_INCL_EMPTY_PART0 && + piter->idx == 0)) continue; get_device(part_to_dev(part)); @@ -1011,7 +1015,7 @@ static int diskstats_show(struct seq_file *seqf, void *v) "\n\n"); */ - disk_part_iter_init(&piter, gp, DISK_PITER_INCL_PART0); + disk_part_iter_init(&piter, gp, DISK_PITER_INCL_EMPTY_PART0); while ((hd = disk_part_iter_next(&piter))) { cpu = part_stat_lock(); part_round_stats(cpu, hd); diff --git a/include/linux/genhd.h b/include/linux/genhd.h index 634c530..a1a28ca 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h @@ -214,6 +214,7 @@ static inline void disk_put_part(struct hd_struct *part) #define DISK_PITER_REVERSE (1 << 0) /* iterate in the reverse direction */ #define DISK_PITER_INCL_EMPTY (1 << 1) /* include 0-sized parts */ #define DISK_PITER_INCL_PART0 (1 << 2) /* include partition 0 */ +#define DISK_PITER_INCL_EMPTY_PART0 (1 << 3) /* include empty partition 0 */ struct disk_part_iter { struct gendisk *disk; ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH] block: include empty disks in /proc/diskstats 2009-04-14 7:52 ` Tejun Heo 2009-04-14 8:58 ` Tejun Heo @ 2009-04-14 8:59 ` Tejun Heo 2009-04-21 21:54 ` [stable] " Chris Wright 1 sibling, 1 reply; 10+ messages in thread From: Tejun Heo @ 2009-04-14 8:59 UTC (permalink / raw) To: Daniel Collins, Jens Axboe, Andrew Morton, Sam Ravnborg Cc: linux-kernel, stable /proc/diskstats used to show stats for all disks whether they're zero-sized or not and their non-zero partitions. Commit 074a7aca7afa6f230104e8e65eba3420263714a5 accidentally changed the behavior such that it doesn't print out zero sized disks. This patch implements DISK_PITER_INCL_EMPTY_PART0 flag to partition iterator and uses it in diskstats_show() such that empty part0 is shown in /proc/diskstats. Reported and bisectd by Dianel Collins. Signed-off-by: Tejun Heo <tj@kernel.org> Reported-by: Daniel Collins <solemnwarning@solemnwarning.no-ip.org> --- It was my bad. I missed that diskstats showed empty disks too. This fixes the problem. (Oops, forgot to write SUBJECT, resending...) block/genhd.c | 12 ++++++++---- include/linux/genhd.h | 1 + 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/block/genhd.c b/block/genhd.c index a9ec910..1a4916e 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, if (flags & DISK_PITER_REVERSE) piter->idx = ptbl->len - 1; - else if (flags & DISK_PITER_INCL_PART0) + else if (flags & (DISK_PITER_INCL_PART0 | DISK_PITER_INCL_EMPTY_PART0)) piter->idx = 0; else piter->idx = 1; @@ -134,7 +134,8 @@ struct hd_struct *disk_part_iter_next(struct disk_part_iter *piter) /* determine iteration parameters */ if (piter->flags & DISK_PITER_REVERSE) { inc = -1; - if (piter->flags & DISK_PITER_INCL_PART0) + if (piter->flags & (DISK_PITER_INCL_PART0 | + DISK_PITER_INCL_EMPTY_PART0)) end = -1; else end = 0; @@ -150,7 +151,10 @@ struct hd_struct *disk_part_iter_next(struct disk_part_iter *piter) part = rcu_dereference(ptbl->part[piter->idx]); if (!part) continue; - if (!(piter->flags & DISK_PITER_INCL_EMPTY) && !part->nr_sects) + if (!part->nr_sects && + !(piter->flags & DISK_PITER_INCL_EMPTY) && + !(piter->flags & DISK_PITER_INCL_EMPTY_PART0 && + piter->idx == 0)) continue; get_device(part_to_dev(part)); @@ -1011,7 +1015,7 @@ static int diskstats_show(struct seq_file *seqf, void *v) "\n\n"); */ - disk_part_iter_init(&piter, gp, DISK_PITER_INCL_PART0); + disk_part_iter_init(&piter, gp, DISK_PITER_INCL_EMPTY_PART0); while ((hd = disk_part_iter_next(&piter))) { cpu = part_stat_lock(); part_round_stats(cpu, hd); diff --git a/include/linux/genhd.h b/include/linux/genhd.h index 634c530..a1a28ca 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h @@ -214,6 +214,7 @@ static inline void disk_put_part(struct hd_struct *part) #define DISK_PITER_REVERSE (1 << 0) /* iterate in the reverse direction */ #define DISK_PITER_INCL_EMPTY (1 << 1) /* include 0-sized parts */ #define DISK_PITER_INCL_PART0 (1 << 2) /* include partition 0 */ +#define DISK_PITER_INCL_EMPTY_PART0 (1 << 3) /* include empty partition 0 */ struct disk_part_iter { struct gendisk *disk; ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [stable] [PATCH] block: include empty disks in /proc/diskstats 2009-04-14 8:59 ` [PATCH] block: include empty disks in /proc/diskstats Tejun Heo @ 2009-04-21 21:54 ` Chris Wright 2009-04-22 5:41 ` Jens Axboe 0 siblings, 1 reply; 10+ messages in thread From: Chris Wright @ 2009-04-21 21:54 UTC (permalink / raw) To: Tejun Heo Cc: Daniel Collins, Jens Axboe, Andrew Morton, Sam Ravnborg, linux-kernel, stable * Tejun Heo (tj@kernel.org) wrote: > /proc/diskstats used to show stats for all disks whether they're > zero-sized or not and their non-zero partitions. Commit > 074a7aca7afa6f230104e8e65eba3420263714a5 accidentally changed the > behavior such that it doesn't print out zero sized disks. This patch > implements DISK_PITER_INCL_EMPTY_PART0 flag to partition iterator and > uses it in diskstats_show() such that empty part0 is shown in > /proc/diskstats. > > Reported and bisectd by Dianel Collins. > > Signed-off-by: Tejun Heo <tj@kernel.org> > Reported-by: Daniel Collins <solemnwarning@solemnwarning.no-ip.org> looks like this isn't upstream yet. thanks, -chris ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [stable] [PATCH] block: include empty disks in /proc/diskstats 2009-04-21 21:54 ` [stable] " Chris Wright @ 2009-04-22 5:41 ` Jens Axboe 0 siblings, 0 replies; 10+ messages in thread From: Jens Axboe @ 2009-04-22 5:41 UTC (permalink / raw) To: Chris Wright Cc: Tejun Heo, Daniel Collins, Andrew Morton, Sam Ravnborg, linux-kernel, stable On Tue, Apr 21 2009, Chris Wright wrote: > * Tejun Heo (tj@kernel.org) wrote: > > /proc/diskstats used to show stats for all disks whether they're > > zero-sized or not and their non-zero partitions. Commit > > 074a7aca7afa6f230104e8e65eba3420263714a5 accidentally changed the > > behavior such that it doesn't print out zero sized disks. This patch > > implements DISK_PITER_INCL_EMPTY_PART0 flag to partition iterator and > > uses it in diskstats_show() such that empty part0 is shown in > > /proc/diskstats. > > > > Reported and bisectd by Dianel Collins. > > > > Signed-off-by: Tejun Heo <tj@kernel.org> > > Reported-by: Daniel Collins <solemnwarning@solemnwarning.no-ip.org> > > looks like this isn't upstream yet. It'll go upstream today or tomorrow. -- Jens Axboe ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2009-04-22 5:41 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-04-12 1:00 2.6.28 /proc/diskstats Daniel Collins 2009-04-12 1:50 ` Andrew Morton 2009-04-12 18:50 ` Daniel Collins 2009-04-13 1:21 ` Daniel Collins 2009-04-13 6:16 ` Sam Ravnborg 2009-04-14 7:52 ` Tejun Heo 2009-04-14 8:58 ` Tejun Heo 2009-04-14 8:59 ` [PATCH] block: include empty disks in /proc/diskstats Tejun Heo 2009-04-21 21:54 ` [stable] " Chris Wright 2009-04-22 5:41 ` Jens Axboe
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox