diff options
author | Fred Isaman <iisaman@citi.umich.edu> | 2011-07-30 20:52:39 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2011-07-31 12:18:15 -0400 |
commit | 155e7524f28fa374da041434085050693c3df45b (patch) | |
tree | 24a3940f5a2944754e9b631e247377cb352306b3 /fs/nfs/blocklayout/blocklayout.c | |
parent | db29c089094b2e686ebc9ed9f002be4a4f94b1f8 (diff) |
pnfsblock: add blocklayout Kconfig option, Makefile, and stubs
Define a configuration variable to enable/disable compilation of the
block driver code.
Add the minimal structure for a pnfs block layout driver, and empty
list-heads that will hold the extent data
[pnfsblock: make NFS_V4_1 select PNFS_BLOCK]
Signed-off-by: Peng Tao <peng_tao@emc.com>
Signed-off-by: Fred Isaman <iisaman@citi.umich.edu>
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
[pnfs-block: fix CONFIG_PNFS_BLOCK dependencies]
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
Signed-off-by: Benny Halevy <bhalevy@tonian.com>
[pnfsblock: SQUASHME: adjust to API change]
Signed-off-by: Fred Isaman <iisaman@citi.umich.edu>
[pnfs: move pnfs_layout_type inline in nfs_inode]
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
[blocklayout: encode_layoutcommit implementation]
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
Signed-off-by: Benny Halevy <bhalevy@tonian.com>
[pnfsblock: layout alloc and free]
Signed-off-by: Fred Isaman <iisaman@citi.umich.edu>
[pnfs: move pnfs_layout_type inline in nfs_inode]
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
Signed-off-by: Benny Halevy <bhalevy@tonian.com>
[pnfsblock: define module alias]
Signed-off-by: Peng Tao <peng_tao@emc.com>
[rm inode and pnfs_layout_hdr args from cleanup_layoutcommit()]
Signed-off-by: Jim Rees <rees@umich.edu>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/blocklayout/blocklayout.c')
-rw-r--r-- | fs/nfs/blocklayout/blocklayout.c | 174 |
1 files changed, 174 insertions, 0 deletions
diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c new file mode 100644 index 000000000000..44562cbbe394 --- /dev/null +++ b/fs/nfs/blocklayout/blocklayout.c | |||
@@ -0,0 +1,174 @@ | |||
1 | /* | ||
2 | * linux/fs/nfs/blocklayout/blocklayout.c | ||
3 | * | ||
4 | * Module for the NFSv4.1 pNFS block layout driver. | ||
5 | * | ||
6 | * Copyright (c) 2006 The Regents of the University of Michigan. | ||
7 | * All rights reserved. | ||
8 | * | ||
9 | * Andy Adamson <andros@citi.umich.edu> | ||
10 | * Fred Isaman <iisaman@umich.edu> | ||
11 | * | ||
12 | * permission is granted to use, copy, create derivative works and | ||
13 | * redistribute this software and such derivative works for any purpose, | ||
14 | * so long as the name of the university of michigan is not used in | ||
15 | * any advertising or publicity pertaining to the use or distribution | ||
16 | * of this software without specific, written prior authorization. if | ||
17 | * the above copyright notice or any other identification of the | ||
18 | * university of michigan is included in any copy of any portion of | ||
19 | * this software, then the disclaimer below must also be included. | ||
20 | * | ||
21 | * this software is provided as is, without representation from the | ||
22 | * university of michigan as to its fitness for any purpose, and without | ||
23 | * warranty by the university of michigan of any kind, either express | ||
24 | * or implied, including without limitation the implied warranties of | ||
25 | * merchantability and fitness for a particular purpose. the regents | ||
26 | * of the university of michigan shall not be liable for any damages, | ||
27 | * including special, indirect, incidental, or consequential damages, | ||
28 | * with respect to any claim arising out or in connection with the use | ||
29 | * of the software, even if it has been or is hereafter advised of the | ||
30 | * possibility of such damages. | ||
31 | */ | ||
32 | #include <linux/module.h> | ||
33 | #include <linux/init.h> | ||
34 | |||
35 | #include "blocklayout.h" | ||
36 | |||
37 | #define NFSDBG_FACILITY NFSDBG_PNFS_LD | ||
38 | |||
39 | MODULE_LICENSE("GPL"); | ||
40 | MODULE_AUTHOR("Andy Adamson <andros@citi.umich.edu>"); | ||
41 | MODULE_DESCRIPTION("The NFSv4.1 pNFS Block layout driver"); | ||
42 | |||
43 | static enum pnfs_try_status | ||
44 | bl_read_pagelist(struct nfs_read_data *rdata) | ||
45 | { | ||
46 | return PNFS_NOT_ATTEMPTED; | ||
47 | } | ||
48 | |||
49 | static enum pnfs_try_status | ||
50 | bl_write_pagelist(struct nfs_write_data *wdata, | ||
51 | int sync) | ||
52 | { | ||
53 | return PNFS_NOT_ATTEMPTED; | ||
54 | } | ||
55 | |||
56 | /* STUB */ | ||
57 | static void | ||
58 | release_extents(struct pnfs_block_layout *bl, | ||
59 | struct pnfs_layout_range *range) | ||
60 | { | ||
61 | return; | ||
62 | } | ||
63 | |||
64 | /* STUB */ | ||
65 | static void | ||
66 | release_inval_marks(struct pnfs_inval_markings *marks) | ||
67 | { | ||
68 | return; | ||
69 | } | ||
70 | |||
71 | static void bl_free_layout_hdr(struct pnfs_layout_hdr *lo) | ||
72 | { | ||
73 | struct pnfs_block_layout *bl = BLK_LO2EXT(lo); | ||
74 | |||
75 | dprintk("%s enter\n", __func__); | ||
76 | release_extents(bl, NULL); | ||
77 | release_inval_marks(&bl->bl_inval); | ||
78 | kfree(bl); | ||
79 | } | ||
80 | |||
81 | static struct pnfs_layout_hdr *bl_alloc_layout_hdr(struct inode *inode, | ||
82 | gfp_t gfp_flags) | ||
83 | { | ||
84 | struct pnfs_block_layout *bl; | ||
85 | |||
86 | dprintk("%s enter\n", __func__); | ||
87 | bl = kzalloc(sizeof(*bl), gfp_flags); | ||
88 | if (!bl) | ||
89 | return NULL; | ||
90 | spin_lock_init(&bl->bl_ext_lock); | ||
91 | INIT_LIST_HEAD(&bl->bl_extents[0]); | ||
92 | INIT_LIST_HEAD(&bl->bl_extents[1]); | ||
93 | INIT_LIST_HEAD(&bl->bl_commit); | ||
94 | INIT_LIST_HEAD(&bl->bl_committing); | ||
95 | bl->bl_count = 0; | ||
96 | bl->bl_blocksize = NFS_SERVER(inode)->pnfs_blksize >> SECTOR_SHIFT; | ||
97 | BL_INIT_INVAL_MARKS(&bl->bl_inval, bl->bl_blocksize); | ||
98 | return &bl->bl_layout; | ||
99 | } | ||
100 | |||
101 | static void | ||
102 | bl_free_lseg(struct pnfs_layout_segment *lseg) | ||
103 | { | ||
104 | } | ||
105 | |||
106 | static struct pnfs_layout_segment * | ||
107 | bl_alloc_lseg(struct pnfs_layout_hdr *lo, | ||
108 | struct nfs4_layoutget_res *lgr, gfp_t gfp_flags) | ||
109 | { | ||
110 | return NULL; | ||
111 | } | ||
112 | |||
113 | static void | ||
114 | bl_encode_layoutcommit(struct pnfs_layout_hdr *lo, struct xdr_stream *xdr, | ||
115 | const struct nfs4_layoutcommit_args *arg) | ||
116 | { | ||
117 | } | ||
118 | |||
119 | static void | ||
120 | bl_cleanup_layoutcommit(struct nfs4_layoutcommit_data *lcdata) | ||
121 | { | ||
122 | } | ||
123 | |||
124 | static int | ||
125 | bl_set_layoutdriver(struct nfs_server *server, const struct nfs_fh *fh) | ||
126 | { | ||
127 | dprintk("%s enter\n", __func__); | ||
128 | return 0; | ||
129 | } | ||
130 | |||
131 | static int | ||
132 | bl_clear_layoutdriver(struct nfs_server *server) | ||
133 | { | ||
134 | dprintk("%s enter\n", __func__); | ||
135 | return 0; | ||
136 | } | ||
137 | |||
138 | static struct pnfs_layoutdriver_type blocklayout_type = { | ||
139 | .id = LAYOUT_BLOCK_VOLUME, | ||
140 | .name = "LAYOUT_BLOCK_VOLUME", | ||
141 | .read_pagelist = bl_read_pagelist, | ||
142 | .write_pagelist = bl_write_pagelist, | ||
143 | .alloc_layout_hdr = bl_alloc_layout_hdr, | ||
144 | .free_layout_hdr = bl_free_layout_hdr, | ||
145 | .alloc_lseg = bl_alloc_lseg, | ||
146 | .free_lseg = bl_free_lseg, | ||
147 | .encode_layoutcommit = bl_encode_layoutcommit, | ||
148 | .cleanup_layoutcommit = bl_cleanup_layoutcommit, | ||
149 | .set_layoutdriver = bl_set_layoutdriver, | ||
150 | .clear_layoutdriver = bl_clear_layoutdriver, | ||
151 | }; | ||
152 | |||
153 | static int __init nfs4blocklayout_init(void) | ||
154 | { | ||
155 | int ret; | ||
156 | |||
157 | dprintk("%s: NFSv4 Block Layout Driver Registering...\n", __func__); | ||
158 | |||
159 | ret = pnfs_register_layoutdriver(&blocklayout_type); | ||
160 | return ret; | ||
161 | } | ||
162 | |||
163 | static void __exit nfs4blocklayout_exit(void) | ||
164 | { | ||
165 | dprintk("%s: NFSv4 Block Layout Driver Unregistering...\n", | ||
166 | __func__); | ||
167 | |||
168 | pnfs_unregister_layoutdriver(&blocklayout_type); | ||
169 | } | ||
170 | |||
171 | MODULE_ALIAS("nfs-layouttype4-3"); | ||
172 | |||
173 | module_init(nfs4blocklayout_init); | ||
174 | module_exit(nfs4blocklayout_exit); | ||