]> www.infradead.org Git - users/hch/nvme-cli.git/commitdiff
[NVMe-CLI] Get DUI for SN-340 failing with Data Area 4 - Buffer Misalignment
authorJeff Lien <jeff.lien@wdc.com>
Mon, 11 Nov 2019 15:41:52 +0000 (09:41 -0600)
committerKeith Busch <kbusch@kernel.org>
Mon, 11 Nov 2019 16:33:29 +0000 (01:33 +0900)
plugins/wdc/wdc-nvme.c

index ebb3c6fe73b03e9529db52af31848b21d4462368..10268de52593799d14c251e37f66c097ecc84302 100644 (file)
@@ -1426,17 +1426,9 @@ static int wdc_do_cap_dui(int fd, char *file, __u32 xfer_size, int data_area, in
                                goto free_mem;
                        }
 
-                       if (file_size == 0) {
-                               /* write the telemetry and log headers into the dump_file */
-                               err = write(output, (void *)log_hdr, WDC_NVME_CAP_DUI_HEADER_SIZE);
-                               if (err != WDC_NVME_CAP_DUI_HEADER_SIZE) {
-                                       fprintf(stderr, "%s:  Failed to flush header data to file!\n", __func__);
-                                       goto free_mem;
-                               }
+                       curr_data_offset = 0;
 
-                               log_size -= WDC_NVME_CAP_DUI_HEADER_SIZE;
-                               curr_data_offset = WDC_NVME_CAP_DUI_HEADER_SIZE;
-                       } else {
+                       if (file_size != 0) {
                                /* Write the DUI data based on the passed in file size */
                                if ((offset + file_size) > total_size)
                                        log_size = min((total_size - offset), file_size);
@@ -1447,21 +1439,8 @@ static int wdc_do_cap_dui(int fd, char *file, __u32 xfer_size, int data_area, in
                                        fprintf(stderr, "%s: INFO : WDC : Offset 0x%llx, file size 0x%llx, total size 0x%llx, log size 0x%llx\n",
                                                __func__, offset, file_size, total_size, log_size);
 
-                               curr_data_offset = 0;
+                               curr_data_offset = offset;
 
-                               if (offset == 0) {
-                                       /* write the telemetry and log headers into the dump_file */
-                                       err = write(output, (void *)log_hdr, WDC_NVME_CAP_DUI_HEADER_SIZE);
-                                       if (err != WDC_NVME_CAP_DUI_HEADER_SIZE) {
-                                               fprintf(stderr, "%s:  Failed to flush header data to file!\n", __func__);
-                                               goto free_mem;
-                                       }
-
-                                       log_size -= WDC_NVME_CAP_DUI_HEADER_SIZE;
-                                       curr_data_offset = WDC_NVME_CAP_DUI_HEADER_SIZE;
-                               } else {
-                                       curr_data_offset = offset;
-                               }
                        }
 
                        i = 0;