mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
block: use blkdev_issue_discard in blk_ioctl_discard
blk_ioctl_discard duplicates large amounts of code from blkdev_issue_discard, the only difference between the two is that blkdev_issue_discard needs to send a barrier discard request and blk_ioctl_discard a non-barrier one, and blk_ioctl_discard needs to wait on the request. To facilitates this add a flags argument to blkdev_issue_discard to control both aspects of the behaviour. This will be very useful later on for using the waiting funcitonality for other callers. Based on an earlier patch from Matthew Wilcox <[email protected]>. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
This commit is contained in:
parent
3d2257f157
commit
746cd1e7e4
6 changed files with 37 additions and 67 deletions
|
|
@ -161,7 +161,8 @@ static int discard_swap(struct swap_info_struct *si)
|
|||
}
|
||||
|
||||
err = blkdev_issue_discard(si->bdev, start_block,
|
||||
nr_blocks, GFP_KERNEL);
|
||||
nr_blocks, GFP_KERNEL,
|
||||
DISCARD_FL_BARRIER);
|
||||
if (err)
|
||||
break;
|
||||
|
||||
|
|
@ -200,7 +201,8 @@ static void discard_swap_cluster(struct swap_info_struct *si,
|
|||
start_block <<= PAGE_SHIFT - 9;
|
||||
nr_blocks <<= PAGE_SHIFT - 9;
|
||||
if (blkdev_issue_discard(si->bdev, start_block,
|
||||
nr_blocks, GFP_NOIO))
|
||||
nr_blocks, GFP_NOIO,
|
||||
DISCARD_FL_BARRIER))
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue