ndctl, test: unit test updates for the BTT 2.0 format
Vishal Verma
maintainerPATCH 1/1 ndctl, test: unit test updates for the BTT 2.0 format
With the BTT 2.0 update, a couple of minor updates to the unit tests are needed:
test/libndctl: Update expected BTT sizes
test/libndctl: in btt_autodetect, when wiping an old BTT, wipe the first two 4K pages instead of one.
--- test/libndctl.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
test/libndctl.c +13 -6
@@ -994,16 +994,16 @@ static int check_btt_size(struct ndctl_btt *btt)int size_select, sect_select;unsigned long long expect_table[][2 ] = { [0 ] = { - [0 ] =0x11b4400 , - [1 ] =0x8da2000 , + [0 ] =0x11b5400 , + [1 ] =0x8daa000 , }, [1 ] = { - [0 ] =0x13b0400 , - [1 ] =0x9d82000 , + [0 ] =0x13b1400 , + [1 ] =0x9d8a000 , }, [2 ] = { - [0 ] =0x1aa2600 , - [1 ] =0xd513000 , + [0 ] =0x1aa3600 , + [1 ] =0xd51b000 , }, };
@@ -1517,12 +1517,19 @@ static int check_btt_autodetect(struct ndctl_bus *bus, }memset (buf,0 ,4096 ); +/* Delete both the first and second 4K pages */ rc =pwrite (fd, buf,4096 ,4096 );if (rc <4096 ) { rc = -ENXIO ;fprintf (stderr,"%s: failed to overwrite btt on %s\n" , devname, bdev); } + rc =pwrite (fd, buf,4096 ,0 ); +if (rc <4096 ) { + rc = -ENXIO ; +fprintf (stderr,"%s: failed to overwrite btt on %s\n" , + devname, bdev); + } out:ndctl_region_set_ro (region, namespace->ro);ndctl_namespace_set_raw_mode (ndns,0 );
Signature · 6 lines
2.9.3 _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
Quoted 26 lines · Vishal Verma
With the BTT 2.0 update, a couple of minor updates to the unit tests are needed:
test/libndctl: Update expected BTT sizes
test/libndctl: inbtt_autodetect, when wiping an old BTT, wipe the first two 4K pages instead of one.Cc Dan Williams <[email protected]>Signed-off-by Vishal Verma <[email protected]>--- test/libndctl.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)test/libndctl.c +2
-2@@ -994,16 +994,16 @@ static int check_btt_size(struct ndctl_btt *btt)int size_select, sect_select;unsigned long long expect_table[][2 ] = { [0 ] = { - [0 ] =0x11b4400 , - [1 ] =0x8da2000 , + [0 ] =0x11b5400 , + [1 ] =0x8daa000 , }, [1 ] = {
test/libndctl.c static int check_btt_size(struct ndctl_btt *btt) · line 1006
Quoted 10 lines
test/libndctl.c +4
-4- [0] = 0x13b0400, - [1] = 0x9d82000, + [0] = 0x13b1400, + [1] = 0x9d8a000, }, [2] = { - [0] = 0x1aa2600, - [1] = 0xd513000, + [0] = 0x1aa3600, + [1] = 0xd51b000,
I think we need to have different expectations for different BTT versions. We should be able to check for v1.2 labels before picking the expectation, or just have a new ndctl_test_attempt() gate on the 4.13 kernel for the new sizes.
Quoted 10 lines
test/libndctl.c +1
-0}, };@@ -1517,12 +1517,19 @@ static int check_btt_autodetect(struct ndctl_bus *bus, }memset (buf,0 ,4096 ); +/* Delete both the first and second 4K pages */ rc =pwrite (fd, buf,4096 ,4096 );if (rc <4096 ) {
test/libndctl.c static int check_btt_autodetect(struct ndctl_bus *bus, · line 1532
Quoted 10 lines
test/libndctl.c +6
-0rc = -ENXIO ;fprintf (stderr,"%s: failed to overwrite btt on %s\n" , devname, bdev); } + rc =pwrite (fd, buf,4096 ,0 ); +if (rc <4096 ) { + rc = -ENXIO ; +fprintf (stderr,"%s: failed to overwrite btt on %s\n" , + devname, bdev); + }
How about just change the first one to: "rc = pwrite(fd, buf, 8192, 0);"?
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
Vishal Verma
maintainerQuoted 34 lines · Dan Williams
Quoted 33 lines · Vishal Verma
With the BTT 2.0 update, a couple of minor updates to the unit tests are needed:
test/libndctl: Update expected BTT sizes
test/libndctl: inbtt_autodetect, when wiping an old BTT, wipe the first two 4K pages instead of one.Cc Dan Williams <[email protected]>Signed-off-by Vishal Verma <[email protected]>--- test/libndctl.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)test/libndctl.c +4
-5@@ -994,16 +994,16 @@ static int check_btt_size(struct ndctl_btt *btt)int size_select, sect_select;unsigned long long expect_table[][2 ] = { [0 ] = { - [0 ] =0x11b4400 , - [1 ] =0x8da2000 , + [0 ] =0x11b5400 , + [1 ] =0x8daa000 , }, [1 ] = { - [0 ] =0x13b0400 , - [1 ] =0x9d82000 , + [0 ] =0x13b1400 , + [1 ] =0x9d8a000 , }, [2 ] = { - [0 ] =0x1aa2600 ,
Quoted 8 lines
test/libndctl.c static int check_btt_size(struct ndctl_btt *btt) · line 1006
Quoted 3 lines
test/libndctl.c +2
-1- [1] = 0xd513000, + [0] = 0x1aa3600, + [1] = 0xd51b000,I think we need to have different expectations for different BTT versions. We should be able to check for v1.2 labels before picking the expectation, or just have a new
ndctl_test_attempt()gate on the 4.13 kernel for the new sizes.
I'll make the call under a ndctl_test_atttempt. All of nfit_test will switch to 1.2 labels with the next release, so keeping support for 1.1 sizes seems pointless..
Quoted 7 lines
Quoted 7 lines
test/libndctl.c +0
-0}, };@@ -1517,12 +1517,19 @@ static int check_btt_autodetect(struct ndctl_bus *bus, }
Quoted 16 lines
Quoted 4 lines
test/libndctl.c +1
-0memset (buf,0 ,4096 ); +/* Delete both the first and second 4K pages */ rc =pwrite (fd, buf,4096 ,4096 );if (rc <4096 ) {test/libndctl.c static int check_btt_autodetect(struct ndctl_bus *bus, · line 1532
Quoted 10 lines
test/libndctl.c +6
-0rc = -ENXIO ;fprintf (stderr,"%s: failed to overwrite btt on %s\n" , devname, bdev); } + rc =pwrite (fd, buf,4096 ,0 ); +if (rc <4096 ) { + rc = -ENXIO ; +fprintf (stderr,"%s: failed to overwrite btt on %s\n" , + devname, bdev); + }How about just change the first one to: "rc =
pwrite(fd, buf, 8192, 0);"?
The buf that is passed in is only 4096 bytes, so I just took the easy way out and did it twice :)
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm