29 Mar, 2012

9 commits

  • Add dm thin target arguments to control discard support.

    ignore_discard: Disables discard support

    no_discard_passdown: Don't pass discards down to the underlying data
    device, but just remove the mapping within the thin provisioning target.

    Signed-off-by: Joe Thornber
    Signed-off-by: Mike Snitzer
    Signed-off-by: Alasdair G Kergon

    Joe Thornber
     
  • Support discards in the thin target.

    On discard the corresponding mapping(s) are removed from the thin
    device. If the associated block(s) are no longer shared the discard
    is passed to the underlying device.

    All bios other than discards now have an associated deferred_entry
    that is saved to the 'all_io_entry' in endio_hook. When non-discard
    IO completes and associated mappings are quiesced any discards that
    were deferred, via ds_add_work() in process_discard(), will be queued
    for processing by the worker thread.

    Signed-off-by: Joe Thornber
    Signed-off-by: Mike Snitzer
    Signed-off-by: Alasdair G Kergon

    drivers/md/dm-thin.c | 173 ++++++++++++++++++++++++++++++++++++++++++++++----
    drivers/md/dm-thin.c | 172 ++++++++++++++++++++++++++++++++++++++++++++++-----
    1 file changed, 158 insertions(+), 14 deletions(-)

    Joe Thornber
     
  • This patch contains the ground work needed for dm-thin to support discard.

    - Adds endio function that replaces shared_read_endio.

    - Introduce an explicit 'quiesced' flag into the new_mapping structure.
    Before, this was implicitly indicated by m->list being empty.

    - The map_info->ptr remains constant for the duration of a bio's trip
    through the thin target. Make it easier to reason about it.

    Signed-off-by: Joe Thornber
    Signed-off-by: Mike Snitzer
    Signed-off-by: Alasdair G Kergon

    Joe Thornber
     
  • Use dm_target_offset wrapper instead of referencing the awkward ti->begin
    explicitly.

    Signed-off-by: Alasdair G Kergon

    Alasdair G Kergon
     
  • Support the use of an external _read only_ device as an origin for a thin
    device.

    Any read to an unprovisioned area of the thin device will be passed
    through to the origin. Writes trigger allocation of new blocks as
    usual.

    One possible use case for this would be VM hosts that want to run
    guests on thinly-provisioned volumes but have the base image on another
    device (possibly shared between many VMs).

    Signed-off-by: Joe Thornber
    Signed-off-by: Mike Snitzer
    Signed-off-by: Alasdair G Kergon

    Joe Thornber
     
  • The thin metadata format can only make use of a device that is = 1 GB, physical extents).

    Rather than reject a larger metadata device, during thin-pool device
    construction, switch to allowing it but issue a warning if a device
    larger than THIN_METADATA_MAX_SECTORS_WARNING (16 GB) is
    provided. Any space over 15.9375 GB will not be used.

    Signed-off-by: Mike Snitzer
    Signed-off-by: Alasdair G Kergon

    Mike Snitzer
     
  • Commit unwritten data every second to prevent too much building up.

    Released blocks don't become available until after the next commit
    (for crash resilience). Prior to this patch commits were only
    triggered by a message to the target or a REQ_{FLUSH,FUA} bio. This
    allowed far too big a position to build up.

    The interval is hard-coded to 1 second. This is a sensible setting.
    I'm not making this user configurable, since there isn't much to be
    gained by tweaking this - and a lot lost by setting it far too high.

    Signed-off-by: Joe Thornber
    Signed-off-by: Mike Snitzer
    Signed-off-by: Alasdair G Kergon

    Joe Thornber
     
  • Remove documentation for unimplemented 'trim' message.

    I'd planned a 'trim' target message for shrinking thin devices, but
    this is better handled via the discard ioctl.

    Signed-off-by: Joe Thornber
    Signed-off-by: Mike Snitzer
    Signed-off-by: Alasdair G Kergon

    Joe Thornber
     
  • Avoid using the bi_next field for the holder of a cell when deferring
    bios because a stacked device below might change it. Store the
    holder in a new field in struct cell instead.

    When a cell is created, the bio that triggered creation (the holder) was
    added to the same bio list as subsequent bios. In some cases we pass
    this holder bio directly to devices underneath. If those devices use
    the bi_next field there will be trouble...

    This also simplifies some code that had to work out which bio was the
    holder.

    Signed-off-by: Joe Thornber
    Cc: stable@kernel.org
    Signed-off-by: Mike Snitzer
    Signed-off-by: Alasdair G Kergon

    Joe Thornber
     

01 Nov, 2011

1 commit

  • Initial EXPERIMENTAL implementation of device-mapper thin provisioning
    with snapshot support. The 'thin' target is used to create instances of
    the virtual devices that are hosted in the 'thin-pool' target. The
    thin-pool target provides data sharing among devices. This sharing is
    made possible using the persistent-data library in the previous patch.

    The main highlight of this implementation, compared to the previous
    implementation of snapshots, is that it allows many virtual devices to
    be stored on the same data volume, simplifying administration and
    allowing sharing of data between volumes (thus reducing disk usage).

    Another big feature is support for arbitrary depth of recursive
    snapshots (snapshots of snapshots of snapshots ...). The previous
    implementation of snapshots did this by chaining together lookup tables,
    and so performance was O(depth). This new implementation uses a single
    data structure so we don't get this degradation with depth.

    For further information and examples of how to use this, please read
    Documentation/device-mapper/thin-provisioning.txt

    Signed-off-by: Joe Thornber
    Signed-off-by: Mike Snitzer
    Signed-off-by: Alasdair G Kergon

    Joe Thornber