LCOV - code coverage report
Current view: top level - spdk/lib/scsi - dev.c (source / functions) Hit Total Coverage
Test: Combined Lines: 191 209 91.4 %
Date: 2024-07-15 20:08:55 Functions: 24 24 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 120 152 78.9 %

           Branch data     Line data    Source code
       1                 :            : /*   SPDX-License-Identifier: BSD-3-Clause
       2                 :            :  *   Copyright (C) 2008-2012 Daisuke Aoyama <aoyama@peach.ne.jp>.
       3                 :            :  *   Copyright (C) 2016 Intel Corporation.
       4                 :            :  *   All rights reserved.
       5                 :            :  */
       6                 :            : 
       7                 :            : #include "scsi_internal.h"
       8                 :            : 
       9                 :            : static struct spdk_scsi_dev g_devs[SPDK_SCSI_MAX_DEVS];
      10                 :            : 
      11                 :            : struct spdk_scsi_dev *
      12                 :        134 : scsi_dev_get_list(void)
      13                 :            : {
      14                 :        134 :         return g_devs;
      15                 :            : }
      16                 :            : 
      17                 :            : static struct spdk_scsi_dev *
      18                 :        203 : allocate_dev(void)
      19                 :            : {
      20                 :            :         struct spdk_scsi_dev *dev;
      21                 :            :         int i;
      22                 :            : 
      23         [ +  - ]:       1414 :         for (i = 0; i < SPDK_SCSI_MAX_DEVS; i++) {
      24                 :       1414 :                 dev = &g_devs[i];
      25         [ +  + ]:       1414 :                 if (!dev->is_allocated) {
      26         [ -  + ]:        203 :                         memset(dev, 0, sizeof(*dev));
      27                 :        203 :                         dev->id = i;
      28                 :        203 :                         dev->is_allocated = 1;
      29                 :        203 :                         TAILQ_INIT(&dev->luns);
      30                 :        203 :                         return dev;
      31                 :            :                 }
      32                 :            :         }
      33                 :            : 
      34                 :          0 :         return NULL;
      35                 :            : }
      36                 :            : 
      37                 :            : static void
      38                 :        194 : free_dev(struct spdk_scsi_dev *dev)
      39                 :            : {
      40         [ -  + ]:        194 :         assert(dev->is_allocated == 1);
      41   [ -  +  -  + ]:        194 :         assert(dev->removed == true);
      42                 :            : 
      43                 :        194 :         dev->is_allocated = 0;
      44                 :            : 
      45         [ +  + ]:        194 :         if (dev->remove_cb) {
      46                 :        142 :                 dev->remove_cb(dev->remove_ctx, 0);
      47                 :        142 :                 dev->remove_cb = NULL;
      48                 :            :         }
      49                 :        194 : }
      50                 :            : 
      51                 :            : void
      52                 :        221 : spdk_scsi_dev_destruct(struct spdk_scsi_dev *dev,
      53                 :            :                        spdk_scsi_dev_destruct_cb_t cb_fn, void *cb_arg)
      54                 :            : {
      55                 :            :         struct spdk_scsi_lun *lun, *tmp_lun;
      56                 :            : 
      57         [ +  + ]:        221 :         if (dev == NULL) {
      58         [ -  + ]:          3 :                 if (cb_fn) {
      59                 :          0 :                         cb_fn(cb_arg, -EINVAL);
      60                 :            :                 }
      61                 :          3 :                 return;
      62                 :            :         }
      63                 :            : 
      64   [ -  +  -  + ]:        218 :         if (dev->removed) {
      65         [ #  # ]:          0 :                 if (cb_fn) {
      66                 :          0 :                         cb_fn(cb_arg, -EINVAL);
      67                 :            :                 }
      68                 :          0 :                 return;
      69                 :            :         }
      70                 :            : 
      71                 :        218 :         dev->removed = true;
      72                 :        218 :         dev->remove_cb = cb_fn;
      73                 :        218 :         dev->remove_ctx = cb_arg;
      74                 :            : 
      75         [ +  + ]:        218 :         if (TAILQ_EMPTY(&dev->luns)) {
      76                 :         77 :                 free_dev(dev);
      77                 :         77 :                 return;
      78                 :            :         }
      79                 :            : 
      80         [ +  + ]:        301 :         TAILQ_FOREACH_SAFE(lun, &dev->luns, tailq, tmp_lun) {
      81                 :            :                 /*
      82                 :            :                  * LUN will remove itself from this dev when all outstanding IO
      83                 :            :                  * is done. When no more LUNs, dev will be deleted.
      84                 :            :                  */
      85                 :        160 :                 scsi_lun_destruct(lun);
      86                 :            :         }
      87                 :            : }
      88                 :            : 
      89                 :            : /*
      90                 :            :  * Search the lowest free LUN ID if the LUN ID is default, or check if the LUN ID is free otherwise,
      91                 :            :  * and also return the LUN which comes just before where we want to insert an new LUN.
      92                 :            :  */
      93                 :            : static int
      94                 :        308 : scsi_dev_find_free_lun(struct spdk_scsi_dev *dev, int lun_id,
      95                 :            :                        struct spdk_scsi_lun **prev_lun)
      96                 :            : {
      97                 :        308 :         struct spdk_scsi_lun *lun, *_prev_lun = NULL;
      98                 :            : 
      99         [ -  + ]:        308 :         if (prev_lun == NULL) {
     100                 :          0 :                 return -EINVAL;
     101                 :            :         }
     102                 :            : 
     103         [ +  + ]:        308 :         if (lun_id == -1) {
     104                 :         27 :                 lun_id = 0;
     105                 :            : 
     106         [ +  + ]:       3195 :                 TAILQ_FOREACH(lun, &dev->luns, tailq) {
     107         [ +  + ]:       3183 :                         if (lun->id > lun_id) {
     108                 :         15 :                                 break;
     109                 :            :                         }
     110                 :       3168 :                         lun_id = lun->id + 1;
     111                 :       3168 :                         _prev_lun = lun;
     112                 :            :                 }
     113                 :            : 
     114         [ +  + ]:         27 :                 if (lun_id >= SPDK_SCSI_DEV_MAX_LUN) {
     115                 :          6 :                         return -ENOSPC;
     116                 :            :                 }
     117                 :            :         } else {
     118         [ +  + ]:       2933 :                 TAILQ_FOREACH(lun, &dev->luns, tailq) {
     119         [ +  + ]:       2697 :                         if (lun->id == lun_id) {
     120                 :         18 :                                 return -EEXIST;
     121         [ +  + ]:       2679 :                         } else if (lun->id > lun_id) {
     122                 :         27 :                                 break;
     123                 :            :                         }
     124                 :       2652 :                         _prev_lun = lun;
     125                 :            :                 }
     126                 :            :         }
     127                 :            : 
     128                 :        284 :         *prev_lun = _prev_lun;
     129                 :        284 :         return 0;
     130                 :            : }
     131                 :            : 
     132                 :            : int
     133                 :         19 : spdk_scsi_dev_add_lun(struct spdk_scsi_dev *dev, const char *bdev_name, int lun_id,
     134                 :            :                       void (*hotremove_cb)(const struct spdk_scsi_lun *, void *),
     135                 :            :                       void *hotremove_ctx)
     136                 :            : {
     137                 :         19 :         return spdk_scsi_dev_add_lun_ext(dev, bdev_name, lun_id,
     138                 :            :                                          NULL, NULL,
     139                 :            :                                          hotremove_cb, hotremove_ctx);
     140                 :            : }
     141                 :            : 
     142                 :            : int
     143                 :        239 : spdk_scsi_dev_add_lun_ext(struct spdk_scsi_dev *dev, const char *bdev_name, int lun_id,
     144                 :            :                           void (*resize_cb)(const struct spdk_scsi_lun *, void *),
     145                 :            :                           void *resize_ctx,
     146                 :            :                           void (*hotremove_cb)(const struct spdk_scsi_lun *, void *),
     147                 :            :                           void *hotremove_ctx)
     148                 :            : {
     149                 :        239 :         struct spdk_scsi_lun *lun, *prev_lun = NULL;
     150                 :            :         int rc;
     151                 :            : 
     152         [ -  + ]:        239 :         if (lun_id >= SPDK_SCSI_DEV_MAX_LUN) {
     153                 :          0 :                 SPDK_ERRLOG("LUN ID %d is more than the maximum.\n", lun_id);
     154                 :          0 :                 return -1;
     155                 :            :         }
     156                 :            : 
     157                 :        239 :         rc = scsi_dev_find_free_lun(dev, lun_id, &prev_lun);
     158         [ +  + ]:        239 :         if (rc != 0) {
     159         [ -  + ]:          3 :                 SPDK_ERRLOG("%s\n", rc == -EEXIST ? "LUN ID is duplicated" : "Free LUN ID is not found");
     160                 :          3 :                 return rc;
     161                 :            :         }
     162                 :            : 
     163                 :        236 :         lun = scsi_lun_construct(bdev_name, resize_cb, resize_ctx, hotremove_cb, hotremove_ctx);
     164         [ +  + ]:        236 :         if (lun == NULL) {
     165                 :          4 :                 return -1;
     166                 :            :         }
     167                 :            : 
     168                 :        232 :         lun->dev = dev;
     169                 :            : 
     170         [ +  + ]:        232 :         if (lun_id != -1) {
     171                 :        229 :                 lun->id = lun_id;
     172         [ +  - ]:          3 :         } else if (prev_lun == NULL) {
     173                 :          3 :                 lun->id = 0;
     174                 :            :         } else {
     175                 :          0 :                 lun->id = prev_lun->id + 1;
     176                 :            :         }
     177                 :            : 
     178         [ +  + ]:        232 :         if (prev_lun == NULL) {
     179         [ +  + ]:        214 :                 TAILQ_INSERT_HEAD(&dev->luns, lun, tailq);
     180                 :            :         } else {
     181         [ -  + ]:         18 :                 TAILQ_INSERT_AFTER(&dev->luns, prev_lun, lun, tailq);
     182                 :            :         }
     183                 :        232 :         return 0;
     184                 :            : }
     185                 :            : 
     186                 :            : void
     187                 :        199 : spdk_scsi_dev_delete_lun(struct spdk_scsi_dev *dev,
     188                 :            :                          struct spdk_scsi_lun *lun)
     189                 :            : {
     190         [ +  + ]:        199 :         TAILQ_REMOVE(&dev->luns, lun, tailq);
     191                 :            : 
     192   [ -  +  +  +  :        199 :         if (dev->removed && TAILQ_EMPTY(&dev->luns)) {
                   +  + ]
     193                 :        117 :                 free_dev(dev);
     194                 :            :         }
     195                 :        199 : }
     196                 :            : 
     197                 :        169 : struct spdk_scsi_dev *spdk_scsi_dev_construct(const char *name, const char *bdev_name_list[],
     198                 :            :                 int *lun_id_list, int num_luns, uint8_t protocol_id,
     199                 :            :                 void (*hotremove_cb)(const struct spdk_scsi_lun *, void *),
     200                 :            :                 void *hotremove_ctx)
     201                 :            : {
     202                 :        169 :         return spdk_scsi_dev_construct_ext(name, bdev_name_list, lun_id_list,
     203                 :            :                                            num_luns, protocol_id,
     204                 :            :                                            NULL, NULL,
     205                 :            :                                            hotremove_cb, hotremove_ctx);
     206                 :            : }
     207                 :            : 
     208                 :        215 : struct spdk_scsi_dev *spdk_scsi_dev_construct_ext(const char *name, const char *bdev_name_list[],
     209                 :            :                 int *lun_id_list, int num_luns, uint8_t protocol_id,
     210                 :            :                 void (*resize_cb)(const struct spdk_scsi_lun *, void *),
     211                 :            :                 void *resize_ctx,
     212                 :            :                 void (*hotremove_cb)(const struct spdk_scsi_lun *, void *),
     213                 :            :                 void *hotremove_ctx)
     214                 :            : {
     215                 :            :         struct spdk_scsi_dev *dev;
     216                 :            :         size_t name_len;
     217                 :            :         bool found_lun_0;
     218                 :            :         int i, rc;
     219                 :            : 
     220         [ -  + ]:        215 :         name_len = strlen(name);
     221         [ +  + ]:        215 :         if (name_len > sizeof(dev->name) - 1) {
     222                 :          3 :                 SPDK_ERRLOG("device %s: name longer than maximum allowed length %zu\n",
     223                 :            :                             name, sizeof(dev->name) - 1);
     224                 :          3 :                 return NULL;
     225                 :            :         }
     226                 :            : 
     227         [ +  + ]:        212 :         if (num_luns == 0) {
     228                 :          3 :                 SPDK_ERRLOG("device %s: no LUNs specified\n", name);
     229                 :          3 :                 return NULL;
     230                 :            :         }
     231                 :            : 
     232                 :        209 :         found_lun_0 = false;
     233         [ +  + ]:        215 :         for (i = 0; i < num_luns; i++) {
     234         [ +  + ]:        212 :                 if (lun_id_list[i] == 0) {
     235                 :        206 :                         found_lun_0 = true;
     236                 :        206 :                         break;
     237                 :            :                 }
     238                 :            :         }
     239                 :            : 
     240         [ +  + ]:        209 :         if (!found_lun_0) {
     241                 :          3 :                 SPDK_ERRLOG("device %s: no LUN 0 specified\n", name);
     242                 :          3 :                 return NULL;
     243                 :            :         }
     244                 :            : 
     245         [ +  + ]:        426 :         for (i = 0; i < num_luns; i++) {
     246         [ +  + ]:        223 :                 if (bdev_name_list[i] == NULL) {
     247                 :          3 :                         SPDK_ERRLOG("NULL spdk_scsi_lun for LUN %d\n",
     248                 :            :                                     lun_id_list[i]);
     249                 :          3 :                         return NULL;
     250                 :            :                 }
     251                 :            :         }
     252                 :            : 
     253                 :        203 :         dev = allocate_dev();
     254         [ -  + ]:        203 :         if (dev == NULL) {
     255                 :          0 :                 return NULL;
     256                 :            :         }
     257                 :            : 
     258   [ -  +  -  + ]:        203 :         memcpy(dev->name, name, name_len + 1);
     259                 :            : 
     260                 :        203 :         dev->num_ports = 0;
     261                 :        203 :         dev->protocol_id = protocol_id;
     262                 :            : 
     263         [ +  + ]:        422 :         for (i = 0; i < num_luns; i++) {
     264                 :        220 :                 rc = spdk_scsi_dev_add_lun_ext(dev, bdev_name_list[i], lun_id_list[i],
     265                 :            :                                                resize_cb, resize_ctx,
     266                 :            :                                                hotremove_cb, hotremove_ctx);
     267         [ +  + ]:        220 :                 if (rc < 0) {
     268                 :          1 :                         spdk_scsi_dev_destruct(dev, NULL, NULL);
     269                 :          1 :                         return NULL;
     270                 :            :                 }
     271                 :            :         }
     272                 :            : 
     273                 :        202 :         return dev;
     274                 :            : }
     275                 :            : 
     276                 :            : void
     277                 :         12 : spdk_scsi_dev_queue_mgmt_task(struct spdk_scsi_dev *dev,
     278                 :            :                               struct spdk_scsi_task *task)
     279                 :            : {
     280         [ -  + ]:         12 :         assert(task != NULL);
     281                 :            : 
     282                 :         12 :         scsi_lun_execute_mgmt_task(task->lun, task);
     283                 :         12 : }
     284                 :            : 
     285                 :            : void
     286                 :    8626961 : spdk_scsi_dev_queue_task(struct spdk_scsi_dev *dev,
     287                 :            :                          struct spdk_scsi_task *task)
     288                 :            : {
     289         [ -  + ]:    8626961 :         assert(task != NULL);
     290                 :            : 
     291                 :    8626961 :         scsi_lun_execute_task(task->lun, task);
     292                 :    8626961 : }
     293                 :            : 
     294                 :            : static struct spdk_scsi_port *
     295                 :        207 : scsi_dev_find_free_port(struct spdk_scsi_dev *dev)
     296                 :            : {
     297                 :            :         int i;
     298                 :            : 
     299         [ +  - ]:        212 :         for (i = 0; i < SPDK_SCSI_DEV_MAX_PORTS; i++) {
     300         [ +  + ]:        212 :                 if (!dev->port[i].is_used) {
     301                 :        207 :                         return &dev->port[i];
     302                 :            :                 }
     303                 :            :         }
     304                 :            : 
     305                 :          0 :         return NULL;
     306                 :            : }
     307                 :            : 
     308                 :            : int
     309                 :        213 : spdk_scsi_dev_add_port(struct spdk_scsi_dev *dev, uint64_t id, const char *name)
     310                 :            : {
     311                 :            :         struct spdk_scsi_port *port;
     312                 :            :         int rc;
     313                 :            : 
     314         [ +  + ]:        213 :         if (dev->num_ports == SPDK_SCSI_DEV_MAX_PORTS) {
     315                 :          3 :                 SPDK_ERRLOG("device already has %d ports\n", SPDK_SCSI_DEV_MAX_PORTS);
     316                 :          3 :                 return -1;
     317                 :            :         }
     318                 :            : 
     319                 :        210 :         port = spdk_scsi_dev_find_port_by_id(dev, id);
     320         [ +  + ]:        210 :         if (port != NULL) {
     321                 :          3 :                 SPDK_ERRLOG("device already has port(%" PRIu64 ")\n", id);
     322                 :          3 :                 return -1;
     323                 :            :         }
     324                 :            : 
     325                 :        207 :         port = scsi_dev_find_free_port(dev);
     326         [ -  + ]:        207 :         if (port == NULL) {
     327                 :          0 :                 assert(false);
     328                 :            :                 return -1;
     329                 :            :         }
     330                 :            : 
     331                 :        207 :         rc = scsi_port_construct(port, id, dev->num_ports, name);
     332         [ +  + ]:        207 :         if (rc != 0) {
     333                 :          3 :                 return rc;
     334                 :            :         }
     335                 :            : 
     336                 :        204 :         dev->num_ports++;
     337                 :        204 :         return 0;
     338                 :            : }
     339                 :            : 
     340                 :            : int
     341                 :        144 : spdk_scsi_dev_delete_port(struct spdk_scsi_dev *dev, uint64_t id)
     342                 :            : {
     343                 :            :         struct spdk_scsi_port *port;
     344                 :            : 
     345                 :        144 :         port = spdk_scsi_dev_find_port_by_id(dev, id);
     346         [ -  + ]:        144 :         if (port == NULL) {
     347                 :          0 :                 SPDK_ERRLOG("device does not have specified port(%" PRIu64 ")\n", id);
     348                 :          0 :                 return -1;
     349                 :            :         }
     350                 :            : 
     351                 :        144 :         scsi_port_destruct(port);
     352                 :            : 
     353                 :        144 :         dev->num_ports--;
     354                 :            : 
     355                 :        144 :         return 0;
     356                 :            : }
     357                 :            : 
     358                 :            : struct spdk_scsi_port *
     359                 :    3354562 : spdk_scsi_dev_find_port_by_id(struct spdk_scsi_dev *dev, uint64_t id)
     360                 :            : {
     361                 :            :         int i;
     362                 :            : 
     363         [ +  + ]:    3355416 :         for (i = 0; i < SPDK_SCSI_DEV_MAX_PORTS; i++) {
     364         [ +  + ]:    3355203 :                 if (!dev->port[i].is_used) {
     365                 :        844 :                         continue;
     366                 :            :                 }
     367         [ +  + ]:    3354359 :                 if (dev->port[i].id == id) {
     368                 :    3354349 :                         return &dev->port[i];
     369                 :            :                 }
     370                 :            :         }
     371                 :            : 
     372                 :            :         /* No matching port found. */
     373                 :        213 :         return NULL;
     374                 :            : }
     375                 :            : 
     376                 :            : void
     377                 :         39 : spdk_scsi_dev_free_io_channels(struct spdk_scsi_dev *dev)
     378                 :            : {
     379                 :            :         struct spdk_scsi_lun *lun, *tmp_lun;
     380                 :            : 
     381         [ +  + ]:         78 :         TAILQ_FOREACH_SAFE(lun, &dev->luns, tailq, tmp_lun) {
     382                 :         39 :                 scsi_lun_free_io_channel(lun);
     383                 :            :         }
     384                 :         39 : }
     385                 :            : 
     386                 :            : int
     387                 :         39 : spdk_scsi_dev_allocate_io_channels(struct spdk_scsi_dev *dev)
     388                 :            : {
     389                 :            :         struct spdk_scsi_lun *lun, *tmp_lun;
     390                 :            :         int rc;
     391                 :            : 
     392         [ +  + ]:         78 :         TAILQ_FOREACH_SAFE(lun, &dev->luns, tailq, tmp_lun) {
     393                 :         39 :                 rc = scsi_lun_allocate_io_channel(lun);
     394         [ -  + ]:         39 :                 if (rc < 0) {
     395                 :          0 :                         spdk_scsi_dev_free_io_channels(dev);
     396                 :          0 :                         return -1;
     397                 :            :                 }
     398                 :            :         }
     399                 :            : 
     400                 :         39 :         return 0;
     401                 :            : }
     402                 :            : 
     403                 :            : const char *
     404                 :        736 : spdk_scsi_dev_get_name(const struct spdk_scsi_dev *dev)
     405                 :            : {
     406                 :        736 :         return dev->name;
     407                 :            : }
     408                 :            : 
     409                 :            : int
     410                 :        592 : spdk_scsi_dev_get_id(const struct spdk_scsi_dev *dev)
     411                 :            : {
     412                 :        592 :         return dev->id;
     413                 :            : }
     414                 :            : 
     415                 :            : struct spdk_scsi_lun *
     416                 :   18001956 : spdk_scsi_dev_get_lun(struct spdk_scsi_dev *dev, int lun_id)
     417                 :            : {
     418                 :            :         struct spdk_scsi_lun *lun;
     419                 :            : 
     420         [ +  + ]:   18732851 :         TAILQ_FOREACH(lun, &dev->luns, tailq) {
     421         [ +  + ]:   18592088 :                 if (lun->id == lun_id) {
     422         [ +  + ]:   17861193 :                         if (!spdk_scsi_lun_is_removing(lun)) {
     423                 :   17861182 :                                 return lun;
     424                 :            :                         } else {
     425                 :         11 :                                 return NULL;
     426                 :            :                         }
     427                 :            :                 }
     428                 :            :         }
     429                 :            : 
     430                 :     140763 :         return NULL;
     431                 :            : }
     432                 :            : 
     433                 :            : struct spdk_scsi_lun *
     434                 :       1286 : spdk_scsi_dev_get_first_lun(struct spdk_scsi_dev *dev)
     435                 :            : {
     436                 :            :         struct spdk_scsi_lun *lun;
     437                 :            : 
     438         [ +  - ]:       1286 :         TAILQ_FOREACH(lun, &dev->luns, tailq) {
     439         [ +  - ]:       1286 :                 if (!spdk_scsi_lun_is_removing(lun)) {
     440                 :       1286 :                         return lun;
     441                 :            :                 }
     442                 :            :         }
     443                 :            : 
     444                 :          0 :         return NULL;
     445                 :            : }
     446                 :            : 
     447                 :            : struct spdk_scsi_lun *
     448                 :       1376 : spdk_scsi_dev_get_next_lun(struct spdk_scsi_lun *prev_lun)
     449                 :            : {
     450                 :            :         struct spdk_scsi_dev *dev;
     451                 :            :         struct spdk_scsi_lun *lun;
     452                 :            : 
     453         [ -  + ]:       1376 :         if (prev_lun == NULL) {
     454                 :          0 :                 return NULL;
     455                 :            :         }
     456                 :            : 
     457                 :       1376 :         dev = prev_lun->dev;
     458                 :            : 
     459                 :       1376 :         lun = TAILQ_NEXT(prev_lun, tailq);
     460         [ +  + ]:       1376 :         if (lun == NULL) {
     461                 :       1286 :                 return NULL;
     462                 :            :         }
     463                 :            : 
     464   [ -  +  +  - ]:         90 :         TAILQ_FOREACH_FROM(lun, &dev->luns, tailq) {
     465         [ +  - ]:         90 :                 if (!spdk_scsi_lun_is_removing(lun)) {
     466                 :         90 :                         break;
     467                 :            :                 }
     468                 :            :         }
     469                 :            : 
     470                 :         90 :         return lun;
     471                 :            : }
     472                 :            : 
     473                 :            : bool
     474                 :        527 : spdk_scsi_dev_has_pending_tasks(const struct spdk_scsi_dev *dev,
     475                 :            :                                 const struct spdk_scsi_port *initiator_port)
     476                 :            : {
     477                 :            :         struct spdk_scsi_lun *lun;
     478                 :            : 
     479         [ +  + ]:       1038 :         TAILQ_FOREACH(lun, &dev->luns, tailq) {
     480   [ +  +  +  + ]:       1043 :                 if (scsi_lun_has_pending_tasks(lun, initiator_port) ||
     481                 :        517 :                     scsi_lun_has_pending_mgmt_tasks(lun, initiator_port)) {
     482                 :         15 :                         return true;
     483                 :            :                 }
     484                 :            :         }
     485                 :            : 
     486                 :        512 :         return false;
     487                 :            : }

Generated by: LCOV version 1.14