1. 23 Nov, 2009 2 commits
    • Karel Zak's avatar
      partitions: read whole sector with EFI GPT header · 87038c2d
      Karel Zak authored
      
      The size of EFI GPT header is not static, but whole sector is
      allocated for the header. The HeaderSize field must be greater
      than 92 (= sizeof(struct gpt_header) and must be less than or
      equal to the logical block size.
      
      It means we have to read whole sector with the header, because the
      header crc32 checksum is calculated according to HeaderSize.
      
      For more details see UEFI standard (version 2.3, May 2009):
        - 5.3.1 GUID Format overview, page 93
        - Table 13. GUID Partition Table Header, page 96
      Signed-off-by: default avatarKarel Zak <kzak@redhat.com>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      87038c2d
    • Karel Zak's avatar
      partitions: use sector size for EFI GPT · 7d13af32
      Karel Zak authored
      
      Currently, kernel uses strictly 512-byte sectors for EFI GPT parsing.
      That's wrong.
      
      UEFI standard (version 2.3, May 2009, 5.3.1 GUID Format overview, page
      95) defines that LBA is always based on the logical block size. It
      means bdev_logical_block_size() (aka BLKSSZGET) for Linux.
      
      This patch removes static sector size from EFI GPT parser.
      
      The problem is reproducible with the latest GNU Parted:
      
       # modprobe scsi_debug dev_size_mb=50 sector_size=4096
      
        # ./parted /dev/sdb print
        Model: Linux scsi_debug (scsi)
        Disk /dev/sdb: 52.4MB
        Sector size (logical/physical): 4096B/4096B
        Partition Table: gpt
      
        Number  Start   End     Size    File system  Name     Flags
         1      24.6kB  3002kB  2978kB               primary
         2      3002kB  6001kB  2998kB               primary
         3      6001kB  9003kB  3002kB               primary
      
        # blockdev --rereadpt /dev/sdb
        # dmesg | tail -1
         sdb: unknown partition table      <---- !!!
      
      with this patch:
      
        # blockdev --rereadpt /dev/sdb
        # dmesg | tail -1
         sdb: sdb1 sdb2 sdb3
      Signed-off-by: default avatarKarel Zak <kzak@redhat.com>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      7d13af32
  2. 10 Nov, 2009 1 commit
  3. 06 Oct, 2009 1 commit
    • Nikanth Karthikesan's avatar
      block: Seperate read and write statistics of in_flight requests v2 · 316d315b
      Nikanth Karthikesan authored
      Commit a9327cac 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 <czoccolo@gmail.com> 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 0f78ab98
      
      
      
      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: default avatarNikanth Karthikesan <knikanth@suse.de>
      
      --
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      316d315b
  4. 04 Oct, 2009 1 commit
    • Jens Axboe's avatar
      Revert "Seperate read and write statistics of in_flight requests" · 0f78ab98
      Jens Axboe authored
      This reverts commit a9327cac.
      
      Corrado Zoccolo <czoccolo@gmail.com> 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:
      [a9327cac
      
      ] 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: default avatarJens Axboe <jens.axboe@oracle.com>
      0f78ab98
  5. 22 Sep, 2009 1 commit
  6. 15 Sep, 2009 1 commit
  7. 14 Sep, 2009 1 commit
  8. 12 Jul, 2009 1 commit
  9. 07 Jun, 2009 2 commits
  10. 22 May, 2009 2 commits
    • Martin K. Petersen's avatar
      block: Export I/O topology for block devices and partitions · c72758f3
      Martin K. Petersen authored
      
      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: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      c72758f3
    • Martin K. Petersen's avatar
      block: Do away with the notion of hardsect_size · e1defc4f
      Martin K. Petersen authored
      
      Until now we have had a 1:1 mapping between storage device physical
      block size and the logical block sized used when addressing the device.
      With SATA 4KB drives coming out that will no longer be the case.  The
      sector size will be 4KB but the logical block size will remain
      512-bytes.  Hence we need to distinguish between the physical block size
      and the logical ditto.
      
      This patch renames hardsect_size to logical_block_size.
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      e1defc4f
  11. 26 Mar, 2009 1 commit
  12. 24 Mar, 2009 1 commit
    • Ming Lei's avatar
      Driver core: implement uevent suppress in kobject · f67f129e
      Ming Lei authored
      
      This patch implements uevent suppress in kobject and removes it
      from struct device, based on the following ideas:
      
      1,Uevent sending should be one attribute of kobject, so suppressing it
      in kobject layer is more natural than in device layer. By this way,
      we can do it for other objects embedded with kobject.
      
      2,It may save several bytes for each instance of struct device.(On my
      omap3(32bit ARM) based box, can save 8bytes per device object)
      
      This patch also introduces dev_set|get_uevent_suppress() helpers to
      set and query uevent_suppress attribute in case to help kobject
      as private part of struct device in future.
      
      [This version is against the latest driver-core patch set of Greg,please
      ignore the last version.]
      Signed-off-by: default avatarMing Lei <tom.leiming@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      f67f129e
  13. 26 Jan, 2009 2 commits
    • Arnaldo Carvalho de Melo's avatar
      tracing/blktrace: fix up checkpatch reported problems in ftrace plugin patch · 157f9c00
      Arnaldo Carvalho de Melo authored
      
      Also make sure sparse (make C=2 block/blktrace.o) is happy too.
      Reported-by: default avatarIngo Molnar <mingo@elte.hu>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      157f9c00
    • Arnaldo Carvalho de Melo's avatar
      blktrace: add ftrace plugin · c71a8961
      Arnaldo Carvalho de Melo authored
      
      Impact: New way of using the blktrace infrastructure
      
      This drops the requirement of userspace utilities to use the blktrace
      facility.
      
      Configuration is done thru sysfs, adding a "trace" directory to the
      partition directory where blktrace can be enabled for the associated
      request_queue.
      
      The same filters present in the IOCTL interface are present as sysfs
      device attributes.
      
      The /sys/block/sdX/sdXN/trace/enable file allows tracing without any
      filters.
      
      The other files in this directory: pid, act_mask, start_lba and end_lba
      can be used with the same meaning as with the IOCTL interface.
      
      Using the sysfs interface will only setup the request_queue->blk_trace
      fields, tracing will only take place when the "blk" tracer is selected
      via the ftrace interface, as in the following example:
      
      To see the trace, one can use the /d/tracing/trace file or the
      /d/tracign/trace_pipe file, with semantics defined in the ftrace
      documentation in Documentation/ftrace.txt.
      
      [root@f10-1 ~]# cat /t/trace
             kjournald-305   [000]  3046.491224:   8,1    A WBS 6367 + 8 <- (8,1) 6304
             kjournald-305   [000]  3046.491227:   8,1    Q   R 6367 + 8 [kjournald]
             kjournald-305   [000]  3046.491236:   8,1    G  RB 6367 + 8 [kjournald]
             kjournald-305   [000]  3046.491239:   8,1    P  NS [kjournald]
             kjournald-305   [000]  3046.491242:   8,1    I RBS 6367 + 8 [kjournald]
             kjournald-305   [000]  3046.491251:   8,1    D  WB 6367 + 8 [kjournald]
             kjournald-305   [000]  3046.491610:   8,1    U  WS [kjournald] 1
                <idle>-0     [000]  3046.511914:   8,1    C  RS 6367 + 8 [6367]
      [root@f10-1 ~]#
      
      The default line context (prefix) format is the one described in the ftrace
      documentation, with the blktrace specific bits using its existing format,
      described in blkparse(8).
      
      If one wants to have the classic blktrace formatting, this is possible by
      using:
      
      [root@f10-1 ~]# echo blk_classic > /t/trace_options
      [root@f10-1 ~]# cat /t/trace
        8,1    0  3046.491224   305  A WBS 6367 + 8 <- (8,1) 6304
        8,1    0  3046.491227   305  Q   R 6367 + 8 [kjournald]
        8,1    0  3046.491236   305  G  RB 6367 + 8 [kjournald]
        8,1    0  3046.491239   305  P  NS [kjournald]
        8,1    0  3046.491242   305  I RBS 6367 + 8 [kjournald]
        8,1    0  3046.491251   305  D  WB 6367 + 8 [kjournald]
        8,1    0  3046.491610   305  U  WS [kjournald] 1
        8,1    0  3046.511914     0  C  RS 6367 + 8 [6367]
      [root@f10-1 ~]#
      
      Using the ftrace standard format allows more flexibility, such
      as the ability of asking for backtraces via trace_options:
      
      [root@f10-1 ~]# echo noblk_classic > /t/trace_options
      [root@f10-1 ~]# echo stacktrace > /t/trace_options
      
      [root@f10-1 ~]# cat /t/trace
             kjournald-305   [000]  3318.826779:   8,1    A WBS 6375 + 8 <- (8,1) 6312
             kjournald-305   [000]  3318.826782:
       <= submit_bio
       <= submit_bh
       <= sync_dirty_buffer
       <= journal_commit_transaction
       <= kjournald
       <= kthread
       <= child_rip
             kjournald-305   [000]  3318.826836:   8,1    Q   R 6375 + 8 [kjournald]
             kjournald-305   [000]  3318.826837:
       <= generic_make_request
       <= submit_bio
       <= submit_bh
       <= sync_dirty_buffer
       <= journal_commit_transaction
       <= kjournald
       <= kthread
      
      Please read the ftrace documentation to use aditional, standardized
      tracing filters such as /d/tracing/trace_cpumask, etc.
      
      See also /d/tracing/trace_mark to add comments in the trace stream,
      that is equivalent to the /d/block/sdaN/msg interface.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      c71a8961
  14. 09 Jan, 2009 1 commit
    • Neil Brown's avatar
      block: fix bug in ptbl lookup cache · 54b0d127
      Neil Brown authored
      Neil writes:
      
         Hi Jens,
      
          I've found a little bug for you.  It was introduced by
              a6f23657
      
      
      
              block: add one-hit cache for disk partition lookup
      
          and has the effect of killing my machine whenever I try to assemble
          an md array :-(
          One of the devices in the array has partitions, and mdadm always
          deletes partitions before putting a whole-device in an array (as it
          can cause confusion).  The next IO to that device locks the machine.
          I don't really understand exactly why it locks up, but it happens in
          disk_map_sector_rcu().  This patch fixes it.
      
      Which is due to a missing clear of the (now) stale partition lookup
      data. So clear that when we delete a partition.
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      54b0d127
  15. 06 Jan, 2009 1 commit
  16. 18 Nov, 2008 3 commits
  17. 21 Oct, 2008 2 commits
  18. 17 Oct, 2008 1 commit
    • Tejun Heo's avatar
      block: add partition attribute for partition number · 0fc71e3d
      Tejun Heo authored
      
      With extended devt, finding out the partition number becomes a bit
      more challenging as subtracting the minor number from that of the
      parent device doesn't work anymore.  The only thing left is parsing
      the partition name which is brittle and not exactly universal (some
      have '-' between the device name and partition number while others
      don't).  This patch introduced partition attribute which contains the
      partition number of the device.  This should make finding partitions
      and its index easier.
      
      This problem and solution were suggested by H. Peter Anvin.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      0fc71e3d
  19. 16 Oct, 2008 2 commits
    • Kay Sievers's avatar
      block: sanitize invalid partition table entries · ac0d86f5
      Kay Sievers authored
      
      We currently follow blindly what the partition table lies about the
      disk, and let the kernel create block devices which can not be accessed.
      Trying to identify the device leads to kernel logs full of:
        sdb: rw=0, want=73392, limit=28800
        attempt to access beyond end of device
      
      Here is an example of a broken partition table, where sda2 starts
      behind the end of the disk, and sdb3 is larger than the entire disk:
        Disk /dev/sdb: 14 MB, 14745600 bytes
        1 heads, 29 sectors/track, 993 cylinders, total 28800 sectors
           Device Boot      Start         End      Blocks   Id  System
        /dev/sdb1              29        7800        3886   83  Linux
        /dev/sdb2           37801       45601        3900+  83  Linux
        /dev/sdb3           15602       73402       28900+  83  Linux
        /dev/sdb4           23403       28796        2697   83  Linux
      
      The kernel creates these completely invalid devices, which can not be
      accessed, or may lead to other unpredictable failures:
        grep . /sys/class/block/sdb*/{start,size}
        /sys/class/block/sdb/size:28800
        /sys/class/block/sdb1/start:29
        /sys/class/block/sdb1/size:7772
        /sys/class/block/sdb2/start:37801
        /sys/class/block/sdb2/size:7801
        /sys/class/block/sdb3/start:15602
        /sys/class/block/sdb3/size:57801
        /sys/class/block/sdb4/start:23403
        /sys/class/block/sdb4/size:5394
      
      With this patch, we ignore partitions which start behind the end of the disk,
      and limit partitions to the end of the disk if they pretend to be larger:
        grep . /sys/class/block/sdb*/{start,size}
        /sys/class/block/sdb/size:28800
        /sys/class/block/sdb1/start:29
        /sys/class/block/sdb1/size:7772
        /sys/class/block/sdb3/start:15602
        /sys/class/block/sdb3/size:13198
        /sys/class/block/sdb4/start:23403
        /sys/class/block/sdb4/size:5394
      
      These warnings are printed to the kernel log:
        sdb: p2 ignored, start 37801 is behind the end of the disk
        sdb: p3 size 57801 limited to end of disk
      Signed-off-by: default avatarKay Sievers <kay.sievers@vrfy.org>
      Cc: Herton Ronaldo Krzesinski <herton@mandriva.com.br>
      Cc: Jens Axboe <jens.axboe@oracle.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ac0d86f5
    • Adrian Bunk's avatar
      fs/partitions/acorn.c: remove dead code · 6722e45c
      Adrian Bunk authored
      
      I missed this when I did the arm26 removal.
      Reported-by: default avatarRobert P. J. Day <rpjday@crashcourse.ca>
      Signed-off-by: default avatarAdrian Bunk <bunk@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      6722e45c
  20. 09 Oct, 2008 13 commits
    • Andrew Patterson's avatar
      Check for device resize when rescanning partitions · 9bc3ffbf
      Andrew Patterson authored
      
      Check for device resize in the rescan_partitions() routine. If the device
      has been resized, the bdev size is set to match. The rescan_partitions()
      routine is called when opening the device and when calling the
      BLKRRPART ioctl.
      Signed-off-by: default avatarAndrew Patterson <andrew.patterson@hp.com>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      9bc3ffbf
    • Tejun Heo's avatar
      block: allow disk to have extended device number · 3e1a7ff8
      Tejun Heo authored
      
      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: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      3e1a7ff8
    • Tejun Heo's avatar
      block: replace @ext_minors with GENHD_FL_EXT_DEVT · 689d6fac
      Tejun Heo authored
      
      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: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      689d6fac
    • Tejun Heo's avatar
      block: make partition array dynamic · 540eed56
      Tejun Heo authored
      
      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: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      540eed56
    • Tejun Heo's avatar
      block: move stats from disk to part0 · 074a7aca
      Tejun Heo authored
      
      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: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      074a7aca
    • Tejun Heo's avatar
      block: kill GENHD_FL_FAIL and use part0->make_it_fail · eddb2e26
      Tejun Heo authored
      
      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: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      eddb2e26
    • Tejun Heo's avatar
      block: always set bdev->bd_part · 0762b8bd
      Tejun Heo authored
      
      Till now, bdev->bd_part is set only if the bdev was for parts other
      than part0.  This patch makes bdev->bd_part always set so that code
      paths don't have to differenciate common handling.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      0762b8bd
    • Tejun Heo's avatar
      block: move holder_dir from disk to part0 · 4c46501d
      Tejun Heo authored
      
      Move disk->holder_dir to part0->holder_dir.  Kill now mostly
      superflous bdev_get_holder().
      
      While at it, kill superflous kobject_get/put() around holder_dir,
      slave_dir and cmd_filter creation and collapse
      disk_sysfs_add_subdirs() into register_disk().  These serve no purpose
      but obfuscating the code.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      4c46501d
    • Tejun Heo's avatar
      block: move policy from disk to part0 · b7db9956
      Tejun Heo authored
      
      Move disk->policy to part0->policy.  Implement and use get_disk_ro().
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      b7db9956
    • Tejun Heo's avatar
      block: unify sysfs size node handling · e5610521
      Tejun Heo authored
      
      Now that capacity and __dev are moved to part0, part0 and others can
      share the same method.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      e5610521
    • Tejun Heo's avatar
      block: move capacity from disk to part0 · 80795aef
      Tejun Heo authored
      
      Move disk->capacity to part0->nr_sects and convert all users who
      directly accessed the field to use {get|set}_capacity().  This is done
      early to allow the __dev field to be moved.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      80795aef
    • Tejun Heo's avatar
      block: introduce partition 0 · b5d0b9df
      Tejun Heo authored
      
      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: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      b5d0b9df
    • Tejun Heo's avatar
      block: implement and use {disk|part}_to_dev() · ed9e1982
      Tejun Heo authored
      
      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: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      ed9e1982