bio_endio(bio);
}
+/*
+ * Submit @bio synchronously, or call bio_endio on it if the current process
+ * is being killed.
+ */
+int bio_submit_or_kill(struct bio *bio, unsigned int flags)
+{
+ if ((flags & BLKDEV_ZERO_KILLABLE) && fatal_signal_pending(current)) {
+ bio_await(bio, NULL, bio_endio_cb);
+ return -EINTR;
+ }
+
+ return submit_bio_wait(bio);
+}
+
/**
* bdev_rw_virt - synchronously read into / write from kernel mapping
* @bdev: block device to access
}
EXPORT_SYMBOL_GPL(bdev_rw_virt);
-/*
- * bio_await_chain - ends @bio and waits for every chained bio to complete
- */
-void bio_await_chain(struct bio *bio)
-{
- bio_await(bio, NULL, bio_endio_cb);
- bio_put(bio);
-}
-
void __bio_advance(struct bio *bio, unsigned bytes)
{
if (bio_integrity(bio))
__blkdev_issue_write_zeroes(bdev, sector, nr_sects, gfp, &bio,
flags, limit);
if (bio) {
- if ((flags & BLKDEV_ZERO_KILLABLE) &&
- fatal_signal_pending(current)) {
- bio_await_chain(bio);
- blk_finish_plug(&plug);
- return -EINTR;
- }
- ret = submit_bio_wait(bio);
+ ret = bio_submit_or_kill(bio, flags);
bio_put(bio);
}
blk_finish_plug(&plug);
blk_start_plug(&plug);
__blkdev_issue_zero_pages(bdev, sector, nr_sects, gfp, &bio, flags);
if (bio) {
- if ((flags & BLKDEV_ZERO_KILLABLE) &&
- fatal_signal_pending(current)) {
- bio_await_chain(bio);
- blk_finish_plug(&plug);
- return -EINTR;
- }
- ret = submit_bio_wait(bio);
+ ret = bio_submit_or_kill(bio, flags);
bio_put(bio);
}
blk_finish_plug(&plug);
struct task_struct *owner);
int __bio_queue_enter(struct request_queue *q, struct bio *bio);
void submit_bio_noacct_nocheck(struct bio *bio, bool split);
-void bio_await_chain(struct bio *bio);
+int bio_submit_or_kill(struct bio *bio, unsigned int flags);
static inline bool blk_try_enter_queue(struct request_queue *q, bool pm)
{
nr_sects = len >> SECTOR_SHIFT;
blk_start_plug(&plug);
- while (1) {
- if (fatal_signal_pending(current)) {
- if (prev)
- bio_await_chain(prev);
- err = -EINTR;
- goto out_unplug;
- }
+ while (!fatal_signal_pending(current)) {
bio = blk_alloc_discard_bio(bdev, §or, &nr_sects,
GFP_KERNEL);
if (!bio)
prev = bio_chain_and_submit(prev, bio);
}
if (prev) {
- err = submit_bio_wait(prev);
+ err = bio_submit_or_kill(prev, BLKDEV_ZERO_KILLABLE);
if (err == -EOPNOTSUPP)
err = 0;
bio_put(prev);
}
-out_unplug:
blk_finish_plug(&plug);
fail:
filemap_invalidate_unlock(bdev->bd_mapping);