aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/blocklayout/blocklayout.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/blocklayout/blocklayout.h')
-rw-r--r--fs/nfs/blocklayout/blocklayout.h83
1 files changed, 77 insertions, 6 deletions
diff --git a/fs/nfs/blocklayout/blocklayout.h b/fs/nfs/blocklayout/blocklayout.h
index c98d98a62664..92dca9e90d8d 100644
--- a/fs/nfs/blocklayout/blocklayout.h
+++ b/fs/nfs/blocklayout/blocklayout.h
@@ -44,9 +44,77 @@
44#define PAGE_CACHE_SECTOR_SHIFT (PAGE_CACHE_SHIFT - SECTOR_SHIFT) 44#define PAGE_CACHE_SECTOR_SHIFT (PAGE_CACHE_SHIFT - SECTOR_SHIFT)
45#define SECTOR_SIZE (1 << SECTOR_SHIFT) 45#define SECTOR_SIZE (1 << SECTOR_SHIFT)
46 46
47struct pnfs_block_dev;
48
49enum pnfs_block_volume_type {
50 PNFS_BLOCK_VOLUME_SIMPLE = 0,
51 PNFS_BLOCK_VOLUME_SLICE = 1,
52 PNFS_BLOCK_VOLUME_CONCAT = 2,
53 PNFS_BLOCK_VOLUME_STRIPE = 3,
54};
55
56#define PNFS_BLOCK_MAX_UUIDS 4
57#define PNFS_BLOCK_MAX_DEVICES 64
58
59/*
60 * Random upper cap for the uuid length to avoid unbounded allocation.
61 * Not actually limited by the protocol.
62 */
63#define PNFS_BLOCK_UUID_LEN 128
64
65
66struct pnfs_block_volume {
67 enum pnfs_block_volume_type type;
68 union {
69 struct {
70 int len;
71 int nr_sigs;
72 struct {
73 u64 offset;
74 u32 sig_len;
75 u8 sig[PNFS_BLOCK_UUID_LEN];
76 } sigs[PNFS_BLOCK_MAX_UUIDS];
77 } simple;
78 struct {
79 u64 start;
80 u64 len;
81 u32 volume;
82 } slice;
83 struct {
84 u32 volumes_count;
85 u32 volumes[PNFS_BLOCK_MAX_DEVICES];
86 } concat;
87 struct {
88 u64 chunk_size;
89 u32 volumes_count;
90 u32 volumes[PNFS_BLOCK_MAX_DEVICES];
91 } stripe;
92 };
93};
94
95struct pnfs_block_dev_map {
96 sector_t start;
97 sector_t len;
98
99 sector_t disk_offset;
100 struct block_device *bdev;
101};
102
47struct pnfs_block_dev { 103struct pnfs_block_dev {
48 struct nfs4_deviceid_node d_node; 104 struct nfs4_deviceid_node node;
49 struct block_device *d_bdev; 105
106 u64 start;
107 u64 len;
108
109 u32 nr_children;
110 struct pnfs_block_dev *children;
111 u64 chunk_size;
112
113 struct block_device *bdev;
114 u64 disk_offset;
115
116 bool (*map)(struct pnfs_block_dev *dev, u64 offset,
117 struct pnfs_block_dev_map *map);
50}; 118};
51 119
52enum exstate4 { 120enum exstate4 {
@@ -110,6 +178,11 @@ struct bl_msg_hdr {
110#define BL_DEVICE_REQUEST_PROC 0x1 /* User level process succeeds */ 178#define BL_DEVICE_REQUEST_PROC 0x1 /* User level process succeeds */
111#define BL_DEVICE_REQUEST_ERR 0x2 /* User level process fails */ 179#define BL_DEVICE_REQUEST_ERR 0x2 /* User level process fails */
112 180
181/* dev.c */
182struct nfs4_deviceid_node *bl_alloc_deviceid_node(struct nfs_server *server,
183 struct pnfs_device *pdev, gfp_t gfp_mask);
184void bl_free_deviceid_node(struct nfs4_deviceid_node *d);
185
113/* extent_tree.c */ 186/* extent_tree.c */
114int ext_tree_insert(struct pnfs_block_layout *bl, 187int ext_tree_insert(struct pnfs_block_layout *bl,
115 struct pnfs_block_extent *new); 188 struct pnfs_block_extent *new);
@@ -123,10 +196,8 @@ int ext_tree_prepare_commit(struct nfs4_layoutcommit_args *arg);
123void ext_tree_mark_committed(struct nfs4_layoutcommit_args *arg, int status); 196void ext_tree_mark_committed(struct nfs4_layoutcommit_args *arg, int status);
124 197
125/* rpc_pipefs.c */ 198/* rpc_pipefs.c */
126struct nfs4_deviceid_node *bl_alloc_deviceid_node(struct nfs_server *server, 199dev_t bl_resolve_deviceid(struct nfs_server *server,
127 struct pnfs_device *pdev, gfp_t gfp_mask); 200 struct pnfs_block_volume *b, gfp_t gfp_mask);
128void bl_free_deviceid_node(struct nfs4_deviceid_node *d);
129
130int __init bl_init_pipefs(void); 201int __init bl_init_pipefs(void);
131void __exit bl_cleanup_pipefs(void); 202void __exit bl_cleanup_pipefs(void);
132 203