22 May, 2010

1 commit

  • Remove all rcu head inits. We don't care about the RCU head state before passing
    it to call_rcu() anyway. Only leave the "on_stack" variants so debugobjects can
    keep track of objects on stack.

    Signed-off-by: Mathieu Desnoyers
    Signed-off-by: Paul E. McKenney
    Signed-off-by: Jens Axboe

    Paul E. McKenney
     

15 Apr, 2010

1 commit

  • After merging the block tree, 20100414's linux-next build (x86_64
    allmodconfig) failed like this:

    ERROR: "get_gendisk" [block/blk-cgroup.ko] undefined!
    ERROR: "sched_clock" [block/blk-cgroup.ko] undefined!

    This happens because the two symbols aren't exported and hence not available
    when blk-cgroup code is built as a module. I've tried to stay consistent with
    the use of EXPORT_SYMBOL or EXPORT_SYMBOL_GPL with the other symbols in the
    respective files.

    Signed-off-by: Divyesh Shah
    Acked-by: Gui Jianfeng
    Signed-off-by: Jens Axboe

    Divyesh Shah
     

11 Jan, 2010

1 commit


10 Nov, 2009

1 commit

  • While SSDs track block usage on a per-sector basis, RAID arrays often
    have allocation blocks that are bigger. Allow the discard granularity
    and alignment to be set and teach the topology stacking logic how to
    handle them.

    Signed-off-by: Martin K. Petersen
    Signed-off-by: Jens Axboe

    Martin K. Petersen
     

07 Oct, 2009

