44 * Copyright (c) 2011-2014, Intel Corporation.
55 */
66
7- #include <linux/async.h>
87#include <linux/blkdev.h>
98#include <linux/blk-mq.h>
109#include <linux/blk-integrity.h>
@@ -4057,35 +4056,6 @@ static void nvme_scan_ns(struct nvme_ctrl *ctrl, unsigned nsid)
40574056 }
40584057}
40594058
4060- /**
4061- * struct async_scan_info - keeps track of controller & NSIDs to scan
4062- * @ctrl: Controller on which namespaces are being scanned
4063- * @next_nsid: Index of next NSID to scan in ns_list
4064- * @ns_list: Pointer to list of NSIDs to scan
4065- *
4066- * Note: There is a single async_scan_info structure shared by all instances
4067- * of nvme_scan_ns_async() scanning a given controller, so the atomic
4068- * operations on next_nsid are critical to ensure each instance scans a unique
4069- * NSID.
4070- */
4071- struct async_scan_info {
4072- struct nvme_ctrl * ctrl ;
4073- atomic_t next_nsid ;
4074- __le32 * ns_list ;
4075- };
4076-
4077- static void nvme_scan_ns_async (void * data , async_cookie_t cookie )
4078- {
4079- struct async_scan_info * scan_info = data ;
4080- int idx ;
4081- u32 nsid ;
4082-
4083- idx = (u32 )atomic_fetch_inc (& scan_info -> next_nsid );
4084- nsid = le32_to_cpu (scan_info -> ns_list [idx ]);
4085-
4086- nvme_scan_ns (scan_info -> ctrl , nsid );
4087- }
4088-
40894059static void nvme_remove_invalid_namespaces (struct nvme_ctrl * ctrl ,
40904060 unsigned nsid )
40914061{
@@ -4112,15 +4082,11 @@ static int nvme_scan_ns_list(struct nvme_ctrl *ctrl)
41124082 __le32 * ns_list ;
41134083 u32 prev = 0 ;
41144084 int ret = 0 , i ;
4115- ASYNC_DOMAIN (domain );
4116- struct async_scan_info scan_info ;
41174085
41184086 ns_list = kzalloc (NVME_IDENTIFY_DATA_SIZE , GFP_KERNEL );
41194087 if (!ns_list )
41204088 return - ENOMEM ;
41214089
4122- scan_info .ctrl = ctrl ;
4123- scan_info .ns_list = ns_list ;
41244090 for (;;) {
41254091 struct nvme_command cmd = {
41264092 .identify .opcode = nvme_admin_identify ,
@@ -4136,23 +4102,19 @@ static int nvme_scan_ns_list(struct nvme_ctrl *ctrl)
41364102 goto free ;
41374103 }
41384104
4139- atomic_set (& scan_info .next_nsid , 0 );
41404105 for (i = 0 ; i < nr_entries ; i ++ ) {
41414106 u32 nsid = le32_to_cpu (ns_list [i ]);
41424107
41434108 if (!nsid ) /* end of the list? */
41444109 goto out ;
4145- async_schedule_domain (nvme_scan_ns_async , & scan_info ,
4146- & domain );
4110+ nvme_scan_ns (ctrl , nsid );
41474111 while (++ prev < nsid )
41484112 nvme_ns_remove_by_nsid (ctrl , prev );
41494113 }
4150- async_synchronize_full_domain (& domain );
41514114 }
41524115 out :
41534116 nvme_remove_invalid_namespaces (ctrl , prev );
41544117 free :
4155- async_synchronize_full_domain (& domain );
41564118 kfree (ns_list );
41574119 return ret ;
41584120}
0 commit comments