3 * Boaz Harrosh <bharrosh@panasas.com>
5 * Public Declarations of the ORE API
7 * This file is part of the ORE (Object Raid Engine) library.
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)
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.
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
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>
31 struct osd_obj_id obj;
36 /* Our way of looking at the data_map */
37 enum pnfs_osd_raid_algorithm4
51 struct ore_components {
52 unsigned numdevs; /* Num of devices in array */
53 /* If @single_comp == EC_SINGLE_COMP, @comps points to a single
54 * component. else there are @numdevs components
57 EC_SINGLE_COMP = 0, EC_MULTPLE_COMPS = 0xffffffff
59 struct ore_comp *comps;
61 /* Array of pointers to ore_dev-* . User will usually have these pointed
62 * too a bigger struct which contain an "ore_dev ored" member and use
63 * container_of(oc->ods[i], struct foo_dev, ored) to access the bigger
69 /* ore_comp_dev Recievies a logical device index */
70 static inline struct osd_dev *ore_comp_dev(
71 const struct ore_components *oc, unsigned i)
73 BUG_ON(oc->numdevs <= i);
74 return oc->ods[i]->od;
77 static inline void ore_comp_set_dev(
78 struct ore_components *oc, unsigned i, struct osd_dev *od)
83 struct ore_striping_info {
86 u64 M; /* for truncate */
92 typedef void (*ore_io_done_fn)(struct ore_io_state *ios, void *private);
96 struct ore_striping_info si;
101 struct ore_layout *layout;
102 struct ore_components *oc;
104 /* Global read/write IO*/
106 unsigned long length;
112 unsigned pages_consumed;
115 unsigned in_attr_len;
116 struct osd_attr *in_attr;
117 unsigned out_attr_len;
118 struct osd_attr *out_attr;
122 /* Variable array of size numdevs */
124 struct ore_per_dev_state {
125 struct osd_request *or;
133 static inline unsigned ore_io_state_size(unsigned numdevs)
135 return sizeof(struct ore_io_state) +
136 sizeof(struct ore_per_dev_state) * numdevs;
140 int ore_get_rw_state(struct ore_layout *layout, struct ore_components *comps,
141 bool is_reading, u64 offset, u64 length,
142 struct ore_io_state **ios);
143 int ore_get_io_state(struct ore_layout *layout, struct ore_components *comps,
144 struct ore_io_state **ios);
145 void ore_put_io_state(struct ore_io_state *ios);
147 int ore_check_io(struct ore_io_state *ios, u64 *resid);
149 int ore_create(struct ore_io_state *ios);
150 int ore_remove(struct ore_io_state *ios);
151 int ore_write(struct ore_io_state *ios);
152 int ore_read(struct ore_io_state *ios);
153 int ore_truncate(struct ore_layout *layout, struct ore_components *comps,
156 int extract_attr_from_ios(struct ore_io_state *ios, struct osd_attr *attr);
158 extern const struct osd_attr g_attr_logical_length;