Skip to content

Commit 8c2f7e8

Browse files
committed
libnvdimm: infrastructure for btt devices
NVDIMM namespaces, in addition to accepting "struct bio" based requests, also have the capability to perform byte-aligned accesses. By default only the bio/block interface is used. However, if another driver can make effective use of the byte-aligned capability it can claim namespace interface and use the byte-aligned ->rw_bytes() interface. The BTT driver is the initial first consumer of this mechanism to allow adding atomic sector update semantics to a pmem or blk namespace. This patch is the sysfs infrastructure to allow configuring a BTT instance for a namespace. Enabling that BTT and performing i/o is in a subsequent patch. Cc: Greg KH <[email protected]> Cc: Neil Brown <[email protected]> Signed-off-by: Dan Williams <[email protected]>
1 parent 0ba1c63 commit 8c2f7e8

File tree

13 files changed

+879
-99
lines changed

13 files changed

+879
-99
lines changed

drivers/nvdimm/Kconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,7 @@ config BLK_DEV_PMEM
3333

3434
Say Y if you want to use an NVDIMM
3535

36+
config BTT
37+
def_bool y
38+
3639
endif

drivers/nvdimm/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ libnvdimm-y += region_devs.o
1111
libnvdimm-y += region.o
1212
libnvdimm-y += namespace_devs.o
1313
libnvdimm-y += label.o
14+
libnvdimm-$(CONFIG_BTT) += btt_devs.o

drivers/nvdimm/btt.h

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Block Translation Table library
3+
* Copyright (c) 2014-2015, Intel Corporation.
4+
*
5+
* This program is free software; you can redistribute it and/or modify it
6+
* under the terms and conditions of the GNU General Public License,
7+
* version 2, as published by the Free Software Foundation.
8+
*
9+
* This program is distributed in the hope it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12+
* more details.
13+
*/
14+
15+
#ifndef _LINUX_BTT_H
16+
#define _LINUX_BTT_H
17+
18+
#include <linux/types.h>
19+
20+
#define BTT_SIG_LEN 16
21+
#define BTT_SIG "BTT_ARENA_INFO\0"
22+
23+
struct btt_sb {
24+
u8 signature[BTT_SIG_LEN];
25+
u8 uuid[16];
26+
u8 parent_uuid[16];
27+
__le32 flags;
28+
__le16 version_major;
29+
__le16 version_minor;
30+
__le32 external_lbasize;
31+
__le32 external_nlba;
32+
__le32 internal_lbasize;
33+
__le32 internal_nlba;
34+
__le32 nfree;
35+
__le32 infosize;
36+
__le64 nextoff;
37+
__le64 dataoff;
38+
__le64 mapoff;
39+
__le64 logoff;
40+
__le64 info2off;
41+
u8 padding[3968];
42+
__le64 checksum;
43+
};
44+
45+
#endif

0 commit comments

Comments
 (0)