22 Dec, 2012

4 commits

  • This patch removes map_info from bio-based device mapper targets.
    map_info is still used for request-based targets.

    Signed-off-by: Mikulas Patocka
    Signed-off-by: Alasdair G Kergon

    Mikulas Patocka
     
  • This patch moves target_request_nr from map_info to dm_target_io and
    makes it accessible with dm_bio_get_target_request_nr.

    This patch is a preparation for the next patch that removes map_info.

    Signed-off-by: Mikulas Patocka
    Signed-off-by: Alasdair G Kergon

    Mikulas Patocka
     
  • Introduce a field per_bio_data_size in struct dm_target.

    Targets can set this field in the constructor. If a target sets this
    field to a non-zero value, "per_bio_data_size" bytes of auxiliary data
    are allocated for each bio submitted to the target. These data can be
    used for any purpose by the target and help us improve performance by
    removing some per-target mempools.

    Per-bio data is accessed with dm_per_bio_data. The
    argument data_size must be the same as the value per_bio_data_size in
    dm_target.

    If the target has a pointer to per_bio_data, it can get a pointer to
    the bio with dm_bio_from_per_bio_data() function (data_size must be the
    same as the value passed to dm_per_bio_data).

    Signed-off-by: Mikulas Patocka
    Signed-off-by: Alasdair G Kergon

    Mikulas Patocka
     
  • Allow targets to opt in to WRITE SAME support by setting
    'num_write_same_requests' in the dm_target structure.

    A dm device will only advertise WRITE SAME support if all its
    targets and all its underlying devices support it.

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

    Mike Snitzer
     

27 Jul, 2012

6 commits

  • Commit outstanding metadata before returning the status for a dm thin
    pool so that the numbers reported are as up-to-date as possible.

    The commit is not performed if the device is suspended or if
    the DM_NOFLUSH_FLAG is supplied by userspace and passed to the target
    through a new 'status_flags' parameter in the target's dm_status_fn.

    The userspace dmsetup tool will support the --noflush flag with the
    'dmsetup status' and 'dmsetup wait' commands from version 1.02.76
    onwards.

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

    Alasdair G Kergon
     
  • Use boolean bit fields for flags in struct dm_target.

    Signed-off-by: Alasdair G Kergon

    Alasdair G Kergon
     
  • Allow targets to override the 'supports flush' calculation.

    Set 'flush_supported' if a target needs to receive flushes regardless of
    whether or not its underlying devices have support.

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

    Joe Thornber
     
  • This patch introduces a new variable split_discard_requests. It can be
    set by targets so that discard requests are split on max_io_len
    boundaries.

    When split_discard_requests is not set, discard requests are only split on
    boundaries between targets, as was the case before this patch.

    Signed-off-by: Mikulas Patocka
    Signed-off-by: Alasdair G Kergon

    Mikulas Patocka
     
  • Remove the restriction that limits a target's specified maximum incoming
    I/O size to be a power of 2.

    Rename this setting from 'split_io' to the less-ambiguous 'max_io_len'.
    Change it from sector_t to uint32_t, which is plenty big enough, and
    introduce a wrapper function dm_set_target_max_io_len() to set it.
    Use sector_div() to process it now that it is not necessarily a power of 2.

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

    Mike Snitzer
     
  • Remove unused dm_flush_fn .flush target method from header.

    This was left-over from the FLUSH/FUA conversion and is no longer used.

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

    Joe Thornber
     

01 Nov, 2011

