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: 166 218 76.1 %
Date: 2024-12-15 03:46:09 Functions: 18 21 85.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 75 140 53.6 %

           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                 :            : #define DEV_MAX_PHYS_BLOCKLEN (16384)
      15                 :            : #define FIRST_DATA_CLUSTER(bs) \
      16                 :            :         ((DEV_BUFFER_SIZE / spdk_bs_get_cluster_size(bs)) - spdk_bs_total_data_cluster_count(bs))
      17                 :            : 
      18                 :            : uint8_t *g_dev_buffer;
      19                 :            : uint64_t g_dev_write_bytes;
      20                 :            : uint64_t g_dev_read_bytes;
      21                 :            : uint64_t g_dev_copy_bytes;
      22                 :            : bool g_dev_writev_ext_called;
      23                 :            : bool g_dev_readv_ext_called;
      24                 :            : bool g_dev_copy_enabled;
      25                 :            : struct spdk_blob_ext_io_opts g_blob_ext_io_opts;
      26                 :            : uint32_t g_phys_blocklen;
      27                 :            : 
      28                 :            : struct spdk_power_failure_counters {
      29                 :            :         uint64_t general_counter;
      30                 :            :         uint64_t read_counter;
      31                 :            :         uint64_t write_counter;
      32                 :            :         uint64_t unmap_counter;
      33                 :            :         uint64_t write_zero_counter;
      34                 :            :         uint64_t flush_counter;
      35                 :            : };
      36                 :            : 
      37                 :            : static struct spdk_power_failure_counters g_power_failure_counters = {};
      38                 :            : 
      39                 :            : struct spdk_power_failure_thresholds {
      40                 :            :         uint64_t general_threshold;
      41                 :            :         uint64_t read_threshold;
      42                 :            :         uint64_t write_threshold;
      43                 :            :         uint64_t unmap_threshold;
      44                 :            :         uint64_t write_zero_threshold;
      45                 :            :         uint64_t flush_threshold;
      46                 :            : };
      47                 :            : 
      48                 :            : static struct spdk_power_failure_thresholds g_power_failure_thresholds = {};
      49                 :            : 
      50                 :            : static uint64_t g_power_failure_rc;
      51                 :            : 
      52                 :            : void dev_reset_power_failure_event(void);
      53                 :            : void dev_reset_power_failure_counters(void);
      54                 :            : void dev_set_power_failure_thresholds(struct spdk_power_failure_thresholds thresholds);
      55                 :            : 
      56                 :            : void
      57                 :        476 : dev_reset_power_failure_event(void)
      58                 :            : {
      59         [ -  + ]:        476 :         memset(&g_power_failure_counters, 0, sizeof(g_power_failure_counters));
      60         [ -  + ]:        476 :         memset(&g_power_failure_thresholds, 0, sizeof(g_power_failure_thresholds));
      61                 :        476 :         g_power_failure_rc = 0;
      62                 :        476 : }
      63                 :            : 
      64                 :            : void
      65                 :          0 : dev_reset_power_failure_counters(void)
      66                 :            : {
      67         [ #  # ]:          0 :         memset(&g_power_failure_counters, 0, sizeof(g_power_failure_counters));
      68                 :          0 :         g_power_failure_rc = 0;
      69                 :          0 : }
      70                 :            : 
      71                 :            : /**
      72                 :            :  * Set power failure event. Power failure will occur after given number
      73                 :            :  * of IO operations. It may occur after number of particular operations
      74                 :            :  * (read, write, unmap, write zero or flush) or after given number of
      75                 :            :  * any IO operations (general_threshold). Value 0 means that the threshold
      76                 :            :  * is disabled. Any other value is the number of operation starting from
      77                 :            :  * which power failure event will happen.
      78                 :            :  */
      79                 :            : void
      80                 :        476 : dev_set_power_failure_thresholds(struct spdk_power_failure_thresholds thresholds)
      81                 :            : {
      82                 :        476 :         g_power_failure_thresholds = thresholds;
      83                 :        476 : }
      84                 :            : 
      85                 :            : /* Define here for UT only. */
      86                 :            : struct spdk_io_channel g_io_channel;
      87                 :            : 
      88                 :            : static struct spdk_io_channel *
      89                 :       4032 : dev_create_channel(struct spdk_bs_dev *dev)
      90                 :            : {
      91                 :       4032 :         return &g_io_channel;
      92                 :            : }
      93                 :            : 
      94                 :            : static void
      95                 :       4032 : dev_destroy_channel(struct spdk_bs_dev *dev, struct spdk_io_channel *channel)
      96                 :            : {
      97                 :       4032 : }
      98                 :            : 
      99                 :            : static void
     100                 :       4132 : dev_destroy(struct spdk_bs_dev *dev)
     101                 :            : {
     102                 :       4132 :         free(dev);
     103                 :       4132 : }
     104                 :            : 
     105                 :            : 
     106                 :            : static void
     107                 :     340028 : dev_complete_cb(void *arg)
     108                 :            : {
     109                 :     340028 :         struct spdk_bs_dev_cb_args *cb_args = arg;
     110                 :            : 
     111                 :     340028 :         cb_args->cb_fn(cb_args->channel, cb_args->cb_arg, g_power_failure_rc);
     112                 :     340028 : }
     113                 :            : 
     114                 :            : static void
     115                 :     340028 : dev_complete(void *arg)
     116                 :            : {
     117                 :     340028 :         _bs_send_msg(dev_complete_cb, arg, NULL);
     118                 :     340028 : }
     119                 :            : 
     120                 :            : static void
     121                 :     161100 : dev_read(struct spdk_bs_dev *dev, struct spdk_io_channel *channel, void *payload,
     122                 :            :          uint64_t lba, uint32_t lba_count,
     123                 :            :          struct spdk_bs_dev_cb_args *cb_args)
     124                 :            : {
     125                 :            :         uint64_t offset, length;
     126                 :            : 
     127         [ -  + ]:     161100 :         if (g_power_failure_thresholds.read_threshold != 0) {
     128                 :          0 :                 g_power_failure_counters.read_counter++;
     129                 :          0 :         }
     130                 :            : 
     131         [ +  + ]:     161100 :         if (g_power_failure_thresholds.general_threshold != 0) {
     132                 :       1124 :                 g_power_failure_counters.general_counter++;
     133                 :        281 :         }
     134                 :            : 
     135         [ -  + ]:     161381 :         if ((g_power_failure_thresholds.read_threshold == 0 ||
     136         [ +  + ]:          0 :              g_power_failure_counters.read_counter < g_power_failure_thresholds.read_threshold) &&
     137         [ +  + ]:     161144 :             (g_power_failure_thresholds.general_threshold == 0 ||
     138         [ +  + ]:       1124 :              g_power_failure_counters.general_counter < g_power_failure_thresholds.general_threshold)) {
     139                 :     161012 :                 offset = lba * dev->blocklen;
     140                 :     161012 :                 length = lba_count * dev->blocklen;
     141         [ -  + ]:     161012 :                 SPDK_CU_ASSERT_FATAL(offset + length <= DEV_BUFFER_SIZE);
     142                 :            : 
     143         [ +  + ]:     161012 :                 if (length > 0) {
     144   [ -  +  -  + ]:     161012 :                         memcpy(payload, &g_dev_buffer[offset], length);
     145                 :     161012 :                         g_dev_read_bytes += length;
     146                 :      40253 :                 }
     147                 :      40253 :         } else {
     148                 :        176 :                 g_power_failure_rc = -EIO;
     149                 :            :         }
     150                 :            : 
     151                 :     161188 :         spdk_thread_send_msg(spdk_get_thread(), dev_complete, cb_args);
     152                 :     161188 : }
     153                 :            : 
     154                 :            : static void
     155                 :     151436 : dev_write(struct spdk_bs_dev *dev, struct spdk_io_channel *channel, void *payload,
     156                 :            :           uint64_t lba, uint32_t lba_count,
     157                 :            :           struct spdk_bs_dev_cb_args *cb_args)
     158                 :            : {
     159                 :            :         uint64_t offset, length;
     160                 :            : 
     161         [ -  + ]:     151436 :         if (g_power_failure_thresholds.write_threshold != 0) {
     162                 :          0 :                 g_power_failure_counters.write_counter++;
     163                 :          0 :         }
     164                 :            : 
     165         [ +  + ]:     151436 :         if (g_power_failure_thresholds.general_threshold != 0) {
     166                 :        700 :                 g_power_failure_counters.general_counter++;
     167                 :        175 :         }
     168                 :            : 
     169         [ -  + ]:     151611 :         if ((g_power_failure_thresholds.write_threshold == 0 ||
     170         [ +  + ]:          0 :              g_power_failure_counters.write_counter < g_power_failure_thresholds.write_threshold) &&
     171         [ +  + ]:     151496 :             (g_power_failure_thresholds.general_threshold == 0 ||
     172         [ +  + ]:        700 :              g_power_failure_counters.general_counter < g_power_failure_thresholds.general_threshold)) {
     173                 :     151316 :                 offset = lba * dev->blocklen;
     174                 :     151316 :                 length = lba_count * dev->blocklen;
     175         [ -  + ]:     151316 :                 SPDK_CU_ASSERT_FATAL(offset + length <= DEV_BUFFER_SIZE);
     176                 :            : 
     177   [ -  +  -  + ]:     151316 :                 memcpy(&g_dev_buffer[offset], payload, length);
     178                 :     151316 :                 g_dev_write_bytes += length;
     179                 :      37829 :         } else {
     180                 :        240 :                 g_power_failure_rc = -EIO;
     181                 :            :         }
     182                 :            : 
     183                 :     151556 :         spdk_thread_send_msg(spdk_get_thread(), dev_complete, cb_args);
     184                 :     151556 : }
     185                 :            : 
     186                 :            : static void
     187                 :       4080 : __check_iov(struct iovec *iov, int iovcnt, uint64_t length)
     188                 :            : {
     189                 :            :         int i;
     190                 :            : 
     191         [ +  + ]:      10780 :         for (i = 0; i < iovcnt; i++) {
     192                 :       6700 :                 length -= iov[i].iov_len;
     193                 :       1675 :         }
     194                 :            : 
     195                 :       4080 :         CU_ASSERT(length == 0);
     196                 :       4080 : }
     197                 :            : 
     198                 :            : static void
     199                 :       2700 : dev_readv(struct spdk_bs_dev *dev, struct spdk_io_channel *channel,
     200                 :            :           struct iovec *iov, int iovcnt,
     201                 :            :           uint64_t lba, uint32_t lba_count,
     202                 :            :           struct spdk_bs_dev_cb_args *cb_args)
     203                 :            : {
     204                 :            :         uint64_t offset, length;
     205                 :            :         int i;
     206                 :            : 
     207         [ -  + ]:       2700 :         if (g_power_failure_thresholds.read_threshold != 0) {
     208                 :          0 :                 g_power_failure_counters.read_counter++;
     209                 :          0 :         }
     210                 :            : 
     211         [ -  + ]:       2700 :         if (g_power_failure_thresholds.general_threshold != 0) {
     212                 :          0 :                 g_power_failure_counters.general_counter++;
     213                 :          0 :         }
     214                 :            : 
     215         [ -  + ]:       2700 :         if ((g_power_failure_thresholds.read_threshold == 0 ||
     216         [ #  # ]:          0 :              g_power_failure_counters.read_counter < g_power_failure_thresholds.read_threshold) &&
     217         [ -  + ]:       2700 :             (g_power_failure_thresholds.general_threshold == 0 ||
     218         [ #  # ]:          0 :              g_power_failure_counters.general_counter < g_power_failure_thresholds.general_threshold)) {
     219                 :       2700 :                 offset = lba * dev->blocklen;
     220                 :       2700 :                 length = lba_count * dev->blocklen;
     221         [ -  + ]:       2700 :                 SPDK_CU_ASSERT_FATAL(offset + length <= DEV_BUFFER_SIZE);
     222                 :       2700 :                 __check_iov(iov, iovcnt, length);
     223                 :            : 
     224         [ +  + ]:       7920 :                 for (i = 0; i < iovcnt; i++) {
     225   [ -  +  -  + ]:       5220 :                         memcpy(iov[i].iov_base, &g_dev_buffer[offset], iov[i].iov_len);
     226                 :       5220 :                         offset += iov[i].iov_len;
     227                 :       1305 :                 }
     228                 :            : 
     229                 :       2700 :                 g_dev_read_bytes += length;
     230                 :        675 :         } else {
     231                 :          0 :                 g_power_failure_rc = -EIO;
     232                 :            :         }
     233                 :            : 
     234                 :       2700 :         spdk_thread_send_msg(spdk_get_thread(), dev_complete, cb_args);
     235                 :       2700 : }
     236                 :            : 
     237                 :            : static void
     238                 :       1080 : dev_readv_ext(struct spdk_bs_dev *dev, struct spdk_io_channel *channel,
     239                 :            :               struct iovec *iov, int iovcnt,
     240                 :            :               uint64_t lba, uint32_t lba_count,
     241                 :            :               struct spdk_bs_dev_cb_args *cb_args,
     242                 :            :               struct spdk_blob_ext_io_opts *io_opts)
     243                 :            : {
     244                 :       1080 :         g_dev_readv_ext_called = true;
     245                 :       1080 :         g_blob_ext_io_opts = *io_opts;
     246                 :       1080 :         dev_readv(dev, channel, iov, iovcnt, lba, lba_count, cb_args);
     247                 :       1080 : }
     248                 :            : 
     249                 :            : static void
     250                 :       1380 : dev_writev(struct spdk_bs_dev *dev, struct spdk_io_channel *channel,
     251                 :            :            struct iovec *iov, int iovcnt,
     252                 :            :            uint64_t lba, uint32_t lba_count,
     253                 :            :            struct spdk_bs_dev_cb_args *cb_args)
     254                 :            : {
     255                 :            :         uint64_t offset, length;
     256                 :            :         int i;
     257                 :            : 
     258         [ -  + ]:       1380 :         if (g_power_failure_thresholds.write_threshold != 0) {
     259                 :          0 :                 g_power_failure_counters.write_counter++;
     260                 :          0 :         }
     261                 :            : 
     262         [ -  + ]:       1380 :         if (g_power_failure_thresholds.general_threshold != 0) {
     263                 :          0 :                 g_power_failure_counters.general_counter++;
     264                 :          0 :         }
     265                 :            : 
     266         [ -  + ]:       1380 :         if ((g_power_failure_thresholds.write_threshold == 0 ||
     267         [ #  # ]:          0 :              g_power_failure_counters.write_counter < g_power_failure_thresholds.write_threshold)  &&
     268         [ -  + ]:       1380 :             (g_power_failure_thresholds.general_threshold == 0 ||
     269         [ #  # ]:          0 :              g_power_failure_counters.general_counter < g_power_failure_thresholds.general_threshold)) {
     270                 :       1380 :                 offset = lba * dev->blocklen;
     271                 :       1380 :                 length = lba_count * dev->blocklen;
     272         [ -  + ]:       1380 :                 SPDK_CU_ASSERT_FATAL(offset + length <= DEV_BUFFER_SIZE);
     273                 :       1380 :                 __check_iov(iov, iovcnt, length);
     274                 :            : 
     275         [ +  + ]:       2860 :                 for (i = 0; i < iovcnt; i++) {
     276   [ -  +  -  + ]:       1480 :                         memcpy(&g_dev_buffer[offset], iov[i].iov_base, iov[i].iov_len);
     277                 :       1480 :                         offset += iov[i].iov_len;
     278                 :        370 :                 }
     279                 :            : 
     280                 :       1380 :                 g_dev_write_bytes += length;
     281                 :        345 :         } else {
     282                 :          0 :                 g_power_failure_rc = -EIO;
     283                 :            :         }
     284                 :            : 
     285                 :       1380 :         spdk_thread_send_msg(spdk_get_thread(), dev_complete, cb_args);
     286                 :       1380 : }
     287                 :            : 
     288                 :            : static void
     289                 :        360 : dev_writev_ext(struct spdk_bs_dev *dev, struct spdk_io_channel *channel,
     290                 :            :                struct iovec *iov, int iovcnt,
     291                 :            :                uint64_t lba, uint32_t lba_count,
     292                 :            :                struct spdk_bs_dev_cb_args *cb_args,
     293                 :            :                struct spdk_blob_ext_io_opts *io_opts)
     294                 :            : {
     295                 :        360 :         g_dev_writev_ext_called = true;
     296                 :        360 :         g_blob_ext_io_opts = *io_opts;
     297                 :        360 :         dev_writev(dev, channel, iov, iovcnt, lba, lba_count, cb_args);
     298                 :        360 : }
     299                 :            : 
     300                 :            : static void
     301                 :          0 : dev_flush(struct spdk_bs_dev *dev, struct spdk_io_channel *channel,
     302                 :            :           struct spdk_bs_dev_cb_args *cb_args)
     303                 :            : {
     304         [ #  # ]:          0 :         if (g_power_failure_thresholds.flush_threshold != 0) {
     305                 :          0 :                 g_power_failure_counters.flush_counter++;
     306                 :          0 :         }
     307                 :            : 
     308         [ #  # ]:          0 :         if (g_power_failure_thresholds.general_threshold != 0) {
     309                 :          0 :                 g_power_failure_counters.general_counter++;
     310                 :          0 :         }
     311                 :            : 
     312         [ #  # ]:          0 :         if ((g_power_failure_thresholds.flush_threshold != 0 &&
     313         [ #  # ]:          0 :              g_power_failure_counters.flush_counter >= g_power_failure_thresholds.flush_threshold)  ||
     314         [ #  # ]:          0 :             (g_power_failure_thresholds.general_threshold != 0 &&
     315         [ #  # ]:          0 :              g_power_failure_counters.general_counter >= g_power_failure_thresholds.general_threshold)) {
     316                 :          0 :                 g_power_failure_rc = -EIO;
     317                 :          0 :         }
     318                 :            : 
     319                 :          0 :         spdk_thread_send_msg(spdk_get_thread(), dev_complete, cb_args);
     320                 :          0 : }
     321                 :            : 
     322                 :            : static void
     323                 :       9104 : dev_unmap(struct spdk_bs_dev *dev, struct spdk_io_channel *channel,
     324                 :            :           uint64_t lba, uint64_t lba_count,
     325                 :            :           struct spdk_bs_dev_cb_args *cb_args)
     326                 :            : {
     327                 :            :         uint64_t offset, length;
     328                 :            : 
     329         [ -  + ]:       9104 :         if (g_power_failure_thresholds.unmap_threshold != 0) {
     330                 :          0 :                 g_power_failure_counters.unmap_counter++;
     331                 :          0 :         }
     332                 :            : 
     333         [ -  + ]:       9104 :         if (g_power_failure_thresholds.general_threshold != 0) {
     334                 :          0 :                 g_power_failure_counters.general_counter++;
     335                 :          0 :         }
     336                 :            : 
     337         [ -  + ]:       9104 :         if ((g_power_failure_thresholds.unmap_threshold == 0 ||
     338         [ #  # ]:          0 :              g_power_failure_counters.unmap_counter < g_power_failure_thresholds.unmap_threshold)  &&
     339         [ -  + ]:       9104 :             (g_power_failure_thresholds.general_threshold == 0 ||
     340         [ #  # ]:          0 :              g_power_failure_counters.general_counter < g_power_failure_thresholds.general_threshold)) {
     341                 :       9104 :                 offset = lba * dev->blocklen;
     342                 :       9104 :                 length = lba_count * dev->blocklen;
     343         [ -  + ]:       9104 :                 SPDK_CU_ASSERT_FATAL(offset + length <= DEV_BUFFER_SIZE);
     344         [ -  + ]:       9104 :                 memset(&g_dev_buffer[offset], 0, length);
     345                 :       2276 :         } else {
     346                 :          0 :                 g_power_failure_rc = -EIO;
     347                 :            :         }
     348                 :            : 
     349                 :       9104 :         spdk_thread_send_msg(spdk_get_thread(), dev_complete, cb_args);
     350                 :       9104 : }
     351                 :            : 
     352                 :            : static void
     353                 :      14080 : dev_write_zeroes(struct spdk_bs_dev *dev, struct spdk_io_channel *channel,
     354                 :            :                  uint64_t lba, uint64_t lba_count,
     355                 :            :                  struct spdk_bs_dev_cb_args *cb_args)
     356                 :            : {
     357                 :            :         uint64_t offset, length;
     358                 :            : 
     359         [ -  + ]:      14080 :         if (g_power_failure_thresholds.write_zero_threshold != 0) {
     360                 :          0 :                 g_power_failure_counters.write_zero_counter++;
     361                 :          0 :         }
     362                 :            : 
     363         [ +  + ]:      14080 :         if (g_power_failure_thresholds.general_threshold != 0) {
     364                 :         60 :                 g_power_failure_counters.general_counter++;
     365                 :         15 :         }
     366                 :            : 
     367         [ -  + ]:      14095 :         if ((g_power_failure_thresholds.write_zero_threshold == 0 ||
     368         [ +  + ]:          0 :              g_power_failure_counters.write_zero_counter < g_power_failure_thresholds.write_zero_threshold)  &&
     369         [ +  + ]:      14090 :             (g_power_failure_thresholds.general_threshold == 0 ||
     370         [ +  + ]:         60 :              g_power_failure_counters.general_counter < g_power_failure_thresholds.general_threshold)) {
     371                 :      14060 :                 offset = lba * dev->blocklen;
     372                 :      14060 :                 length = lba_count * dev->blocklen;
     373         [ -  + ]:      14060 :                 SPDK_CU_ASSERT_FATAL(offset + length <= DEV_BUFFER_SIZE);
     374         [ -  + ]:      14060 :                 memset(&g_dev_buffer[offset], 0, length);
     375                 :      14060 :                 g_dev_write_bytes += length;
     376                 :       3515 :         } else {
     377                 :         40 :                 g_power_failure_rc = -EIO;
     378                 :            :         }
     379                 :            : 
     380                 :      14100 :         spdk_thread_send_msg(spdk_get_thread(), dev_complete, cb_args);
     381                 :      14100 : }
     382                 :            : 
     383                 :            : static bool
     384                 :          0 : dev_translate_lba(struct spdk_bs_dev *dev, uint64_t lba, uint64_t *base_lba)
     385                 :            : {
     386                 :          0 :         *base_lba = lba;
     387                 :          0 :         return true;
     388                 :            : }
     389                 :            : 
     390                 :            : static void
     391                 :        520 : dev_copy(struct spdk_bs_dev *dev, struct spdk_io_channel *channel, uint64_t dst_lba,
     392                 :            :          uint64_t src_lba, uint64_t lba_count, struct spdk_bs_dev_cb_args *cb_args)
     393                 :            : {
     394                 :        520 :         void *dst = &g_dev_buffer[dst_lba * dev->blocklen];
     395                 :        520 :         const void *src = &g_dev_buffer[src_lba * dev->blocklen];
     396                 :        520 :         uint64_t size = lba_count * dev->blocklen;
     397                 :            : 
     398   [ -  +  -  + ]:        520 :         memcpy(dst, src, size);
     399                 :        520 :         g_dev_copy_bytes += size;
     400                 :            : 
     401                 :        520 :         cb_args->cb_fn(cb_args->channel, cb_args->cb_arg, 0);
     402                 :        520 : }
     403                 :            : 
     404                 :            : static struct spdk_bs_dev *
     405                 :       4132 : init_dev(void)
     406                 :            : {
     407                 :       4132 :         struct spdk_bs_dev *dev = calloc(1, sizeof(*dev));
     408                 :            : 
     409         [ +  + ]:       4132 :         SPDK_CU_ASSERT_FATAL(dev != NULL);
     410                 :            : 
     411                 :       4132 :         dev->create_channel = dev_create_channel;
     412                 :       4132 :         dev->destroy_channel = dev_destroy_channel;
     413                 :       4132 :         dev->destroy = dev_destroy;
     414                 :       4132 :         dev->read = dev_read;
     415                 :       4132 :         dev->write = dev_write;
     416                 :       4132 :         dev->readv = dev_readv;
     417                 :       4132 :         dev->writev = dev_writev;
     418                 :       4132 :         dev->readv_ext = dev_readv_ext;
     419                 :       4132 :         dev->writev_ext = dev_writev_ext;
     420                 :       4132 :         dev->flush = dev_flush;
     421                 :       4132 :         dev->unmap = dev_unmap;
     422                 :       4132 :         dev->write_zeroes = dev_write_zeroes;
     423                 :       4132 :         dev->translate_lba = dev_translate_lba;
     424   [ -  +  +  + ]:       4132 :         dev->copy = g_dev_copy_enabled ? dev_copy : NULL;
     425                 :       4132 :         dev->blockcnt = DEV_BUFFER_BLOCKCNT;
     426                 :       4132 :         dev->blocklen = DEV_BUFFER_BLOCKLEN;
     427                 :       4132 :         dev->phys_blocklen = g_phys_blocklen;
     428                 :            : 
     429                 :       4132 :         return dev;
     430                 :            : }

Generated by: LCOV version 1.15