1 commit

  • Commit a9327cac440be4d8333bba975cbbf76045096275 added seperate read
    and write statistics of in_flight requests. And exported the number
    of read and write requests in progress seperately through sysfs.

    But Corrado Zoccolo reported getting strange
    output from "iostat -kx 2". Global values for service time and
    utilization were garbage. For interval values, utilization was always
    100%, and service time is higher than normal.

    So this was reverted by commit 0f78ab9899e9d6acb09d5465def618704255963b

    The problem was in part_round_stats_single(), I missed the following:
    if (now == part->stamp)
    return;

    - if (part->in_flight) {
    + if (part_in_flight(part)) {
    __part_stat_add(cpu, part, time_in_queue,
    part_in_flight(part) * (now - part->stamp));
    __part_stat_add(cpu, part, io_ticks, (now - part->stamp));

    With this chunk included, the reported regression gets fixed.

    Signed-off-by: Nikanth Karthikesan

    --
    Signed-off-by: Jens Axboe

    Nikanth Karthikesan
     

05 Oct, 2009

1 commit

  • This reverts commit a9327cac440be4d8333bba975cbbf76045096275.

    Corrado Zoccolo reports:

    "with 2.6.32-rc1 I started getting the following strange output from
    "iostat -kx 2":
    Linux 2.6.31bisect (et2) 04/10/2009 _i686_ (2 CPU)

    avg-cpu: %user %nice %system %iowait %steal %idle
    10,70 0,00 3,16 15,75 0,00 70,38

    Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s
    avgrq-sz avgqu-sz await svctm %util
    sda 18,22 0,00 0,67 0,01 14,77 0,02
    43,94 0,01 10,53 39043915,03 2629219,87
    sdb 60,89 9,68 50,79 3,04 1724,43 50,52
    65,95 0,70 13,06 488437,47 2629219,87

    avg-cpu: %user %nice %system %iowait %steal %idle
    2,72 0,00 0,74 0,00 0,00 96,53

    Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s
    avgrq-sz avgqu-sz await svctm %util
    sda 0,00 0,00 0,00 0,00 0,00 0,00
    0,00 0,00 0,00 0,00 100,00
    sdb 0,00 0,00 0,00 0,00 0,00 0,00
    0,00 0,00 0,00 0,00 100,00

    avg-cpu: %user %nice %system %iowait %steal %idle
    6,68 0,00 0,99 0,00 0,00 92,33

    Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s
    avgrq-sz avgqu-sz await svctm %util
    sda 0,00 0,00 0,00 0,00 0,00 0,00
    0,00 0,00 0,00 0,00 100,00
    sdb 0,00 0,00 0,00 0,00 0,00 0,00
    0,00 0,00 0,00 0,00 100,00

    avg-cpu: %user %nice %system %iowait %steal %idle
    4,40 0,00 0,73 1,47 0,00 93,40

    Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s
    avgrq-sz avgqu-sz await svctm %util
    sda 0,00 0,00 0,00 0,00 0,00 0,00
    0,00 0,00 0,00 0,00 100,00
    sdb 0,00 4,00 0,00 3,00 0,00 28,00
    18,67 0,06 19,50 333,33 100,00

    Global values for service time and utilization are garbage. For
    interval values, utilization is always 100%, and service time is
    higher than normal.

    I bisected it down to:
    [a9327cac440be4d8333bba975cbbf76045096275] Seperate read and write
    statistics of in_flight requests
    and verified that reverting just that commit indeed solves the issue
    on 2.6.32-rc1."

    So until this is debugged, revert the bad commit.

    Signed-off-by: Jens Axboe

    Jens Axboe
     

20 Sep, 2009

1 commit

  • This allows subsytems to provide devtmpfs with non-default permissions
    for the device node. Instead of the default mode of 0600, null, zero,
    random, urandom, full, tty, ptmx now have a mode of 0666, which allows
    non-privileged processes to access standard device nodes in case no
    other userspace process applies the expected permissions.

    This also fixes a wrong assignment in pktcdvd and a checkpatch.pl complain.

    Signed-off-by: Kay Sievers
    Signed-off-by: Greg Kroah-Hartman

    Kay Sievers
     

16 Sep, 2009

1 commit


14 Sep, 2009

1 commit

  • Currently, there is a single in_flight counter measuring the number of
    requests in the request_queue. But some monitoring tools would like to
    know how many read requests and write requests are in progress. Split the
    current in_flight counter into two seperate counters for read and write.

    This information is exported as a sysfs attribute, as changing the
    currently available stat files would break the existing tools.

    Signed-off-by: Nikanth Karthikesan
    Signed-off-by: Jens Axboe

    Nikanth Karthikesan
     

11 Sep, 2009

1 commit


16 Jun, 2009

1 commit


23 May, 2009

1 commit

  • To support devices with physical block sizes bigger than 512 bytes we
    need to ensure proper alignment. This patch adds support for exposing
    I/O topology characteristics as devices are stacked.

    logical_block_size is the smallest unit the device can address.

    physical_block_size indicates the smallest I/O the device can write
    without incurring a read-modify-write penalty.

    The io_min parameter is the smallest preferred I/O size reported by
    the device. In many cases this is the same as the physical block
    size. However, the io_min parameter can be scaled up when stacking
    (RAID5 chunk size > physical block size).

    The io_opt characteristic indicates the optimal I/O size reported by
    the device. This is usually the stripe width for arrays.

    The alignment_offset parameter indicates the number of bytes the start
    of the device/partition is offset from the device's natural alignment.
    Partition tools and MD/DM utilities can use this to pad their offsets
    so filesystems start on proper boundaries.

    Signed-off-by: Martin K. Petersen
    Signed-off-by: Jens Axboe

    Martin K. Petersen
     

22 Apr, 2009

1 commit

  • /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
    Reported-by: Daniel Collins
    Signed-off-by: Jens Axboe

    Tejun Heo
     

26 Feb, 2009

1 commit


18 Feb, 2009

1 commit

  • Hi Tejun,

    it looks like your commit:

    block: don't depend on consecutive minor space
    f331c0296f2a9fee0d396a70598b954062603015

    broke a particular case for booting from partitioned md/raid devices.
    That is the second time this has been broken recently. The previous
    time was fixed by

    block: do_mounts - accept root=
    30f2f0eb4bd2c43d10a8b0d872c6e5ad8f31c9a0

    Because the data isn't available when an md device is first created
    (we add disks and set it up after creation), the initial partition
    scan finds nothing. It is not until the device is opened that
    another partition scan happens and finds something.

    So at the point where the kernel parameter "root=/dev/md_d0p1" is
    being parsed, md_d0 exists, but md_d0p1 does not.
    However if we let blk_lookup_devt return the correct device number
    even though the device doesn't exist, then the attempt to mount it
    will successfully find the partition.

    I have tried in the past to find a way to get the partition table to
    be read as soon as the array is assembled but that proved impossible
    (at the time). I don't remember the details, and could possibly
    revisit it. However it would be really nice if blk_lookup_devt
    could be adjusted to again accept non existant partitions.

    Signed-off-by: Jens Axboe

    Neil Brown
     

07 Jan, 2009

1 commit


29 Dec, 2008

1 commit

  • disk_map_sector_rcu() returns a partition from a sector offset,
    which we use for IO statistics on a per-partition basis. The
    lookup itself is an O(N) list lookup, where N is the number of
    partitions. This actually hurts performance quite a bit, even
    on the lower end partitions. On higher numbered partitions,
    it can get pretty bad.

    Solve this by adding a one-hit cache for partition lookup.
    This makes the lookup O(1) for the case where we do most IO to
    one partition. Even for mixed partition workloads, amortized cost
    is pretty close to O(1) since the natural IO batching makes the
    one-hit cache last for lots of IOs.

    Signed-off-by: Jens Axboe

    Jens Axboe
     

03 Dec, 2008

1 commit


18 Nov, 2008

1 commit

  • We run into system boot failure with kernel 2.6.28-rc. We found it on a
    couple of machines, including T61 notebook, nehalem machine, and another
    HPC NX6325 notebook. All the machines use FedoraCore 8 or FedoraCore 9.
    With kernel prior to 2.6.28-rc, system boot doesn't fail.

    I debug it and locate the root cause. Pls. see
    http://bugzilla.kernel.org/show_bug.cgi?id=11899
    https://bugzilla.redhat.com/show_bug.cgi?id=471517

    As a matter of fact, there are 2 bugs.

    1)root=/dev/sda1, system boot randomly fails. Mostly, boot for 5 times
    and fails once. nash has a bug. Some of its functions misuse return
    value 0. Sometimes, 0 means timeout and no uevent available. Sometimes,
    0 means nash gets an uevent, but the uevent isn't block-related (for
    exmaple, usb). If by coincidence, kernel tells nash that uevents are
    available, but kernel also set timeout, nash might stops collecting
    other uevents in queue if current uevent isn't block-related. I work
    out a patch for nash to fix it.
    http://bugzilla.kernel.org/attachment.cgi?id=18858

    2) root=LABEL=/, system always can't boot. initrd init reports
    switchroot fails. Here is an executation branch of nash when booting:
    (1) nash read /sys/block/sda/dev; Assume major is 8 (on my desktop)
    (2) nash query /proc/devices with the major number; It found line
    "8 sd";
    (3) nash use 'sd' to search its own probe table to find device (DISK)
    type for the device and add it to its own list;
    (4) Later on, it probes all devices in its list to get filesystem
    labels; scsi register "8 sd" always.

    When major is 259, nash fails to find the device(DISK) type. I enables
    CONFIG_DEBUG_BLOCK_EXT_DEVT=y when compiling kernel, so 259 is picked up
    for device /dev/sda1, which causes nash to fail to find device (DISK)
    type.

    To fixing issue 2), I create a patch for nash and another patch for
    kernel.

    http://bugzilla.kernel.org/attachment.cgi?id=18859
    http://bugzilla.kernel.org/attachment.cgi?id=18837

    Below is the patch for kernel 2.6.28-rc4. It registers blkext, a new
    block device in proc/devices.

    With 2 patches on nash and 1 patch on kernel, I boot my machines for
    dozens of times without failure.

    Signed-off-by Zhang Yanmin
    Acked-by: Tejun Heo
    Signed-off-by: Jens Axboe

    Zhang, Yanmin
     

