LCOV - code coverage report
Current view: top level - spdk/test/unit/lib/blob - bs_dev_common.c (source / functions) Hit Total Coverage
Test: Combined Lines: 178 227 78.4 %
Date: 2024-11-17 13:58:19 Functions: 18 21 85.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 249 442 56.3 %

           Branch data     Line data    Source code
       1                 :            : /*   SPDX-License-Identifier: BSD-3-Clause
       2                 :            :  *   Copyright (C) 2017 Intel Corporation.
       3                 :            :  *   All rights reserved.
       4                 :            :  *   Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
       5                 :            :  */
       6                 :            : 
       7                 :            : #include "thread/thread_internal.h"
       8                 :            : #include "bs_scheduler.c"
       9                 :            : 
      10                 :            : 
      11                 :            : #define DEV_BUFFER_SIZE (64 * 1024 * 1024)
      12                 :            : #define DEV_BUFFER_BLOCKLEN (4096)
      13                 :            : #define DEV_BUFFER_BLOCKCNT (DEV_BUFFER_SIZE / DEV_BUFFER_BLOCKLEN)
      14                 :            : uint8_t *g_dev_buffer;
      15                 :            : uint64_t g_dev_write_bytes;
      16                 :            : uint64_t g_dev_read_bytes;
      17                 :            : uint64_t g_dev_copy_bytes;
      18                 :            : bool g_dev_writev_ext_called;
      19                 :            : bool g_dev_readv_ext_called;
      20                 :            : bool g_dev_copy_enabled;
      21                 :            : struct spdk_blob_ext_io_opts g_blob_ext_io_opts;
      22                 :            : 
      23                 :            : struct spdk_power_failure_counters {
      24                 :            :         uint64_t general_counter;
      25                 :            :         uint64_t read_counter;
      26                 :            :         uint64_t write_counter;
      27                 :            :         uint64_t unmap_counter;
      28                 :            :         uint64_t write_zero_counter;
      29                 :            :         uint64_t flush_counter;
      30                 :            : };
      31                 :            : 
      32                 :            : static struct spdk_power_failure_counters g_power_failure_counters = {};
      33                 :            : 
      34                 :            : struct spdk_power_failure_thresholds {
      35                 :            :         uint64_t general_threshold;
      36                 :            :         uint64_t read_threshold;
      37                 :            :         uint64_t write_threshold;
      38                 :            :         uint64_t unmap_threshold;
      39                 :            :         uint64_t write_zero_threshold;
      40                 :            :         uint64_t flush_threshold;
      41                 :            : };
      42                 :            : 
      43                 :            : static struct spdk_power_failure_thresholds g_power_failure_thresholds = {};
      44                 :            : 
      45                 :            : static uint64_t g_power_failure_rc;
      46                 :            : 
      47                 :            : void dev_reset_power_failure_event(void);
      48                 :            : void dev_reset_power_failure_counters(void);
      49                 :            : void dev_set_power_failure_thresholds(struct spdk_power_failure_thresholds thresholds);
      50                 :            : 
      51                 :            : void
      52                 :        492 : dev_reset_power_failure_event(void)
      53                 :            : {
      54         [ +  + ]:        492 :         memset(&g_power_failure_counters, 0, sizeof(g_power_failure_counters));
      55         [ +  + ]:        492 :         memset(&g_power_failure_thresholds, 0, sizeof(g_power_failure_thresholds));
      56                 :        492 :         g_power_failure_rc = 0;
      57                 :        492 : }
      58                 :            : 
      59                 :            : void
      60                 :          0 : dev_reset_power_failure_counters(void)
      61                 :            : {
      62         [ #  # ]:          0 :         memset(&g_power_failure_counters, 0, sizeof(g_power_failure_counters));
      63                 :          0 :         g_power_failure_rc = 0;
      64                 :          0 : }
      65                 :            : 
      66                 :            : /**
      67                 :            :  * Set power failure event. Power failure will occur after given number
      68                 :            :  * of IO operations. It may occur after number of particular operations
      69                 :            :  * (read, write, unmap, write zero or flush) or after given number of
      70                 :            :  * any IO operations (general_threshold). Value 0 means that the threshold
      71                 :            :  * is disabled. Any other value is the number of operation starting from
      72                 :            :  * which power failure event will happen.
      73                 :            :  */
      74                 :            : void
      75                 :        492 : dev_set_power_failure_thresholds(struct spdk_power_failure_thresholds thresholds)
      76                 :            : {
      77                 :        492 :         g_power_failure_thresholds = thresholds;
      78                 :        492 : }
      79                 :            : 
      80                 :            : /* Define here for UT only. */
      81                 :            : struct spdk_io_channel g_io_channel;
      82                 :            : 
      83                 :            : static struct spdk_io_channel *
      84                 :       4608 : dev_create_channel(struct spdk_bs_dev *dev)
      85                 :            : {
      86                 :       4608 :         return &g_io_channel;
      87                 :            : }
      88                 :            : 
      89                 :            : static void
      90                 :       4608 : dev_destroy_channel(struct spdk_bs_dev *dev, struct spdk_io_channel *channel)
      91                 :            : {
      92                 :       4608 : }
      93                 :            : 
      94                 :            : static void
      95                 :       4656 : dev_destroy(struct spdk_bs_dev *dev)
      96                 :            : {
      97                 :       4656 :         free(dev);
      98                 :       4656 : }
      99                 :            : 
     100                 :            : 
     101                 :            : static void
     102                 :     298764 : dev_complete_cb(void *arg)
     103                 :            : {
     104                 :     298764 :         struct spdk_bs_dev_cb_args *cb_args = arg;
     105                 :            : 
     106   [ +  -  +  -  :     298764 :         cb_args->cb_fn(cb_args->channel, cb_args->cb_arg, g_power_failure_rc);
          -  +  +  -  +  
          -  +  -  +  -  
                   +  - ]
     107                 :     298764 : }
     108                 :            : 
     109                 :            : static void
     110                 :     298764 : dev_complete(void *arg)
     111                 :            : {
     112                 :     298764 :         _bs_send_msg(dev_complete_cb, arg, NULL);
     113                 :     298764 : }
     114                 :            : 
     115                 :            : static void
     116                 :     153118 : dev_read(struct spdk_bs_dev *dev, struct spdk_io_channel *channel, void *payload,
     117                 :            :          uint64_t lba, uint32_t lba_count,
     118                 :            :          struct spdk_bs_dev_cb_args *cb_args)
     119                 :            : {
     120                 :      25133 :         uint64_t offset, length;
     121                 :            : 
     122   [ +  +  +  - ]:     153118 :         if (g_power_failure_thresholds.read_threshold != 0) {
     123                 :          0 :                 g_power_failure_counters.read_counter++;
     124                 :          0 :         }
     125                 :            : 
     126         [ +  + ]:     153118 :         if (g_power_failure_thresholds.general_threshold != 0) {
     127                 :       1212 :                 g_power_failure_counters.general_counter++;
     128                 :        202 :         }
     129                 :            : 
     130   [ +  +  -  +  :     153320 :         if ((g_power_failure_thresholds.read_threshold == 0 ||
                   +  + ]
     131   [ #  #  #  #  :          0 :              g_power_failure_counters.read_counter < g_power_failure_thresholds.read_threshold) &&
                   +  + ]
     132         [ +  + ]:     178453 :             (g_power_failure_thresholds.general_threshold == 0 ||
     133         [ +  + ]:       1212 :              g_power_failure_counters.general_counter < g_power_failure_thresholds.general_threshold)) {
     134   [ +  -  +  - ]:     153402 :                 offset = lba * dev->blocklen;
     135   [ +  -  +  - ]:     153402 :                 length = lba_count * dev->blocklen;
     136   [ +  +  #  # ]:     153402 :                 SPDK_CU_ASSERT_FATAL(offset + length <= DEV_BUFFER_SIZE);
     137                 :            : 
     138         [ +  - ]:     153402 :                 if (length > 0) {
     139   [ +  +  +  +  :     153402 :                         memcpy(payload, &g_dev_buffer[offset], length);
                   +  - ]
     140                 :     153402 :                         g_dev_read_bytes += length;
     141                 :      25567 :                 }
     142                 :      25567 :         } else {
     143                 :      50850 :                 g_power_failure_rc = -EIO;
     144                 :            :         }
     145                 :            : 
     146                 :     153582 :         spdk_thread_send_msg(spdk_get_thread(), dev_complete, cb_args);
     147                 :     153582 : }
     148                 :            : 
     149                 :            : static void
     150                 :     114234 : dev_write(struct spdk_bs_dev *dev, struct spdk_io_channel *channel, void *payload,
     151                 :            :           uint64_t lba, uint32_t lba_count,
     152                 :            :           struct spdk_bs_dev_cb_args *cb_args)
     153                 :            : {
     154                 :      18739 :         uint64_t offset, length;
     155                 :            : 
     156   [ +  +  +  - ]:     114234 :         if (g_power_failure_thresholds.write_threshold != 0) {
     157                 :          0 :                 g_power_failure_counters.write_counter++;
     158                 :          0 :         }
     159                 :            : 
     160         [ +  + ]:     114234 :         if (g_power_failure_thresholds.general_threshold != 0) {
     161                 :        816 :                 g_power_failure_counters.general_counter++;
     162                 :        136 :         }
     163                 :            : 
     164   [ +  +  -  +  :     114370 :         if ((g_power_failure_thresholds.write_threshold == 0 ||
                   +  + ]
     165   [ #  #  #  #  :          0 :              g_power_failure_counters.write_counter < g_power_failure_thresholds.write_threshold) &&
                   +  + ]
     166         [ +  + ]:     133109 :             (g_power_failure_thresholds.general_threshold == 0 ||
     167         [ +  + ]:        816 :              g_power_failure_counters.general_counter < g_power_failure_thresholds.general_threshold)) {
     168   [ +  -  +  - ]:     114330 :                 offset = lba * dev->blocklen;
     169   [ +  -  +  - ]:     114330 :                 length = lba_count * dev->blocklen;
     170   [ +  +  #  # ]:     114330 :                 SPDK_CU_ASSERT_FATAL(offset + length <= DEV_BUFFER_SIZE);
     171                 :            : 
     172   [ +  +  +  +  :     114330 :                 memcpy(&g_dev_buffer[offset], payload, length);
                   +  - ]
     173                 :     114330 :                 g_dev_write_bytes += length;
     174                 :      19055 :         } else {
     175                 :      38014 :                 g_power_failure_rc = -EIO;
     176                 :            :         }
     177                 :            : 
     178                 :     114594 :         spdk_thread_send_msg(spdk_get_thread(), dev_complete, cb_args);
     179                 :     114594 : }
     180                 :            : 
     181                 :            : static void
     182                 :       4896 : __check_iov(struct iovec *iov, int iovcnt, uint64_t length)
     183                 :            : {
     184                 :        816 :         int i;
     185                 :            : 
     186   [ +  +  -  + ]:      12936 :         for (i = 0; i < iovcnt; i++) {
     187   [ -  +  -  +  :       8040 :                 length -= iov[i].iov_len;
                   -  + ]
     188                 :       1340 :         }
     189                 :            : 
     190                 :       4896 :         CU_ASSERT(length == 0);
     191                 :       4896 : }
     192                 :            : 
     193                 :            : static void
     194                 :       3240 : dev_readv(struct spdk_bs_dev *dev, struct spdk_io_channel *channel,
     195                 :            :           struct iovec *iov, int iovcnt,
     196                 :            :           uint64_t lba, uint32_t lba_count,
     197                 :            :           struct spdk_bs_dev_cb_args *cb_args)
     198                 :            : {
     199                 :        540 :         uint64_t offset, length;
     200                 :        540 :         int i;
     201                 :            : 
     202   [ +  +  +  - ]:       3240 :         if (g_power_failure_thresholds.read_threshold != 0) {
     203                 :          0 :                 g_power_failure_counters.read_counter++;
     204                 :          0 :         }
     205                 :            : 
     206         [ +  + ]:       3240 :         if (g_power_failure_thresholds.general_threshold != 0) {
     207                 :          0 :                 g_power_failure_counters.general_counter++;
     208                 :          0 :         }
     209                 :            : 
     210   [ +  +  -  +  :       3240 :         if ((g_power_failure_thresholds.read_threshold == 0 ||
                   +  + ]
     211   [ #  #  #  #  :          0 :              g_power_failure_counters.read_counter < g_power_failure_thresholds.read_threshold) &&
                   +  + ]
     212         [ -  + ]:       3780 :             (g_power_failure_thresholds.general_threshold == 0 ||
     213         [ #  # ]:          0 :              g_power_failure_counters.general_counter < g_power_failure_thresholds.general_threshold)) {
     214   [ +  -  +  - ]:       3240 :                 offset = lba * dev->blocklen;
     215   [ +  -  +  - ]:       3240 :                 length = lba_count * dev->blocklen;
     216   [ +  +  #  # ]:       3240 :                 SPDK_CU_ASSERT_FATAL(offset + length <= DEV_BUFFER_SIZE);
     217                 :       3240 :                 __check_iov(iov, iovcnt, length);
     218                 :            : 
     219   [ +  +  +  - ]:       9504 :                 for (i = 0; i < iovcnt; i++) {
     220   [ +  +  +  +  :       6264 :                         memcpy(iov[i].iov_base, &g_dev_buffer[offset], iov[i].iov_len);
          +  -  +  -  +  
          -  +  -  +  -  
             +  -  +  - ]
     221   [ +  -  +  -  :       6264 :                         offset += iov[i].iov_len;
                   +  - ]
     222                 :       1044 :                 }
     223                 :            : 
     224                 :       3240 :                 g_dev_read_bytes += length;
     225                 :        540 :         } else {
     226                 :       1080 :                 g_power_failure_rc = -EIO;
     227                 :            :         }
     228                 :            : 
     229                 :       3240 :         spdk_thread_send_msg(spdk_get_thread(), dev_complete, cb_args);
     230                 :       3240 : }
     231                 :            : 
     232                 :            : static void
     233                 :       1296 : dev_readv_ext(struct spdk_bs_dev *dev, struct spdk_io_channel *channel,
     234                 :            :               struct iovec *iov, int iovcnt,
     235                 :            :               uint64_t lba, uint32_t lba_count,
     236                 :            :               struct spdk_bs_dev_cb_args *cb_args,
     237                 :            :               struct spdk_blob_ext_io_opts *io_opts)
     238                 :            : {
     239                 :       1296 :         g_dev_readv_ext_called = true;
     240                 :       1296 :         g_blob_ext_io_opts = *io_opts;
     241                 :       1296 :         dev_readv(dev, channel, iov, iovcnt, lba, lba_count, cb_args);
     242                 :       1296 : }
     243                 :            : 
     244                 :            : static void
     245                 :       1656 : dev_writev(struct spdk_bs_dev *dev, struct spdk_io_channel *channel,
     246                 :            :            struct iovec *iov, int iovcnt,
     247                 :            :            uint64_t lba, uint32_t lba_count,
     248                 :            :            struct spdk_bs_dev_cb_args *cb_args)
     249                 :            : {
     250                 :        276 :         uint64_t offset, length;
     251                 :        276 :         int i;
     252                 :            : 
     253   [ +  +  +  - ]:       1656 :         if (g_power_failure_thresholds.write_threshold != 0) {
     254                 :          0 :                 g_power_failure_counters.write_counter++;
     255                 :          0 :         }
     256                 :            : 
     257         [ +  + ]:       1656 :         if (g_power_failure_thresholds.general_threshold != 0) {
     258                 :          0 :                 g_power_failure_counters.general_counter++;
     259                 :          0 :         }
     260                 :            : 
     261   [ +  +  -  +  :       1656 :         if ((g_power_failure_thresholds.write_threshold == 0 ||
                   +  + ]
     262   [ #  #  #  #  :          0 :              g_power_failure_counters.write_counter < g_power_failure_thresholds.write_threshold)  &&
                   +  + ]
     263         [ -  + ]:       1932 :             (g_power_failure_thresholds.general_threshold == 0 ||
     264         [ #  # ]:          0 :              g_power_failure_counters.general_counter < g_power_failure_thresholds.general_threshold)) {
     265   [ +  -  +  - ]:       1656 :                 offset = lba * dev->blocklen;
     266   [ +  -  +  - ]:       1656 :                 length = lba_count * dev->blocklen;
     267   [ +  +  #  # ]:       1656 :                 SPDK_CU_ASSERT_FATAL(offset + length <= DEV_BUFFER_SIZE);
     268                 :       1656 :                 __check_iov(iov, iovcnt, length);
     269                 :            : 
     270   [ +  +  +  - ]:       3432 :                 for (i = 0; i < iovcnt; i++) {
     271   [ +  +  +  +  :       1776 :                         memcpy(&g_dev_buffer[offset], iov[i].iov_base, iov[i].iov_len);
          +  -  +  -  +  
          -  +  -  +  -  
             +  -  +  - ]
     272   [ +  -  +  -  :       1776 :                         offset += iov[i].iov_len;
                   +  - ]
     273                 :        296 :                 }
     274                 :            : 
     275                 :       1656 :                 g_dev_write_bytes += length;
     276                 :        276 :         } else {
     277                 :        552 :                 g_power_failure_rc = -EIO;
     278                 :            :         }
     279                 :            : 
     280                 :       1656 :         spdk_thread_send_msg(spdk_get_thread(), dev_complete, cb_args);
     281                 :       1656 : }
     282                 :            : 
     283                 :            : static void
     284                 :        432 : dev_writev_ext(struct spdk_bs_dev *dev, struct spdk_io_channel *channel,
     285                 :            :                struct iovec *iov, int iovcnt,
     286                 :            :                uint64_t lba, uint32_t lba_count,
     287                 :            :                struct spdk_bs_dev_cb_args *cb_args,
     288                 :            :                struct spdk_blob_ext_io_opts *io_opts)
     289                 :            : {
     290                 :        432 :         g_dev_writev_ext_called = true;
     291                 :        432 :         g_blob_ext_io_opts = *io_opts;
     292                 :        432 :         dev_writev(dev, channel, iov, iovcnt, lba, lba_count, cb_args);
     293                 :        432 : }
     294                 :            : 
     295                 :            : static void
     296                 :          0 : dev_flush(struct spdk_bs_dev *dev, struct spdk_io_channel *channel,
     297                 :            :           struct spdk_bs_dev_cb_args *cb_args)
     298                 :            : {
     299   [ #  #  #  # ]:          0 :         if (g_power_failure_thresholds.flush_threshold != 0) {
     300                 :          0 :                 g_power_failure_counters.flush_counter++;
     301                 :          0 :         }
     302                 :            : 
     303         [ #  # ]:          0 :         if (g_power_failure_thresholds.general_threshold != 0) {
     304                 :          0 :                 g_power_failure_counters.general_counter++;
     305                 :          0 :         }
     306                 :            : 
     307   [ #  #  #  # ]:          0 :         if ((g_power_failure_thresholds.flush_threshold != 0 &&
     308   [ #  #  #  #  :          0 :              g_power_failure_counters.flush_counter >= g_power_failure_thresholds.flush_threshold)  ||
                   #  # ]
     309         [ #  # ]:          0 :             (g_power_failure_thresholds.general_threshold != 0 &&
     310         [ #  # ]:          0 :              g_power_failure_counters.general_counter >= g_power_failure_thresholds.general_threshold)) {
     311                 :          0 :                 g_power_failure_rc = -EIO;
     312                 :          0 :         }
     313                 :            : 
     314                 :          0 :         spdk_thread_send_msg(spdk_get_thread(), dev_complete, cb_args);
     315                 :          0 : }
     316                 :            : 
     317                 :            : static void
     318                 :      10164 : dev_unmap(struct spdk_bs_dev *dev, struct spdk_io_channel *channel,
     319                 :            :           uint64_t lba, uint64_t lba_count,
     320                 :            :           struct spdk_bs_dev_cb_args *cb_args)
     321                 :            : {
     322                 :       1694 :         uint64_t offset, length;
     323                 :            : 
     324   [ +  +  +  - ]:      10164 :         if (g_power_failure_thresholds.unmap_threshold != 0) {
     325                 :          0 :                 g_power_failure_counters.unmap_counter++;
     326                 :          0 :         }
     327                 :            : 
     328         [ +  + ]:      10164 :         if (g_power_failure_thresholds.general_threshold != 0) {
     329                 :          0 :                 g_power_failure_counters.general_counter++;
     330                 :          0 :         }
     331                 :            : 
     332   [ +  +  -  +  :      10164 :         if ((g_power_failure_thresholds.unmap_threshold == 0 ||
                   +  + ]
     333   [ #  #  #  #  :          0 :              g_power_failure_counters.unmap_counter < g_power_failure_thresholds.unmap_threshold)  &&
                   +  + ]
     334         [ -  + ]:      11858 :             (g_power_failure_thresholds.general_threshold == 0 ||
     335         [ #  # ]:          0 :              g_power_failure_counters.general_counter < g_power_failure_thresholds.general_threshold)) {
     336   [ +  -  +  - ]:      10164 :                 offset = lba * dev->blocklen;
     337   [ +  -  +  - ]:      10164 :                 length = lba_count * dev->blocklen;
     338   [ +  +  #  # ]:      10164 :                 SPDK_CU_ASSERT_FATAL(offset + length <= DEV_BUFFER_SIZE);
     339   [ +  +  +  - ]:      10164 :                 memset(&g_dev_buffer[offset], 0, length);
     340                 :       1694 :         } else {
     341                 :       3388 :                 g_power_failure_rc = -EIO;
     342                 :            :         }
     343                 :            : 
     344                 :      10164 :         spdk_thread_send_msg(spdk_get_thread(), dev_complete, cb_args);
     345                 :      10164 : }
     346                 :            : 
     347                 :            : static void
     348                 :      15504 : dev_write_zeroes(struct spdk_bs_dev *dev, struct spdk_io_channel *channel,
     349                 :            :                  uint64_t lba, uint64_t lba_count,
     350                 :            :                  struct spdk_bs_dev_cb_args *cb_args)
     351                 :            : {
     352                 :       2564 :         uint64_t offset, length;
     353                 :            : 
     354   [ +  +  +  - ]:      15504 :         if (g_power_failure_thresholds.write_zero_threshold != 0) {
     355                 :          0 :                 g_power_failure_counters.write_zero_counter++;
     356                 :          0 :         }
     357                 :            : 
     358         [ +  + ]:      15504 :         if (g_power_failure_thresholds.general_threshold != 0) {
     359                 :         48 :                 g_power_failure_counters.general_counter++;
     360                 :          8 :         }
     361                 :            : 
     362   [ +  +  -  +  :      15512 :         if ((g_power_failure_thresholds.write_zero_threshold == 0 ||
                   +  + ]
     363   [ #  #  #  #  :          0 :              g_power_failure_counters.write_zero_counter < g_power_failure_thresholds.write_zero_threshold)  &&
                   +  + ]
     364         [ +  + ]:      18076 :             (g_power_failure_thresholds.general_threshold == 0 ||
     365         [ +  + ]:         48 :              g_power_failure_counters.general_counter < g_power_failure_thresholds.general_threshold)) {
     366   [ +  -  +  - ]:      15504 :                 offset = lba * dev->blocklen;
     367   [ +  -  +  - ]:      15504 :                 length = lba_count * dev->blocklen;
     368   [ +  +  #  # ]:      15504 :                 SPDK_CU_ASSERT_FATAL(offset + length <= DEV_BUFFER_SIZE);
     369   [ +  +  +  - ]:      15504 :                 memset(&g_dev_buffer[offset], 0, length);
     370                 :      15504 :                 g_dev_write_bytes += length;
     371                 :       2584 :         } else {
     372                 :       5168 :                 g_power_failure_rc = -EIO;
     373                 :            :         }
     374                 :            : 
     375                 :      15528 :         spdk_thread_send_msg(spdk_get_thread(), dev_complete, cb_args);
     376                 :      15528 : }
     377                 :            : 
     378                 :            : static bool
     379                 :          0 : dev_translate_lba(struct spdk_bs_dev *dev, uint64_t lba, uint64_t *base_lba)
     380                 :            : {
     381         [ #  # ]:          0 :         *base_lba = lba;
     382                 :          0 :         return true;
     383                 :            : }
     384                 :            : 
     385                 :            : static void
     386                 :        648 : dev_copy(struct spdk_bs_dev *dev, struct spdk_io_channel *channel, uint64_t dst_lba,
     387                 :            :          uint64_t src_lba, uint64_t lba_count, struct spdk_bs_dev_cb_args *cb_args)
     388                 :            : {
     389   [ +  -  +  -  :        648 :         void *dst = &g_dev_buffer[dst_lba * dev->blocklen];
                   +  - ]
     390   [ +  -  +  -  :        648 :         const void *src = &g_dev_buffer[src_lba * dev->blocklen];
                   +  - ]
     391   [ +  -  +  - ]:        648 :         uint64_t size = lba_count * dev->blocklen;
     392                 :            : 
     393   [ +  +  +  + ]:        648 :         memcpy(dst, src, size);
     394                 :        648 :         g_dev_copy_bytes += size;
     395                 :            : 
     396   [ +  -  +  -  :        648 :         cb_args->cb_fn(cb_args->channel, cb_args->cb_arg, 0);
          -  +  +  -  +  
          -  +  -  +  -  
                   +  - ]
     397                 :        648 : }
     398                 :            : 
     399                 :            : static struct spdk_bs_dev *
     400                 :       4656 : init_dev(void)
     401                 :            : {
     402                 :       4656 :         struct spdk_bs_dev *dev = calloc(1, sizeof(*dev));
     403                 :            : 
     404   [ +  +  #  # ]:       4656 :         SPDK_CU_ASSERT_FATAL(dev != NULL);
     405                 :            : 
     406   [ +  -  +  - ]:       4656 :         dev->create_channel = dev_create_channel;
     407   [ +  -  +  - ]:       4656 :         dev->destroy_channel = dev_destroy_channel;
     408   [ +  -  +  - ]:       4656 :         dev->destroy = dev_destroy;
     409   [ +  -  +  - ]:       4656 :         dev->read = dev_read;
     410   [ +  -  +  - ]:       4656 :         dev->write = dev_write;
     411   [ +  -  +  - ]:       4656 :         dev->readv = dev_readv;
     412   [ +  -  +  - ]:       4656 :         dev->writev = dev_writev;
     413   [ +  -  +  - ]:       4656 :         dev->readv_ext = dev_readv_ext;
     414   [ +  -  +  - ]:       4656 :         dev->writev_ext = dev_writev_ext;
     415   [ +  -  +  - ]:       4656 :         dev->flush = dev_flush;
     416   [ +  -  +  - ]:       4656 :         dev->unmap = dev_unmap;
     417   [ +  -  +  - ]:       4656 :         dev->write_zeroes = dev_write_zeroes;
     418   [ +  -  +  - ]:       4656 :         dev->translate_lba = dev_translate_lba;
     419   [ +  +  +  +  :       4656 :         dev->copy = g_dev_copy_enabled ? dev_copy : NULL;
                   +  - ]
     420   [ +  -  +  - ]:       4656 :         dev->blockcnt = DEV_BUFFER_BLOCKCNT;
     421   [ +  -  +  - ]:       4656 :         dev->blocklen = DEV_BUFFER_BLOCKLEN;
     422                 :            : 
     423                 :       5432 :         return dev;
     424                 :        776 : }

Generated by: LCOV version 1.14