On Tue, 2017-05-02 at 13:54 -0700, Dan Williams wrote: > On Tue, May 2, 2017 at 1:26 PM, Dave Jiang <[email protected]> > wrote: : > > +read sector len < > > /sys/bus/platform/devices/nfit_test.0/$dev/$region/badblocks > > +echo "sector: $sector len: $len" > > + > > +# clearing using ndctl > > +$NDCTL clear-error -f /dev/$chardev -s $sector -l $len > > Ok, so I'm glad you wrote this test it highlights one mismatched > assumption. The "ndctl clear-error" options should be device- > relative "sector" offsets not region offsets. So, "ndctl clear-error > /dev/dev0.0 -s 0" should clear device-dax instance offset 0, not > region offset 0 A device-dax instance starts at an offset from the > namespace, and the namespace may start anywhere within a region. So > the clear-error command needs to translate that device-dax sector > offset to the region offset. device-dax offset to namespace offset > can be calculated by subtracting the device-dax instance size from > the namespace size, the namespace offset can be calculated by > subtracting the region resource base from the namespace resource > base. Now, the difficulty will be that the resource values for > nfit_test are garbage because they are vmalloc'd based, I need to > give that some thought...
Using device-relative sector makes sense, but how does user come up with this sector number when sysfs only provides regionN/badblocks? Thanks, -Toshi _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
