lkml.org 
[lkml]   [2009]   [Apr]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[patch 79/88] block: include empty disks in /proc/diskstats
    2.6.28-stable review patch.  If anyone has any objections, please let us know.

    ------------------

    From: Tejun Heo <tj@kernel.org>

    commit 71982a409f12c50d011325a4471aa20666bb908d upstream.

    /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>
    Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

    ---
    block/genhd.c | 12 ++++++++----
    include/linux/genhd.h | 1 +
    2 files changed, 9 insertions(+), 4 deletions(-)

    --- a/block/genhd.c
    +++ b/block/genhd.c
    @@ -98,7 +98,7 @@ void disk_part_iter_init(struct disk_par

    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(st
    /* 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(st
    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));
    @@ -980,7 +984,7 @@ static int diskstats_show(struct seq_fil
    "\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);
    --- a/include/linux/genhd.h
    +++ b/include/linux/genhd.h
    @@ -213,6 +213,7 @@ static inline void disk_put_part(struct
    #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;



    \
     
     \ /
      Last update: 2009-04-30 19:47    [W:0.023 / U:30.628 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site