@@ -160,37 +160,6 @@ static int dm_check_zoned_cb(struct blk_zone *zone, unsigned int idx,
160160 return 0 ;
161161}
162162
163- static int dm_check_zoned (struct mapped_device * md , struct dm_table * t )
164- {
165- struct gendisk * disk = md -> disk ;
166- unsigned int nr_conv_zones = 0 ;
167- int ret ;
168-
169- /* Count conventional zones */
170- md -> zone_revalidate_map = t ;
171- ret = dm_blk_report_zones (disk , 0 , UINT_MAX ,
172- dm_check_zoned_cb , & nr_conv_zones );
173- md -> zone_revalidate_map = NULL ;
174- if (ret < 0 ) {
175- DMERR ("Check zoned failed %d" , ret );
176- return ret ;
177- }
178-
179- /*
180- * If we only have conventional zones, expose the mapped device as
181- * a regular device.
182- */
183- if (nr_conv_zones >= ret ) {
184- disk -> queue -> limits .max_open_zones = 0 ;
185- disk -> queue -> limits .max_active_zones = 0 ;
186- disk -> queue -> limits .zoned = false;
187- clear_bit (DMF_EMULATE_ZONE_APPEND , & md -> flags );
188- disk -> nr_zones = 0 ;
189- }
190-
191- return 0 ;
192- }
193-
194163/*
195164 * Revalidate the zones of a mapped device to initialize resource necessary
196165 * for zone append emulation. Note that we cannot simply use the block layer
@@ -254,6 +223,8 @@ static bool dm_table_supports_zone_append(struct dm_table *t)
254223int dm_set_zones_restrictions (struct dm_table * t , struct request_queue * q )
255224{
256225 struct mapped_device * md = t -> md ;
226+ struct gendisk * disk = md -> disk ;
227+ unsigned int nr_conv_zones = 0 ;
257228 int ret ;
258229
259230 /*
@@ -272,14 +243,30 @@ int dm_set_zones_restrictions(struct dm_table *t, struct request_queue *q)
272243 return 0 ;
273244
274245 /*
275- * Check that the mapped device will indeed be zoned, that is, that it
276- * has sequential write required zones.
246+ * Count conventional zones to check that the mapped device will indeed
247+ * have sequential write required zones.
277248 */
278- ret = dm_check_zoned (md , t );
279- if (ret )
249+ md -> zone_revalidate_map = t ;
250+ ret = dm_blk_report_zones (disk , 0 , UINT_MAX ,
251+ dm_check_zoned_cb , & nr_conv_zones );
252+ md -> zone_revalidate_map = NULL ;
253+ if (ret < 0 ) {
254+ DMERR ("Check zoned failed %d" , ret );
280255 return ret ;
281- if (!blk_queue_is_zoned (q ))
256+ }
257+
258+ /*
259+ * If we only have conventional zones, expose the mapped device as
260+ * a regular device.
261+ */
262+ if (nr_conv_zones >= ret ) {
263+ disk -> queue -> limits .max_open_zones = 0 ;
264+ disk -> queue -> limits .max_active_zones = 0 ;
265+ disk -> queue -> limits .zoned = false;
266+ clear_bit (DMF_EMULATE_ZONE_APPEND , & md -> flags );
267+ disk -> nr_zones = 0 ;
282268 return 0 ;
269+ }
283270
284271 if (!md -> disk -> nr_zones ) {
285272 DMINFO ("%s using %s zone append" ,
0 commit comments