@@ -115,52 +115,6 @@ const char *blk_zone_cond_str(enum blk_zone_cond zone_cond)
115115}
116116EXPORT_SYMBOL_GPL (blk_zone_cond_str );
117117
118- /*
119- * Return true if a request is a write requests that needs zone write locking.
120- */
121- bool blk_req_needs_zone_write_lock (struct request * rq )
122- {
123- if (!rq -> q -> disk -> seq_zones_wlock )
124- return false;
125-
126- return blk_rq_is_seq_zoned_write (rq );
127- }
128- EXPORT_SYMBOL_GPL (blk_req_needs_zone_write_lock );
129-
130- bool blk_req_zone_write_trylock (struct request * rq )
131- {
132- unsigned int zno = blk_rq_zone_no (rq );
133-
134- if (test_and_set_bit (zno , rq -> q -> disk -> seq_zones_wlock ))
135- return false;
136-
137- WARN_ON_ONCE (rq -> rq_flags & RQF_ZONE_WRITE_LOCKED );
138- rq -> rq_flags |= RQF_ZONE_WRITE_LOCKED ;
139-
140- return true;
141- }
142- EXPORT_SYMBOL_GPL (blk_req_zone_write_trylock );
143-
144- void __blk_req_zone_write_lock (struct request * rq )
145- {
146- if (WARN_ON_ONCE (test_and_set_bit (blk_rq_zone_no (rq ),
147- rq -> q -> disk -> seq_zones_wlock )))
148- return ;
149-
150- WARN_ON_ONCE (rq -> rq_flags & RQF_ZONE_WRITE_LOCKED );
151- rq -> rq_flags |= RQF_ZONE_WRITE_LOCKED ;
152- }
153- EXPORT_SYMBOL_GPL (__blk_req_zone_write_lock );
154-
155- void __blk_req_zone_write_unlock (struct request * rq )
156- {
157- rq -> rq_flags &= ~RQF_ZONE_WRITE_LOCKED ;
158- if (rq -> q -> disk -> seq_zones_wlock )
159- WARN_ON_ONCE (!test_and_clear_bit (blk_rq_zone_no (rq ),
160- rq -> q -> disk -> seq_zones_wlock ));
161- }
162- EXPORT_SYMBOL_GPL (__blk_req_zone_write_unlock );
163-
164118/**
165119 * bdev_nr_zones - Get number of zones
166120 * @bdev: Target device
@@ -1506,9 +1460,6 @@ void disk_free_zone_resources(struct gendisk *disk)
15061460
15071461 kfree (disk -> conv_zones_bitmap );
15081462 disk -> conv_zones_bitmap = NULL ;
1509- kfree (disk -> seq_zones_wlock );
1510- disk -> seq_zones_wlock = NULL ;
1511-
15121463 disk -> zone_capacity = 0 ;
15131464 disk -> nr_zones = 0 ;
15141465}
@@ -1556,7 +1507,6 @@ static int disk_revalidate_zone_resources(struct gendisk *disk,
15561507struct blk_revalidate_zone_args {
15571508 struct gendisk * disk ;
15581509 unsigned long * conv_zones_bitmap ;
1559- unsigned long * seq_zones_wlock ;
15601510 unsigned int nr_zones ;
15611511 unsigned int zone_capacity ;
15621512 sector_t sector ;
@@ -1574,7 +1524,6 @@ static int disk_update_zone_resources(struct gendisk *disk,
15741524
15751525 disk -> nr_zones = args -> nr_zones ;
15761526 disk -> zone_capacity = args -> zone_capacity ;
1577- swap (disk -> seq_zones_wlock , args -> seq_zones_wlock );
15781527 swap (disk -> conv_zones_bitmap , args -> conv_zones_bitmap );
15791528
15801529 /*
@@ -1664,13 +1613,6 @@ static int blk_revalidate_zone_cb(struct blk_zone *zone, unsigned int idx,
16641613 set_bit (idx , args -> conv_zones_bitmap );
16651614 break ;
16661615 case BLK_ZONE_TYPE_SEQWRITE_REQ :
1667- if (!args -> seq_zones_wlock ) {
1668- args -> seq_zones_wlock =
1669- blk_alloc_zone_bitmap (q -> node , args -> nr_zones );
1670- if (!args -> seq_zones_wlock )
1671- return - ENOMEM ;
1672- }
1673-
16741616 /*
16751617 * Remember the capacity of the first sequential zone and check
16761618 * if it is constant for all zones.
@@ -1712,7 +1654,7 @@ static int blk_revalidate_zone_cb(struct blk_zone *zone, unsigned int idx,
17121654}
17131655
17141656/**
1715- * blk_revalidate_disk_zones - (re)allocate and initialize zone bitmaps
1657+ * blk_revalidate_disk_zones - (re)allocate and initialize zone write plugs
17161658 * @disk: Target disk
17171659 *
17181660 * Helper function for low-level device drivers to check, (re) allocate and
@@ -1786,9 +1728,8 @@ int blk_revalidate_disk_zones(struct gendisk *disk)
17861728 }
17871729
17881730 /*
1789- * Install the new bitmaps and update nr_zones only once the queue is
1790- * stopped and all I/Os are completed (i.e. a scheduler is not
1791- * referencing the bitmaps).
1731+ * Set the new disk zone parameters only once the queue is frozen and
1732+ * all I/Os are completed.
17921733 */
17931734 blk_mq_freeze_queue (q );
17941735 if (ret > 0 )
@@ -1799,7 +1740,6 @@ int blk_revalidate_disk_zones(struct gendisk *disk)
17991740 disk_free_zone_resources (disk );
18001741 blk_mq_unfreeze_queue (q );
18011742
1802- kfree (args .seq_zones_wlock );
18031743 kfree (args .conv_zones_bitmap );
18041744
18051745 return ret ;
0 commit comments