23 Oct, 2008

2 commits


17 Oct, 2008

2 commits

  • Fix block kernel-doc warnings:

    Warning(linux-2.6.27-git4//fs/block_dev.c:1272): No description found for parameter 'path'
    Warning(linux-2.6.27-git4//block/blk-core.c:1021): No description found for parameter 'cpu'
    Warning(linux-2.6.27-git4//block/blk-core.c:1021): No description found for parameter 'part'
    Warning(/var/linsrc/linux-2.6.27-git4//block/genhd.c:544): No description found for parameter 'partno'

    Signed-off-by: Randy Dunlap
    Signed-off-by: Jens Axboe

    Randy Dunlap
     
  • No argument 'gfp_mask' for blk_alloc_devt().

    Signed-off-by: Li Zefan
    Signed-off-by: Jens Axboe

    Li Zefan
     

09 Oct, 2008

17 commits

  • Only works for the generic request timer handling. Allows one to
    sporadically ignore request completions, thus exercising the timeout
    handling.

    Signed-off-by: Jens Axboe

    Jens Axboe
     
  • seqf can be started multiple times for a read and the header should be
    printed only for the initial one. Fix it.

    Signed-off-by: Tejun Heo
    Signed-off-by: Jens Axboe

    Tejun Heo
     
  • bdget_disk() and blk_lookup_devt() never cared whether the specified
    partition (or disk) is zero sized or not. I got confused while
    converting those not to depend on consecutive minor numbers in commit
    5a6411b1178baf534aa9138052864dfa89d3eada and later when dev0 was added
    it broke callers which expected to get valid return for zero sized
    disk devices.

    So, they never needed nr_sects checks in the first place. Kill them.

    This problem was spotted and debugged by Bartlmoiej Zolnierkiewicz.

    Signed-off-by: Tejun Heo
    Cc: Bartlomiej Zolnierkiewicz
    Signed-off-by: Jens Axboe

    Tejun Heo
     
  • Noticed by sparse:
    block/blk-softirq.c:156:12: warning: symbol 'blk_softirq_init' was not declared. Should it be static?
    block/genhd.c:583:28: warning: function 'bdget_disk' with external linkage has definition
    block/genhd.c:659:17: warning: incorrect type in argument 1 (different base types)
    block/genhd.c:659:17: expected unsigned int [unsigned] [usertype] size
    block/genhd.c:659:17: got restricted gfp_t
    block/genhd.c:659:29: warning: incorrect type in argument 2 (different base types)
    block/genhd.c:659:29: expected restricted gfp_t [usertype] flags
    block/genhd.c:659:29: got unsigned int
    block: kmalloc args reversed

    Signed-off-by: Harvey Harrison
    Signed-off-by: Jens Axboe

    Harvey Harrison
     
  • Now that disk and partition handlings are mostly unified, it's easy to
    allow disk to have extended device number. This patch makes
    add_disk() use extended device number if disk->minors is zero. Both
    sd and ide-disk are updated to use this.

    * sd_format_disk_name() is implemented which can generically determine
    the drive name. This removes disk number restriction stemming from
    limited device names.

    * If sd index goes over SD_MAX_DISKS (which can be increased now BTW),
    sd simply doesn't initialize minors letting block layer choose
    extended device number.

    * If CONFIG_DEBUG_EXT_DEVT is set, both sd and ide-disk always set
    minors to 0 and use extended device numbers.

    Signed-off-by: Tejun Heo
    Signed-off-by: Jens Axboe

    Tejun Heo
     
  • With previous changes, it's meaningless to limit the number of
    partitions. Replace @ext_minors with GENHD_FL_EXT_DEVT such that
    setting the flag allows the disk to have maximum number of allowed
    partitions (only limited by the number of entries in parsed_partitions
    as determined by MAX_PART constant).

    This kills not-too-pretty alloc_disk_ext[_node]() functions and makes
    @minors parameter to alloc_disk[_node]() unnecessary. The parameter
    is left alone to avoid disturbing the users.

    Signed-off-by: Tejun Heo
    Signed-off-by: Jens Axboe

    Tejun Heo
     
  • disk->__part used to be statically allocated to the maximum possible
    number of partitions. This patch makes partition array allocation
    dynamic. The added overhead is minimal as only real change is one
    memory dereference changed to RCU one. This saves both a bit of
    memory and cpu cycles iterating through unoccupied slots and makes
    increasing partition limit easier.

    Signed-off-by: Tejun Heo
    Signed-off-by: Jens Axboe

    Tejun Heo
     
  • Move stats related fields - stamp, in_flight, dkstats - from disk to
    part0 and unify stat handling such that...

    * part_stat_*() now updates part0 together if the specified partition
    is not part0. ie. part_stat_*() are now essentially all_stat_*().

    * {disk|all}_stat_*() are gone.

    * part_round_stats() is updated similary. It handles part0 stats
    automatically and disk_round_stats() is killed.

    * part_{inc|dec}_in_fligh() is implemented which automatically updates
    part0 stats for parts other than part0.

    * disk_map_sector_rcu() is updated to return part0 if no part matches.
    Combined with the above changes, this makes NULL special case
    handling in callers unnecessary.

    * Separate stats show code paths for disk are collapsed into part
    stats show code paths.

    * Rename disk_stat_lock/unlock() to part_stat_lock/unlock()

    While at it, reposition stat handling macros a bit and add missing
    parentheses around macro parameters.

    Signed-off-by: Tejun Heo
    Signed-off-by: Jens Axboe

    Tejun Heo
     
  • GENHD_FL_FAIL for disk is what make_it_fail is for parts. Kill it and
    use part0->make_it_fail. Sysfs node handling is unified too.

    Signed-off-by: Tejun Heo
    Signed-off-by: Jens Axboe

    Tejun Heo
     
  • Move disk->policy to part0->policy. Implement and use get_disk_ro().

    Signed-off-by: Tejun Heo
    Signed-off-by: Jens Axboe

    Tejun Heo
     
  • Now that capacity and __dev are moved to part0, part0 and others can
    share the same method.

    Signed-off-by: Tejun Heo
    Signed-off-by: Jens Axboe

    Tejun Heo
     
  • Move disk->__dev to part0->__dev. This simplifies bdget_disk() and
    lookup_devt() and allows common sysfs attributes to be unified.
    part_to_disk() is updated to handle part0 -> disk.

    Updated to include a fix from Bartlomiej Zolnierkiewicz ,
    he writes:

    "part0 is a "special" partition and doesn't need to have capacity set - this
    fixes regression caused by "block: move __dev from disk to part0" commit."

    Signed-off-by: Tejun Heo
    Signed-off-by: Jens Axboe

    Tejun Heo
     
  • genhd and partition code handled disk and partitions separately. All
    information about the whole disk was in struct genhd and partitions in
    struct hd_struct. However, the whole disk (part0) and other
    partitions have a lot in common and the data structures end up having
    good number of common fields and thus separate code paths doing the
    same thing. Also, the partition array was indexed by partno - 1 which
    gets pretty confusing at times.

    This patch introduces partition 0 and makes the partition array
    indexed by partno. Following patches will unify the handling of disk
    and parts piece-by-piece.

    This patch also implements disk_partitionable() which tests whether a
    disk is partitionable. With coming dynamic partition array change,
    the most common usage of disk_max_parts() will be testing whether a
    disk is partitionable and the number of max partitions will become
    much less important.

    Signed-off-by: Tejun Heo
    Signed-off-by: Jens Axboe

    Tejun Heo
     
  • Implement {disk|part}_to_dev() and use them to access generic device
    instead of directly dereferencing {disk|part}->dev. To make sure no
    user is left behind, rename generic devices fields to __dev.

    This is in preparation of unifying partition 0 handling with other
    partitions.

    Signed-off-by: Tejun Heo
    Signed-off-by: Jens Axboe

    Tejun Heo
     
  • Extended devt introduces non-contiguos device numbers. This patch
    implements a debug option which forces most devt allocations to be
    from the extended area and spreads them out. This is enabled by
    default if DEBUG_KERNEL is set and achieves...

    1. Detects code paths in kernel or userland which expect predetermined
    consecutive device numbers.

    2. When something goes wrong, avoid corruption as adding to the minor
    of earlier partition won't lead to the wrong but valid device.

    Signed-off-by: Tejun Heo
    Signed-off-by: Jens Axboe

    Tejun Heo
     
  • With extended minors and the soon-to-follow debug feature, large minor
    numbers for block devices will be common. This patch does the
    followings to make printouts pretty.

    * Adapt print formats such that large minors don't break the
    formatting.

    * For extended MAJ:MIN, %02x%02x for MAJ:MIN used in
    printk_all_partitions() doesn't cut it anymore. Update it such that
    %03x:%05x is used if either MAJ or MIN doesn't fit in %02x.

    * Implement ext_range sysfs attribute which shows total minors the
    device can use including both conventional minor space and the
    extended one.

    Signed-off-by: Tejun Heo
    Signed-off-by: Jens Axboe

    Tejun Heo
     
  • Implement extended device numbers. A block driver can tell block
    layer that it wants to use extended device numbers. After the usual
    minor space is used up, block layer automatically allocates devt's
    from EXT_BLOCK_MAJOR.

    Currently only one major number is allocated for this but as the
    allocation is strictly on-demand, ~1mil minor space under it should
    suffice unless the system actually has more than ~1mil partitions and
    if that ever happens adding more majors to the extended devt area is
    easy.

    Due to internal implementation issues, the first partition can't be
    allocated on the extended area. In other words, genhd->minors should
    at least be 1. This limitation will be lifted by later changes.

    Signed-off-by: Tejun Heo
    Signed-off-by: Jens Axboe

    Tejun Heo