1. 29 8月, 2011 20 次提交
  2. 25 8月, 2011 15 次提交
  3. 24 8月, 2011 3 次提交
    • K
      loop: always allow userspace partitions and optionally support automatic scanning · e03c8dd1
      Kay Sievers 提交于
      Automatic partition scanning can be requested individually per loop
      device during its setup by setting LO_FLAGS_PARTSCAN. By default, no
      partition tables are scanned.
      
      Userspace can now always add and remove partitions from all loop
      devices, regardless if the in-kernel partition scanner is enabled or
      not.
      
      The needed partition minor numbers are allocated from the extended
      minors space, the main loop device numbers will continue to match the
      loop minors, regardless of the number of partitions used.
      
        # grep . /sys/class/block/loop1/loop/*
        /sys/block/loop1/loop/autoclear:0
        /sys/block/loop1/loop/backing_file:/home/kay/data/stuff/part.img
        /sys/block/loop1/loop/offset:0
        /sys/block/loop1/loop/partscan:1
        /sys/block/loop1/loop/sizelimit:0
      
        # ls -l /dev/loop*
        brw-rw---- 1 root disk   7,   0 Aug 14 20:22 /dev/loop0
        brw-rw---- 1 root disk   7,   1 Aug 14 20:23 /dev/loop1
        brw-rw---- 1 root disk 259,   0 Aug 14 20:23 /dev/loop1p1
        brw-rw---- 1 root disk 259,   1 Aug 14 20:23 /dev/loop1p2
        brw-rw---- 1 root disk   7,  99 Aug 14 20:23 /dev/loop99
        brw-rw---- 1 root disk 259,   2 Aug 14 20:23 /dev/loop99p1
        brw-rw---- 1 root disk 259,   3 Aug 14 20:23 /dev/loop99p2
        crw------T 1 root root  10, 237 Aug 14 20:22 /dev/loop-control
      
      Cc: Karel Zak  <kzak@redhat.com>
      Cc: Davidlohr Bueso <dave@gnu.org>
      Acked-By: NTejun Heo <tj@kernel.org>
      Signed-off-by: NKay Sievers <kay.sievers@vrfy.org>
      Signed-off-by: NJens Axboe <jaxboe@fusionio.com>
      e03c8dd1
    • J
      Merge branch 'for-3.2/core' into for-3.2/drivers · e8b177ce
      Jens Axboe 提交于
      e8b177ce
    • T
      block: add GENHD_FL_NO_PART_SCAN · d27769ec
      Tejun Heo 提交于
      There are cases where suppressing partition scan is useful - e.g. for
      lo devices and pseudo SATA devices which advertise to be a disk but
      get upset on partition scan (some port multiplier control devices show
      such behavior).
      
      This patch adds GENHD_FL_NO_PART_SCAN which suppresses partition scan
      regardless of the number of possible partitions.  disk_partitionable()
      is renamed to disk_part_scan_enabled() as suppressing partition scan
      doesn't imply the device can't be partitioned using
      BLKPG_ADD/DEL_PARTITION calls from userland.  show_partition() now
      directly tests disk_max_parts() to maintain backward-compatibility.
      
      -v2: Updated to make it clear that only partition scan is suppressed
           not partitioning itself as suggested by Kay Sievers.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Kay Sievers <kay.sievers@vrfy.org>
      Signed-off-by: NJens Axboe <jaxboe@fusionio.com>
      d27769ec
  4. 19 8月, 2011 2 次提交
    • L
      loop: add discard support for loop devices · dfaa2ef6
      Lukas Czerner 提交于
      This commit adds discard support for loop devices. Discard is usually
      supported by SSD and thinly provisioned devices as a method for
      reclaiming unused space. This is no different than trying to reclaim
      back space which is not used by the file system on the image, but it
      still occupies space on the host file system.
      
      We can do the reclamation on file system which does support hole
      punching. So when discard request gets to the loop driver we can
      translate that to punch a hole to the underlying file, hence reclaim
      the free space.
      
      This is very useful for trimming down the size of the image to only what
      is really used by the file system on that image. Fstrim may be used for
      that purpose.
      
      It has been tested on ext4, xfs and btrfs with the image file systems
      ext4, ext3, xfs and btrfs. ext4, or ext6 image on ext4 file system has
      some problems but it seems that ext4 punch hole implementation is
      somewhat flawed and it is unrelated to this commit.
      
      Also this is a very good method of validating file systems punch hole
      implementation.
      
      Note that when encryption is used, discard support is disabled, because
      using it might leak some information useful for possible attacker.
      Signed-off-by: NLukas Czerner <lczerner@redhat.com>
      Reviewed-by: NJeff Moyer <jmoyer@redhat.com>
      Signed-off-by: NJens Axboe <jaxboe@fusionio.com>
      dfaa2ef6
    • A
      nbd-replace-some-printk-with-dev_warn-and-dev_info-checkpatch-fixes · 548ef6cc
      Andrew Morton 提交于
      ERROR: code indent should use tabs where possible
      #30: FILE: drivers/block/nbd.c:578:
      +^I        dev_info(disk_to_dev(lo->disk), "NBD_DISCONNECT\n");$
      
      total: 1 errors, 0 warnings, 35 lines checked
      
      NOTE: whitespace errors detected, you may wish to use scripts/cleanpatch or
            scripts/cleanfile
      
      ./patches/nbd-replace-some-printk-with-dev_warn-and-dev_info.patch has style problems, please review.
      
      If any of these errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.
      
      Please run checkpatch prior to sending patches
      
      Cc: Paul Clements <Paul.Clements@steeleye.com>
      Cc: WANG Cong <amwang@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NJens Axboe <jaxboe@fusionio.com>
      548ef6cc