@@ -661,14 +661,16 @@ static void queue_io(struct mapped_device *md, struct bio *bio)
661
661
* function to access the md->map field, and make sure they call
662
662
* dm_put_live_table() when finished.
663
663
*/
664
- struct dm_table * dm_get_live_table (struct mapped_device * md , int * srcu_idx ) __acquires (md - > io_barrier )
664
+ struct dm_table * dm_get_live_table (struct mapped_device * md ,
665
+ int * srcu_idx ) __acquires (md - > io_barrier )
665
666
{
666
667
* srcu_idx = srcu_read_lock (& md -> io_barrier );
667
668
668
669
return srcu_dereference (md -> map , & md -> io_barrier );
669
670
}
670
671
671
- void dm_put_live_table (struct mapped_device * md , int srcu_idx ) __releases (md - > io_barrier )
672
+ void dm_put_live_table (struct mapped_device * md ,
673
+ int srcu_idx ) __releases (md - > io_barrier )
672
674
{
673
675
srcu_read_unlock (& md -> io_barrier , srcu_idx );
674
676
}
@@ -694,6 +696,24 @@ static void dm_put_live_table_fast(struct mapped_device *md) __releases(RCU)
694
696
rcu_read_unlock ();
695
697
}
696
698
699
+ static inline struct dm_table * dm_get_live_table_bio (struct mapped_device * md ,
700
+ int * srcu_idx , struct bio * bio )
701
+ {
702
+ if (bio -> bi_opf & REQ_NOWAIT )
703
+ return dm_get_live_table_fast (md );
704
+ else
705
+ return dm_get_live_table (md , srcu_idx );
706
+ }
707
+
708
+ static inline void dm_put_live_table_bio (struct mapped_device * md , int srcu_idx ,
709
+ struct bio * bio )
710
+ {
711
+ if (bio -> bi_opf & REQ_NOWAIT )
712
+ dm_put_live_table_fast (md );
713
+ else
714
+ dm_put_live_table (md , srcu_idx );
715
+ }
716
+
697
717
static char * _dm_claim_ptr = "I belong to device-mapper" ;
698
718
699
719
/*
@@ -1612,7 +1632,7 @@ static void dm_submit_bio(struct bio *bio)
1612
1632
int srcu_idx ;
1613
1633
struct dm_table * map ;
1614
1634
1615
- map = dm_get_live_table (md , & srcu_idx );
1635
+ map = dm_get_live_table_bio (md , & srcu_idx , bio );
1616
1636
1617
1637
/* If suspended, or map not yet available, queue this IO for later */
1618
1638
if (unlikely (test_bit (DMF_BLOCK_IO_FOR_SUSPEND , & md -> flags )) ||
@@ -1635,7 +1655,7 @@ static void dm_submit_bio(struct bio *bio)
1635
1655
1636
1656
dm_split_and_process_bio (md , map , bio );
1637
1657
out :
1638
- dm_put_live_table (md , srcu_idx );
1658
+ dm_put_live_table_bio (md , srcu_idx , bio );
1639
1659
}
1640
1660
1641
1661
static bool dm_poll_dm_io (struct dm_io * io , struct io_comp_batch * iob ,
0 commit comments