diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-08-07 01:56:03 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-08-07 01:56:03 -0400 |
commit | c2f340a69cabe0fb7b9f02d1a2495927db225a06 (patch) | |
tree | dd9bc3125f833adf163c47542917ebc18b1acc56 /include/scsi | |
parent | 3ddcd0569cd68f00f3beae9a7959b72918bb91f4 (diff) | |
parent | cf283ade08c454e884394a4720f22421dd33a715 (diff) |
Merge branch 'for-linus' of git://git.open-osd.org/linux-open-osd
* 'for-linus' of git://git.open-osd.org/linux-open-osd:
ore: Make ore its own module
exofs: Rename raid engine from exofs/ios.c => ore
exofs: ios: Move to a per inode components & device-table
exofs: Move exofs specific osd operations out of ios.c
exofs: Add offset/length to exofs_get_io_state
exofs: Fix truncate for the raid-groups case
exofs: Small cleanup of exofs_fill_super
exofs: BUG: Avoid sbi realloc
exofs: Remove pnfs-osd private definitions
nfs_xdr: Move nfs4_string definition out of #ifdef CONFIG_NFS_V4
Diffstat (limited to 'include/scsi')
-rw-r--r-- | include/scsi/osd_ore.h | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/include/scsi/osd_ore.h b/include/scsi/osd_ore.h new file mode 100644 index 000000000000..c5c5e008e6de --- /dev/null +++ b/include/scsi/osd_ore.h | |||
@@ -0,0 +1,125 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011 | ||
3 | * Boaz Harrosh <bharrosh@panasas.com> | ||
4 | * | ||
5 | * Public Declarations of the ORE API | ||
6 | * | ||
7 | * This file is part of the ORE (Object Raid Engine) library. | ||
8 | * | ||
9 | * ORE is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License version 2 as published | ||
11 | * by the Free Software Foundation. (GPL v2) | ||
12 | * | ||
13 | * ORE is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with the ORE; if not, write to the Free Software | ||
20 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
21 | */ | ||
22 | #ifndef __ORE_H__ | ||
23 | #define __ORE_H__ | ||
24 | |||
25 | #include <scsi/osd_initiator.h> | ||
26 | #include <scsi/osd_attributes.h> | ||
27 | #include <scsi/osd_sec.h> | ||
28 | #include <linux/pnfs_osd_xdr.h> | ||
29 | |||
30 | struct ore_comp { | ||
31 | struct osd_obj_id obj; | ||
32 | u8 cred[OSD_CAP_LEN]; | ||
33 | }; | ||
34 | |||
35 | struct ore_layout { | ||
36 | /* Our way of looking at the data_map */ | ||
37 | unsigned stripe_unit; | ||
38 | unsigned mirrors_p1; | ||
39 | |||
40 | unsigned group_width; | ||
41 | u64 group_depth; | ||
42 | unsigned group_count; | ||
43 | }; | ||
44 | |||
45 | struct ore_components { | ||
46 | unsigned numdevs; /* Num of devices in array */ | ||
47 | /* If @single_comp == EC_SINGLE_COMP, @comps points to a single | ||
48 | * component. else there are @numdevs components | ||
49 | */ | ||
50 | enum EC_COMP_USAGE { | ||
51 | EC_SINGLE_COMP = 0, EC_MULTPLE_COMPS = 0xffffffff | ||
52 | } single_comp; | ||
53 | struct ore_comp *comps; | ||
54 | struct osd_dev **ods; /* osd_dev array */ | ||
55 | }; | ||
56 | |||
57 | struct ore_io_state; | ||
58 | typedef void (*ore_io_done_fn)(struct ore_io_state *ios, void *private); | ||
59 | |||
60 | struct ore_io_state { | ||
61 | struct kref kref; | ||
62 | |||
63 | void *private; | ||
64 | ore_io_done_fn done; | ||
65 | |||
66 | struct ore_layout *layout; | ||
67 | struct ore_components *comps; | ||
68 | |||
69 | /* Global read/write IO*/ | ||
70 | loff_t offset; | ||
71 | unsigned long length; | ||
72 | void *kern_buff; | ||
73 | |||
74 | struct page **pages; | ||
75 | unsigned nr_pages; | ||
76 | unsigned pgbase; | ||
77 | unsigned pages_consumed; | ||
78 | |||
79 | /* Attributes */ | ||
80 | unsigned in_attr_len; | ||
81 | struct osd_attr *in_attr; | ||
82 | unsigned out_attr_len; | ||
83 | struct osd_attr *out_attr; | ||
84 | |||
85 | bool reading; | ||
86 | |||
87 | /* Variable array of size numdevs */ | ||
88 | unsigned numdevs; | ||
89 | struct ore_per_dev_state { | ||
90 | struct osd_request *or; | ||
91 | struct bio *bio; | ||
92 | loff_t offset; | ||
93 | unsigned length; | ||
94 | unsigned dev; | ||
95 | } per_dev[]; | ||
96 | }; | ||
97 | |||
98 | static inline unsigned ore_io_state_size(unsigned numdevs) | ||
99 | { | ||
100 | return sizeof(struct ore_io_state) + | ||
101 | sizeof(struct ore_per_dev_state) * numdevs; | ||
102 | } | ||
103 | |||
104 | /* ore.c */ | ||
105 | int ore_get_rw_state(struct ore_layout *layout, struct ore_components *comps, | ||
106 | bool is_reading, u64 offset, u64 length, | ||
107 | struct ore_io_state **ios); | ||
108 | int ore_get_io_state(struct ore_layout *layout, struct ore_components *comps, | ||
109 | struct ore_io_state **ios); | ||
110 | void ore_put_io_state(struct ore_io_state *ios); | ||
111 | |||
112 | int ore_check_io(struct ore_io_state *ios, u64 *resid); | ||
113 | |||
114 | int ore_create(struct ore_io_state *ios); | ||
115 | int ore_remove(struct ore_io_state *ios); | ||
116 | int ore_write(struct ore_io_state *ios); | ||
117 | int ore_read(struct ore_io_state *ios); | ||
118 | int ore_truncate(struct ore_layout *layout, struct ore_components *comps, | ||
119 | u64 size); | ||
120 | |||
121 | int extract_attr_from_ios(struct ore_io_state *ios, struct osd_attr *attr); | ||
122 | |||
123 | extern const struct osd_attr g_attr_logical_length; | ||
124 | |||
125 | #endif | ||