summaryrefslogtreecommitdiffstats
path: root/drivers (follow)
Commit message (Collapse)AuthorAgeFilesLines
* dm btree: fix a bug in dm_btree_find_next_single()Joe Thornber2016-07-201-1/+8
| | | | | | | | | | | | | | | dm_btree_find_next_single() can short-circuit the search for a block with a return of -ENODATA if all entries are higher than the search key passed to lower_bound(). This hasn't been a problem because of the way the btree has been used by DM thinp. But it must be fixed now in preparation for fixing the race in DM thinp's handling of simultaneous block discard vs allocation. Otherwise, once that fix is in place, some of the blocks in a discard would not be unmapped as expected. Signed-off-by: Joe Thornber <ejt@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm raid: fix random optimal_io_size for raid0Heinz Mauelshagen2016-07-191-4/+3
| | | | | | | | | | | | | | raid_io_hints() was retrieving the number of data stripes used for the calculation of io_opt from struct r5conf, which is not defined for raid0 mappings. Base the calculation on the in-core raid_set structure instead. Also, adjust to use to_bytes() for the sector -> bytes conversion throughout. Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm raid: address checkpatch.pl complaintsHeinz Mauelshagen2016-07-191-21/+21
| | | | | | | | | Use 'unsigned int' where appropriate. Return negative errors. Correct an indentation. Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm: call PR reserve/unreserve on each underlying deviceChristoph Hellwig2016-07-181-15/+65
| | | | | | | | | | | | | So far we tried to rely on the SCSI 'all target ports' bit to register all path, but for many setups this didn't work properly as the different paths are seen as separate initiators to the target instead of multiple ports of the same initiator. Because of that we'll stop setting the 'all target ports' bit in SCSI, and let device mapper handle iterating over the device for each path and register them manually. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Mike Christie <mchristi@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* sd: don't use the ALL_TG_PT bit for reservationsChristoph Hellwig2016-07-181-2/+1
| | | | | | | | | | | | | | These only work if the we use the same initiator ID for all path, which might not be true if we use different protocols, or even just different HBAs. Instead dm-mpath will grow support to register all path manually later in this series. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Mike Christie <mchristi@redhat.com> Acked-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm: fix second blk_delay_queue() parameter to be in msec units not jiffiesTahsin Erdogan2016-07-181-1/+1
| | | | | | | | | | | | Commit d548b34b062 ("dm: reduce the queue delay used in dm_request_fn from 100ms to 10ms") always intended the value to be 10 msecs -- it just expressed it in jiffies because earlier commit 7eaceaccab ("block: remove per-queue plugging") did. Signed-off-by: Tahsin Erdogan <tahsin@google.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com> Fixes: d548b34b062 ("dm: reduce the queue delay used in dm_request_fn from 100ms to 10ms") Cc: stable@vger.kernel.org # 4.1+ -- stable@ backports must be applied to drivers/md/dm.c
* dm raid: change logical functions to actually return boolHeinz Mauelshagen2016-07-181-15/+14
| | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm raid: use rdev_for_each in statusHeinz Mauelshagen2016-07-181-2/+2
| | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm raid: use rs->raid_disks to avoid memory leaks on freeHeinz Mauelshagen2016-07-181-6/+5
| | | | | | | Also makes code more consistent throughout. Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm raid: support delta_disks for raid1, fix table outputHeinz Mauelshagen2016-07-181-43/+49
| | | | | | | | | | | | Add "delta_disks" constructor argument support to raid1 to allow for consistent userspace disk addition/removal handling. Fix raid_status() to report all raid disks with status and table output on disk adding reshapes, not just the ones listed on the mddev; optimize its rebuild and writemostly output. Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm raid: enhance reshape check and factor out reshape setupHeinz Mauelshagen2016-07-181-61/+106
| | | | | | | | | | | Enhance rs_reshape_requested() check function to be more transparent and fix its raid10 check. Streamline the constructor by factoring out reshaping preparation into fucntion rs_prepare_reshape(). Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm raid: allow resize during recoveryHeinz Mauelshagen2016-07-181-15/+19
| | | | | | | | | | Resizing a RAID set during recovery can be allowed, because the MD resynchronization thread will either stop any ongoing recovery in case of shrinking below the current recovery position or carry on recovery to the new size if the set is growing. Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm raid: fix rs_is_recovering() to allow for lvextendHeinz Mauelshagen2016-07-181-2/+2
| | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm raid: fix rebuild and catch bogus sync/resync flagsHeinz Mauelshagen2016-07-181-3/+16
| | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm raid: fix ctr memory leaks on error pathsHeinz Mauelshagen2016-07-181-10/+15
| | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm raid: fix typo in write_mostly flagHeinz Mauelshagen2016-07-181-1/+1
| | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm raid: also reject size change during recoveryHeinz Mauelshagen2016-07-181-3/+3
| | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm raid: fix new superblock/bitmap creation on disk additionHeinz Mauelshagen2016-07-181-1/+2
| | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm raid: add comments and fix typosHeinz Mauelshagen2016-07-181-7/+13
| | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm raid: fix raid10 device size error on out-of-place reshapeHeinz Mauelshagen2016-07-181-0/+8
| | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm raid: prohibit 'nosync' on new raid6 and reject resize during reshapeHeinz Mauelshagen2016-07-181-3/+15
| | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm raid: clarify and fix recoveryHeinz Mauelshagen2016-07-181-9/+55
| | | | | | | | | | | | | | | | | Add function rs_setup_recovery() to allow for defined setup of RAID set recovery in the constructor. Will be called with dev_sectors={0, rdev->sectors, MaxSectors} to recover a new or enforced sync, grown or not to be synhronized RAID set respectively. Prevents recovery on raid0, which doesn't support it. Enforces recovery on raid6 to ensure properly defined Syndromes mandatory for that MD personality are being created. Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm raid: fix rs_set_capacity on growing reshapeHeinz Mauelshagen2016-07-181-6/+3
| | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm raid: make rs_set_capacity to work on shrinking reshapeHeinz Mauelshagen2016-07-181-4/+4
| | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm raid: enhance comments in takeover checksHeinz Mauelshagen2016-07-181-2/+2
| | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm raid: remove bogus comment and fix comment typosHeinz Mauelshagen2016-07-181-4/+2
| | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm raid: more restricting data_offset value checksHeinz Mauelshagen2016-07-181-1/+2
| | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm raid: reject too many write_mostly devicesHeinz Mauelshagen2016-07-181-1/+7
| | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm raid: the sync_page_io() metadata_op argument is boolHeinz Mauelshagen2016-07-181-3/+3
| | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm raid: prohibit to pass in both sync and nosync ctr flagsHeinz Mauelshagen2016-07-181-0/+6
| | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm raid: avoid superfluous memory barriers on static metadataHeinz Mauelshagen2016-07-181-5/+0
| | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm rq: check kthread_run return for .request_fn request-based DMMike Snitzer2016-07-061-0/+2
| | | | | | | Check return value of kthread_run() in dm_old_init_request_queue(). Reported-by: Minfei Huang <mnghuan@gmail.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm verity fec: fix block calculationSami Tolvanen2016-07-021-3/+1
| | | | | | | | | | do_div was replaced with div64_u64 at some point, causing a bug with block calculation due to incompatible semantics of the two functions. Signed-off-by: Sami Tolvanen <samitolvanen@google.com> Fixes: a739ff3f543a ("dm verity: add support for forward error correction") Cc: stable@vger.kernel.org # v4.5+ Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm ioctl: Simplify parameter buffer management codeBart Van Assche2016-07-011-12/+6
| | | | | | | | | | | Merge the two DM_PARAMS_[KV]MALLOC flags into a single flag. Doing so avoids the crashes seen with previous attempts to consolidate buffer management to use kvfree() without first flagging that memory had actually been allocated. Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm crypt: Fix sparse complaintsBart Van Assche2016-07-011-2/+2
| | | | | | | | | Avoid that sparse complains about assigning a __le64 value to a u64 variable. Remove the (u64) casts since these are superfluous. This patch does not change the behavior of the source code. Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm raid: don't use 'const' in function returnArnd Bergmann2016-06-161-1/+1
| | | | | | | | | | | | | A newly introduced function has 'const int' as the return type, but as "make W=1" reports, that has no meaning: drivers/md/dm-raid.c:510:18: error: type qualifiers ignored on function return type [-Werror=ignored-qualifiers] This changes the return type to plain 'int'. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Fixes: 33e53f06850f ("dm raid: introduce extended superblock and new raid types to support takeover/reshaping") Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm raid: fix failed takeover/reshapes by keeping raid set frozenHeinz Mauelshagen2016-06-151-29/+56
| | | | | | | | | | | | | Superblock updates where bogus causing some takovers/reshapes to fail. Introduce new runtime flag (RT_FLAG_KEEP_RS_FROZEN) to keep a raid set frozen when a layout change was requested. Userpace will immediately reload the table w/o the flags requesting such change once they made it to the superblocks and any change of recovery/reshape offsets has to be avoided until after read. Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm raid: support to change bitmap region sizeHeinz Mauelshagen2016-06-151-0/+11
| | | | | Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm raid: add reshaping support to the targetHeinz Mauelshagen2016-06-151-58/+447
| | | | | | | | | | | | | | | | | | Add bool functions rs_is_recovering and rs_is_reshaping() to test for ongoing recovery/reshaping respectively in order to reject respective requests on ongoing ones. Remove ctr array size check, because ti->len and array sectors will differ during disk addition/removal reshape. Use __is_raid10_near() rather than type string compare. Introduce rs_check_reshape() and rs_start_reshape(), use the former in the ctr to reject bogus rehsape requests and the latter in preresume to actually start a reshape. Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm raid: add prerequisite functions and definitions for reshapingHeinz Mauelshagen2016-06-151-22/+202
| | | | | | | | | | | | Add rs_is_reshapable(), rs_data_stripes(), rs_reshape_requested(), rs_set_dev_and_array_sectors() and rs_adjust_data_offsets() Remove superfluous check for reshape message Correct runtime bit definitions to be incremental Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm raid: inverse check for flags from invalid to valid flagsHeinz Mauelshagen2016-06-141-32/+56
| | | | | | | | It is more intuitive to manage each raid level's features in terms of what is supported rather than what isn't supported. Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm raid: various code cleanupsMike Snitzer2016-06-141-56/+43
| | | | | | | | Renamed functions and variables with leading single underscore to have a double underscore. Renamed some functions to have better names. Folded functions that were split out without reason. Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm raid: rename functions that alloc and free struct raid_setMike Snitzer2016-06-141-7/+7
| | | | Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm raid: remove all the bitops wrappersMike Snitzer2016-06-141-125/+89
| | | | | | Removes obfuscation that is of little value. Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm raid: rename _in_range to __within_rangeMike Snitzer2016-06-141-14/+14
| | | | Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm raid: add missing "dm-raid0" module aliasMike Snitzer2016-06-141-1/+2
| | | | | | | Also update module description to "raid0/1/10/4/5/6 target" Reported by Alasdair G Kergon <agk@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm raid: rename _argname_by_flag to dm_raid_arg_name_by_flagMike Snitzer2016-06-141-30/+30
| | | | Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm raid: bump to v1.9.0 and make the extended SB feature flag reflect itMike Snitzer2016-06-141-17/+20
| | | | | | | | No idea what Heinz was doing with the versioning but upstream commit 4c9971ca6a ("dm raid: make sure no feature flags are set in metadata") bumped to 1.8.0 already. Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm raid: remove ti_error_* wrappersMike Snitzer2016-06-141-152/+249
| | | | | | | | | There ti_error_* wrappers added very little. No other DM target has ever gone to such lengths to wrap setting ti->error. Also fixes some NULL derefences via rs->ti->error. Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* dm raid: tabify appropriate whitespaceMike Snitzer2016-06-141-62/+62
| | | | | Signed-off-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>