Commit | Line | Data |
---|---|---|
155e7524 FI |
1 | /* |
2 | * linux/fs/nfs/blocklayout/blocklayout.h | |
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 | #ifndef FS_NFS_NFS4BLOCKLAYOUT_H | |
33 | #define FS_NFS_NFS4BLOCKLAYOUT_H | |
34 | ||
35 | #include <linux/device-mapper.h> | |
36 | #include <linux/nfs_fs.h> | |
37 | #include "../pnfs.h" | |
38 | ||
39 | enum exstate4 { | |
40 | PNFS_BLOCK_READWRITE_DATA = 0, | |
41 | PNFS_BLOCK_READ_DATA = 1, | |
42 | PNFS_BLOCK_INVALID_DATA = 2, /* mapped, but data is invalid */ | |
43 | PNFS_BLOCK_NONE_DATA = 3 /* unmapped, it's a hole */ | |
44 | }; | |
45 | ||
46 | struct pnfs_inval_markings { | |
47 | /* STUB */ | |
48 | }; | |
49 | ||
50 | /* sector_t fields are all in 512-byte sectors */ | |
51 | struct pnfs_block_extent { | |
52 | struct kref be_refcnt; | |
53 | struct list_head be_node; /* link into lseg list */ | |
54 | struct nfs4_deviceid be_devid; /* FIXME: could use device cache instead */ | |
55 | struct block_device *be_mdev; | |
56 | sector_t be_f_offset; /* the starting offset in the file */ | |
57 | sector_t be_length; /* the size of the extent */ | |
58 | sector_t be_v_offset; /* the starting offset in the volume */ | |
59 | enum exstate4 be_state; /* the state of this extent */ | |
60 | struct pnfs_inval_markings *be_inval; /* tracks INVAL->RW transition */ | |
61 | }; | |
62 | ||
63 | static inline void | |
64 | BL_INIT_INVAL_MARKS(struct pnfs_inval_markings *marks, sector_t blocksize) | |
65 | { | |
66 | /* STUB */ | |
67 | } | |
68 | ||
69 | enum extentclass4 { | |
70 | RW_EXTENT = 0, /* READWRTE and INVAL */ | |
71 | RO_EXTENT = 1, /* READ and NONE */ | |
72 | EXTENT_LISTS = 2, | |
73 | }; | |
74 | ||
75 | struct pnfs_block_layout { | |
76 | struct pnfs_layout_hdr bl_layout; | |
77 | struct pnfs_inval_markings bl_inval; /* tracks INVAL->RW transition */ | |
78 | spinlock_t bl_ext_lock; /* Protects list manipulation */ | |
79 | struct list_head bl_extents[EXTENT_LISTS]; /* R and RW extents */ | |
80 | struct list_head bl_commit; /* Needs layout commit */ | |
81 | struct list_head bl_committing; /* Layout committing */ | |
82 | unsigned int bl_count; /* entries in bl_commit */ | |
83 | sector_t bl_blocksize; /* Server blocksize in sectors */ | |
84 | }; | |
85 | ||
86 | static inline struct pnfs_block_layout *BLK_LO2EXT(struct pnfs_layout_hdr *lo) | |
87 | { | |
88 | return container_of(lo, struct pnfs_block_layout, bl_layout); | |
89 | } | |
90 | ||
91 | #endif /* FS_NFS_NFS4BLOCKLAYOUT_H */ |