4 commits

  • Introduce DM_TARGET_IMMUTABLE to indicate that the target type cannot be mixed
    with any other target type, and once loaded into a device, it cannot be
    replaced with a table containing a different type.

    The thin provisioning pool device will use this.

    Signed-off-by: Alasdair G Kergon

    Alasdair G Kergon
     
  • Add a target feature flag DM_TARGET_ALWAYS_WRITEABLE to indicate that a target
    does not support read-only mode.

    The initial implementation of the thin provisioning target uses this.

    Signed-off-by: Alasdair G Kergon

    Alasdair G Kergon
     
  • Introduce the concept of a singleton table which contains exactly one target.

    If a target type sets the DM_TARGET_SINGLETON feature bit device-mapper
    will ensure that any table that includes that target contains no others.

    The thin provisioning pool target uses this.

    Signed-off-by: Alasdair G Kergon

    Alasdair G Kergon
     
  • printk_ratelimit() shares global ratelimiting state with all
    other subsystems, so its usage is discouraged. Instead,
    define and use dm's local state.

    Signed-off-by: Namhyung Kim
    Signed-off-by: Alasdair G Kergon

    Namhyung Kim
     

26 Sep, 2011

1 commit

  • If optional discard support in dm-crypt is enabled, discards requests
    bypass the crypt queue and blocks of the underlying device are discarded.
    For the read path, discarded blocks are handled the same as normal
    ciphertext blocks, thus decrypted.

    So if the underlying device announces discarded regions return zeroes,
    dm-crypt must disable this flag because after decryption there is just
    random noise instead of zeroes.

    Signed-off-by: Milan Broz
    Signed-off-by: Alasdair G Kergon

    Milan Broz
     

02 Aug, 2011

1 commit


29 May, 2011

1 commit


18 Apr, 2011

1 commit


10 Mar, 2011

1 commit

  • Code has been converted over to the new explicit on-stack plugging,
    and delay users have been converted to use the new API for that.
    So lets kill off the old plugging along with aops->sync_page().

    Signed-off-by: Jens Axboe

    Jens Axboe
     

14 Jan, 2011

2 commits

  • Add per-target unplug callback support.

    Cc: linux-raid@vger.kernel.org
    Signed-off-by: NeilBrown
    Signed-off-by: Jonathan Brassow
    Signed-off-by: Mike Snitzer
    Signed-off-by: Alasdair G Kergon

    NeilBrown
     
  • DM currently implements congestion checking by checking on congestion
    in each component device. For raid456 we need to also check if the
    stripe cache is congested.

    Add per-target congestion checker callback support.

    Extending the target_callbacks structure with additional callback
    functions allows for establishing multiple callbacks per-target (a
    callback is also needed for unplug).

    Cc: linux-raid@vger.kernel.org
    Signed-off-by: NeilBrown
    Signed-off-by: Jonathan Brassow
    Signed-off-by: Mike Snitzer
    Signed-off-by: Alasdair G Kergon

    NeilBrown
     

12 Aug, 2010

3 commits

  • Split max_io_len_target_boundary out of max_io_len so that the discard
    support can make use of it without duplicating max_io_len code.

    Avoiding max_io_len's split_io logic enables DM's discard support to
    submit the entire discard request to a target. But discards must still
    be split on target boundaries.

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

    Mike Snitzer
     
  • Allow discards to be passed through to linear mappings if at least one
    underlying device supports it. Discards will be forwarded only to
    devices that support them.

    A target that supports discards should set num_discard_requests to
    indicate how many times each discard request must be submitted to it.

    Verify table's underlying devices support discards prior to setting the
    associated DM device as capable of discards (via QUEUE_FLAG_DISCARD).

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

    Mike Snitzer
     
  • 'target_request_nr' is a more generic name that reflects the fact that
    it will be used for both flush and discard support.

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

    Mike Snitzer
     

06 Mar, 2010

1 commit


11 Dec, 2009

4 commits


05 Sep, 2009

1 commit

  • Set sensible I/O hints for striped DM devices in the topology
    infrastructure added for 2.6.31 for userspace tools to
    obtain via sysfs.

    Add .io_hints to 'struct target_type' to allow the I/O hints portion
    (io_min and io_opt) of the 'struct queue_limits' to be set by each
    target and implement this for dm-stripe.

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

    Mike Snitzer
     

24 Jul, 2009

