Print this page
5253 kmem_alloc/kmem_zalloc won't fail with KM_SLEEP
5254 getrbuf won't fail with KM_SLEEP


6177         struct aac_slot *slotp;
6178 
6179         while ((slotp = softs->free_io_slot_head) != NULL) {
6180                 ASSERT(slotp->fib_phyaddr);
6181                 softs->free_io_slot_head = slotp->next;
6182                 aac_free_fib(slotp);
6183                 ASSERT(slotp->index == (slotp - softs->io_slot));
6184                 softs->total_fibs--;
6185         }
6186         ASSERT(softs->total_fibs == 0);
6187 }
6188 
6189 static int
6190 aac_create_slots(struct aac_softstate *softs)
6191 {
6192         int i;
6193 
6194         softs->total_slots = softs->aac_max_fibs;
6195         softs->io_slot = kmem_zalloc(sizeof (struct aac_slot) * \
6196             softs->total_slots, KM_SLEEP);
6197         if (softs->io_slot == NULL) {
6198                 AACDB_PRINT(softs, CE_WARN, "Cannot allocate slot");
6199                 return (AACERR);
6200         }
6201         for (i = 0; i < softs->total_slots; i++)
6202                 softs->io_slot[i].index = i;
6203         softs->free_io_slot_head = NULL;
6204         softs->total_fibs = 0;
6205         return (AACOK);
6206 }
6207 
6208 static void
6209 aac_destroy_slots(struct aac_softstate *softs)
6210 {
6211         ASSERT(softs->free_io_slot_head == NULL);
6212 
6213         kmem_free(softs->io_slot, sizeof (struct aac_slot) * \
6214             softs->total_slots);
6215         softs->io_slot = NULL;
6216         softs->total_slots = 0;
6217 }
6218 
6219 struct aac_slot *
6220 aac_get_slot(struct aac_softstate *softs)




6177         struct aac_slot *slotp;
6178 
6179         while ((slotp = softs->free_io_slot_head) != NULL) {
6180                 ASSERT(slotp->fib_phyaddr);
6181                 softs->free_io_slot_head = slotp->next;
6182                 aac_free_fib(slotp);
6183                 ASSERT(slotp->index == (slotp - softs->io_slot));
6184                 softs->total_fibs--;
6185         }
6186         ASSERT(softs->total_fibs == 0);
6187 }
6188 
6189 static int
6190 aac_create_slots(struct aac_softstate *softs)
6191 {
6192         int i;
6193 
6194         softs->total_slots = softs->aac_max_fibs;
6195         softs->io_slot = kmem_zalloc(sizeof (struct aac_slot) * \
6196             softs->total_slots, KM_SLEEP);




6197         for (i = 0; i < softs->total_slots; i++)
6198                 softs->io_slot[i].index = i;
6199         softs->free_io_slot_head = NULL;
6200         softs->total_fibs = 0;
6201         return (AACOK);
6202 }
6203 
6204 static void
6205 aac_destroy_slots(struct aac_softstate *softs)
6206 {
6207         ASSERT(softs->free_io_slot_head == NULL);
6208 
6209         kmem_free(softs->io_slot, sizeof (struct aac_slot) * \
6210             softs->total_slots);
6211         softs->io_slot = NULL;
6212         softs->total_slots = 0;
6213 }
6214 
6215 struct aac_slot *
6216 aac_get_slot(struct aac_softstate *softs)