Skip to content

Commit 0d30777

Browse files
zwxdgdwsuse
authored andcommitted
types: Update position of elbatm in struct nvme_copy_range{_f1}
Update the Expected Logical Block Application Tag and Reference Tag in struct nvme_copy_range and struct nvme_copy_range_f1. 1. The elbatm is behind elbat fields, which are defined in section 3.2.2 Copy command 2. Storage and Reference Space is declared as an big-endian order, the elbt[10] fields need to reassigned [dwagner: squashed changes and updated commit message] Signed-off-by: Daniel Wagner <[email protected]>
1 parent c3c9028 commit 0d30777

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

src/nvme/types.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4640,8 +4640,8 @@ struct nvme_copy_range {
46404640
__le16 nlb;
46414641
__u8 rsvd18[6];
46424642
__le32 eilbrt;
4643-
__le16 elbatm;
46444643
__le16 elbat;
4644+
__le16 elbatm;
46454645
};
46464646

46474647
/**
@@ -4661,8 +4661,8 @@ struct nvme_copy_range_f1 {
46614661
__le16 nlb;
46624662
__u8 rsvd18[8];
46634663
__u8 elbt[10];
4664-
__le16 elbatm;
46654664
__le16 elbat;
4665+
__le16 elbatm;
46664666
};
46674667

46684668
/**

src/nvme/util.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,14 +403,17 @@ void nvme_init_copy_range_f1(struct nvme_copy_range_f1 *copy, __u16 *nlbs,
403403
__u64 *slbas, __u64 *eilbrts, __u32 *elbatms,
404404
__u32 *elbats, __u16 nr)
405405
{
406-
int i;
406+
int i, j;
407407

408408
for (i = 0; i < nr; i++) {
409409
copy[i].nlb = cpu_to_le16(nlbs[i]);
410410
copy[i].slba = cpu_to_le64(slbas[i]);
411-
copy[i].elbt[2] = cpu_to_le64(eilbrts[i]);
412411
copy[i].elbatm = cpu_to_le16(elbatms[i]);
413412
copy[i].elbat = cpu_to_le16(elbats[i]);
413+
for (j = 0; j < 8; j++)
414+
copy[i].elbt[9 - j] = (eilbrts[i] >> (8 * j)) & 0xff;
415+
copy[i].elbt[1] = 0;
416+
copy[i].elbt[0] = 0;
414417
}
415418
}
416419

0 commit comments

Comments
 (0)