1 commit

  • Incorrect device area lengths are being passed to device_area_is_valid().

    The regression appeared in 2.6.31-rc1 through commit
    754c5fc7ebb417b23601a6222a6005cc2e7f2913.

    With the dm-stripe target, the size of the target (ti->len) was used
    instead of the stripe_width (ti->len/#stripes). An example of a
    consequent incorrect error message is:

    device-mapper: table: 254:0: sdb too small for target

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

    Mike Snitzer
     

22 Jun, 2009

5 commits

  • This patch adds core functions for request-based dm.

    When struct mapped device (md) is initialized, md->queue has
    an I/O scheduler and the following functions are used for
    request-based dm as the queue functions:
    make_request_fn: dm_make_request()
    pref_fn: dm_prep_fn()
    request_fn: dm_request_fn()
    softirq_done_fn: dm_softirq_done()
    lld_busy_fn: dm_lld_busy()
    Actual initializations are done in another patch (PATCH 2).

    Below is a brief summary of how request-based dm behaves, including:
    - making request from bio
    - cloning, mapping and dispatching request
    - completing request and bio
    - suspending md
    - resuming md

    bio to request
    ==============
    md->queue->make_request_fn() (dm_make_request()) calls __make_request()
    for a bio submitted to the md.
    Then, the bio is kept in the queue as a new request or merged into
    another request in the queue if possible.

    Cloning and Mapping
    ===================
    Cloning and mapping are done in md->queue->request_fn() (dm_request_fn()),
    when requests are dispatched after they are sorted by the I/O scheduler.

    dm_request_fn() checks busy state of underlying devices using
    target's busy() function and stops dispatching requests to keep them
    on the dm device's queue if busy.
    It helps better I/O merging, since no merge is done for a request
    once it is dispatched to underlying devices.

    Actual cloning and mapping are done in dm_prep_fn() and map_request()
    called from dm_request_fn().
    dm_prep_fn() clones not only request but also bios of the request
    so that dm can hold bio completion in error cases and prevent
    the bio submitter from noticing the error.
    (See the "Completion" section below for details.)

    After the cloning, the clone is mapped by target's map_rq() function
    and inserted to underlying device's queue using
    blk_insert_cloned_request().

    Completion
    ==========
    Request completion can be hooked by rq->end_io(), but then, all bios
    in the request will have been completed even error cases, and the bio
    submitter will have noticed the error.
    To prevent the bio completion in error cases, request-based dm clones
    both bio and request and hooks both bio->bi_end_io() and rq->end_io():
    bio->bi_end_io(): end_clone_bio()
    rq->end_io(): end_clone_request()

    Summary of the request completion flow is below:
    blk_end_request() for a clone request
    => blk_update_request()
    => bio->bi_end_io() == end_clone_bio() for each clone bio
    => Free the clone bio
    => Success: Complete the original bio (blk_update_request())
    Error: Don't complete the original bio
    => blk_finish_request()
    => rq->end_io() == end_clone_request()
    => blk_complete_request()
    => dm_softirq_done()
    => Free the clone request
    => Success: Complete the original request (blk_end_request())
    Error: Requeue the original request

    end_clone_bio() completes the original request on the size of
    the original bio in successful cases.
    Even if all bios in the original request are completed by that
    completion, the original request must not be completed yet to keep
    the ordering of request completion for the stacking.
    So end_clone_bio() uses blk_update_request() instead of
    blk_end_request().
    In error cases, end_clone_bio() doesn't complete the original bio.
    It just frees the cloned bio and gives over the error handling to
    end_clone_request().

    end_clone_request(), which is called with queue lock held, completes
    the clone request and the original request in a softirq context
    (dm_softirq_done()), which has no queue lock, to avoid a deadlock
    issue on submission of another request during the completion:
    - The submitted request may be mapped to the same device
    - Request submission requires queue lock, but the queue lock
    has been held by itself and it doesn't know that

    The clone request has no clone bio when dm_softirq_done() is called.
    So target drivers can't resubmit it again even error cases.
    Instead, they can ask dm core for requeueing and remapping
    the original request in that cases.

    suspend
    =======
    Request-based dm uses stopping md->queue as suspend of the md.
    For noflush suspend, just stops md->queue.

    For flush suspend, inserts a marker request to the tail of md->queue.
    And dispatches all requests in md->queue until the marker comes to
    the front of md->queue. Then, stops dispatching request and waits
    for the all dispatched requests to complete.
    After that, completes the marker request, stops md->queue and
    wake up the waiter on the suspend queue, md->wait.

    resume
    ======
    Starts md->queue.

    Signed-off-by: Kiyoshi Ueda
    Signed-off-by: Jun'ichi Nomura
    Signed-off-by: Alasdair G Kergon

    Kiyoshi Ueda
     
  • Currently, device-mapper maintains a separate instance of 'struct
    queue_limits' for each table of each device. When the configuration of
    a device is to be changed, first its table is loaded and this structure
    is populated, then the device is 'resumed' and the calculated
    queue_limits are applied.

    This places restrictions on how userspace may process related devices,
    where it is often advantageous to 'load' tables for several devices
    at once before 'resuming' them together. As the new queue_limits
    only take effect after the 'resume', if they are changing and one
    device uses another, the latter must be 'resumed' before the former
    may be 'loaded'.

    This patch moves the calculation of these queue_limits out of
    the 'load' operation into 'resume'. Since we are no longer
    pre-calculating this struct, we no longer need to maintain copies
    within our dm structs.

    dm_set_device_limits() now passes the 'start' of the device's
    data area (aka pe_start) as the 'offset' to blk_stack_limits().

    init_valid_queue_limits() is replaced by blk_set_default_limits().

    Signed-off-by: Mike Snitzer
    Cc: martin.petersen@oracle.com
    Signed-off-by: Alasdair G Kergon

    Mike Snitzer
     
  • Add .iterate_devices to 'struct target_type' to allow a function to be
    called for all devices in a DM target. Implemented it for all targets
    except those in dm-snap.c (origin and snapshot).

    (The raid1 version number jumps to 1.12 because we originally reserved
    1.1 to 1.11 for 'block_on_error' but ended up using 'handle_errors'
    instead.)

    Signed-off-by: Mike Snitzer
    Signed-off-by: Alasdair G Kergon
    Cc: martin.petersen@oracle.com

    Mike Snitzer
     
  • Use blk_stack_limits() to stack block limits (including topology) rather
    than duplicate the equivalent within Device Mapper.

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

    Mike Snitzer
     
  • Introduce num_flush_requests for a target to set to say how many flush
    instructions (empty barriers) it wants to receive. These are sent by
    __clone_and_map_empty_barrier with map_info->flush_request going from 0
    to (num_flush_requests - 1).

    Old targets without flush support won't receive any flush requests.

    Signed-off-by: Mikulas Patocka
    Signed-off-by: Alasdair G Kergon

    Mikulas Patocka
     

23 May, 2009

1 commit

  • 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: Martin K. Petersen
    Signed-off-by: Jens Axboe

    Martin K. Petersen
     

09 Apr, 2009

1 commit


03 Apr, 2009

1 commit

  • The tt_internal is really just a list_head to manage registered target_type
    in a double linked list,

    Here embed the list_head into target_type directly,
    1. to avoid kmalloc/kfree;
    2. then tt_internal is really unneeded;

    Cc: stable@kernel.org
    Signed-off-by: Cheng Renquan
    Signed-off-by: Alasdair G Kergon
    Reviewed-by: Alasdair G Kergon

    Cheng Renquan
     

06 Jan, 2009

1 commit

  • Implement barrier support for single device DM devices

    This patch implements barrier support in DM for the common case of dm linear
    just remapping a single underlying device. In this case we can safely
    pass the barrier through because there can be no reordering between
    devices.

    NB. Any DM device might cease to support barriers if it gets
    reconfigured so code must continue to allow for a possible
    -EOPNOTSUPP on every barrier bio submitted. - agk

    Signed-off-by: Andi Kleen
    Signed-off-by: Mikulas Patocka
    Signed-off-by: Alasdair G Kergon

    Andi Kleen