History

dm: fold dm_process_bio() into dm_submit_bio()

dm_process_bio() is only called by dm_submit_bio(), there is no benefit to keeping dm_process_bio() factored out, so fold it. While at it, cleanup dm_submit_bio()'s DMF_BLOCK_IO_FOR_SUSPEND related branching and expand scope of dm_get_live_table() rcu reference on map via common 'out' label to dm_put_live_table().

Mike Snitzer committed 6 years ago

Commit b2abdb11 parent 0c2915b1 file · +22 −30Browse files

Unified · Split

drivers/md/dm.c+22−30
@@ -1665,28 +1665,6 @@ out: · 1664 unmodified lines
16651665 return ret;
16661666 }
16671667
1668−static blk_qc_t dm_process_bio(struct mapped_device *md,
1669− struct dm_table *map, struct bio *bio)
1670−{
1671− blk_qc_t ret = BLK_QC_T_NONE;
1672−
1673− if (unlikely(!map)) {
1674− bio_io_error(bio);
1675− return ret;
1676− }
1677−
1678− /*
1679− * Use blk_queue_split() for abnormal IO (e.g. discard, writesame, etc)
1680− * otherwise associated queue_limits won't be imposed.
1681− */
1682− if (is_abnormal_io(bio))
1683− blk_queue_split(&bio);
1684−
1685− if (dm_get_md_type(md) == DM_TYPE_NVME_BIO_BASED)
1686− return __process_bio(md, map, bio);
1687− return __split_and_process_bio(md, map, bio);
1688−}
1689−
16901668 static blk_qc_t dm_submit_bio(struct bio *bio)
16911669 {
16921670 struct mapped_device *md = bio->bi_disk->private_data;
@@ -1707,22 +1685,36 @@ static blk_qc_t dm_submit_bio(struct bio *bio) · 14 unmodified lines
17071685 }
17081686
17091687 map = dm_get_live_table(md, &srcu_idx);
1688+ if (unlikely(!map)) {
1689+ DMERR_LIMIT("%s: mapping table unavailable, erroring io",
1690+ dm_device_name(md));
1691+ bio_io_error(bio);
1692+ goto out;
1693+ }
17101694
1711− /* if we're suspended, we have to queue this io for later */
1695+ /* If suspended, queue this IO for later */
17121696 if (unlikely(test_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags))) {
1713− dm_put_live_table(md, srcu_idx);
1714−
17151697 if (bio->bi_opf & REQ_NOWAIT)
17161698 bio_wouldblock_error(bio);
1717− else if (!(bio->bi_opf & REQ_RAHEAD))
1718− queue_io(md, bio);
1719− else
1699+ else if (bio->bi_opf & REQ_RAHEAD)
17201700 bio_io_error(bio);
1721− return ret;
1701+ else
1702+ queue_io(md, bio);
1703+ goto out;
17221704 }
17231705
1724− ret = dm_process_bio(md, map, bio);
1706+ /*
1707+ * Use blk_queue_split() for abnormal IO (e.g. discard, writesame, etc)
1708+ * otherwise associated queue_limits won't be imposed.
1709+ */
1710+ if (is_abnormal_io(bio))
1711+ blk_queue_split(&bio);
17251712
1713+ if (dm_get_md_type(md) == DM_TYPE_NVME_BIO_BASED)
1714+ ret = __process_bio(md, map, bio);
1715+ else
1716+ ret = __split_and_process_bio(md, map, bio);
1717+out:
17261718 dm_put_live_table(md, srcu_idx);
17271719 return ret;
17281720 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t