aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorBoaz Harrosh <bharrosh@panasas.com>2011-08-06 22:26:31 -0400
committerBoaz Harrosh <bharrosh@panasas.com>2011-08-06 22:36:18 -0400
commit8ff660ab85f524bdc7652eb5d38aaef1d66aa9c7 (patch)
treec4a29cde4fc8654ae00e65cb520e13f9fe7f4e08 /include
parent9e9db45649eb5d3ee5622fdad741914ecf1016a0 (diff)
exofs: Rename raid engine from exofs/ios.c => ore
ORE stands for "Objects Raid Engine" This patch is a mechanical rename of everything that was in ios.c and its API declaration to an ore.c and an osd_ore.h header. The ore engine will later be used by the pnfs objects layout driver. * File ios.c => ore.c * Declaration of types and API are moved from exofs.h to a new osd_ore.h * All used types are prefixed by ore_ from their exofs_ name. * Shift includes from exofs.h to osd_ore.h so osd_ore.h is independent, include it from exofs.h. Other than a pure rename there are no other changes. Next patch will move the ore into it's own module and will export the API to be used by exofs and later the layout driver Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Diffstat (limited to 'include')
-rw-r--r--include/scsi/osd_ore.h125
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
30struct ore_comp {
31 struct osd_obj_id obj;
32 u8 cred[OSD_CAP_LEN];
33};
34
35struct 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
45struct 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
57struct ore_io_state;
58typedef void (*ore_io_done_fn)(struct ore_io_state *ios, void *private);
59
60struct 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
98static 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 */
105int 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);
108int ore_get_io_state(struct ore_layout *layout, struct ore_components *comps,
109 struct ore_io_state **ios);
110void ore_put_io_state(struct ore_io_state *ios);
111
112int ore_check_io(struct ore_io_state *ios, u64 *resid);
113
114int ore_create(struct ore_io_state *ios);
115int ore_remove(struct ore_io_state *ios);
116int ore_write(struct ore_io_state *ios);
117int ore_read(struct ore_io_state *ios);
118int ore_truncate(struct ore_layout *layout, struct ore_components *comps,
119 u64 size);
120
121int extract_attr_from_ios(struct ore_io_state *ios, struct osd_attr *attr);
122
123extern const struct osd_attr g_attr_logical_length;
124
125#endif