Skip to content

Commit

Permalink
libnvdimm, btt: update the usage section in Documentation
Browse files Browse the repository at this point in the history
Section 5 about BTT's in kernel usage was quite obsolete,
replace it with a simple 'Usage' section that describes how
to set up a BTT namespace using the 'ndctl' utility.

Signed-off-by: Vishal Verma <[email protected]>
Signed-off-by: Dan Williams <[email protected]>
  • Loading branch information
stellarhopper authored and djbw committed Jun 17, 2016
1 parent f02716d commit 0aefa05
Showing 1 changed file with 9 additions and 19 deletions.
28 changes: 9 additions & 19 deletions Documentation/nvdimm/btt.txt
Original file line number Diff line number Diff line change
Expand Up @@ -256,28 +256,18 @@ If any of these error conditions are encountered, the arena is put into a read
only state using a flag in the info block.


5. In-kernel usage
==================
5. Usage
========

Any block driver that supports byte granularity IO to the storage may register
with the BTT. It will have to provide the rw_bytes interface in its
block_device_operations struct:
The BTT can be set up on any disk (namespace) exposed by the libnvdimm subsystem
(pmem, or blk mode). The easiest way to set up such a namespace is using the
'ndctl' utility [1]:

int (*rw_bytes)(struct gendisk *, void *, size_t, off_t, int rw);
For example, the ndctl command line to setup a btt with a 4k sector size is:

It may register with the BTT after it adds its own gendisk, using btt_init:
ndctl create-namespace -f -e namespace0.0 -m sector -l 4k

struct btt *btt_init(struct gendisk *disk, unsigned long long rawsize,
u32 lbasize, u8 uuid[], int maxlane);
See ndctl create-namespace --help for more options.

note that maxlane is the maximum amount of concurrency the driver wishes to
allow the BTT to use.

The BTT 'disk' appears as a stacked block device that grabs the underlying block
device in the O_EXCL mode.

When the driver wishes to remove the backing disk, it should similarly call
btt_fini using the same struct btt* handle that was provided to it by btt_init.

void btt_fini(struct btt *btt);
[1]: https://github.com/pmem/ndctl

0 comments on commit 0aefa05

Please sign in to comment.