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
1665 return ret;1665 return ret;
1666}1666}
1667 1667
1668static 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
1690static blk_qc_t dm_submit_bio(struct bio *bio)1668static blk_qc_t dm_submit_bio(struct bio *bio)
1691{1669{
1692 struct mapped_device *md = bio->bi_disk->private_data;1670 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
1707 }1685 }
1708 1686
1709 map = dm_get_live_table(md, &srcu_idx);1687 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 }
1710 1694
1711 /* if we're suspended, we have to queue this io for later */1695 /* If suspended, queue this IO for later */
1712 if (unlikely(test_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags))) {1696 if (unlikely(test_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags))) {
1713 dm_put_live_table(md, srcu_idx);
1714
1715 if (bio->bi_opf & REQ_NOWAIT)1697 if (bio->bi_opf & REQ_NOWAIT)
1716 bio_wouldblock_error(bio);1698 bio_wouldblock_error(bio);
1717 else if (!(bio->bi_opf & REQ_RAHEAD))1699 else if (bio->bi_opf & REQ_RAHEAD)
1718 queue_io(md, bio);
1719 else
1720 bio_io_error(bio);1700 bio_io_error(bio);
1721 return ret;1701 else
1702 queue_io(md, bio);
1703 goto out;
1722 }1704 }
1723 1705
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);
1725 1712
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);
1717out:
1726 dm_put_live_table(md, srcu_idx);1718 dm_put_live_table(md, srcu_idx);
1727 return ret;1719 return ret;
1728}1720}

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