diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-10-26 15:33:50 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-10-26 15:33:50 -0400 |
commit | c28cfd60e4ec3f494b73ef7d6c661f5f491cd84f (patch) | |
tree | 390c23c07b4f484528b6fa5a72bae1b879df35b1 /include | |
parent | dfa4a423cf80afe8f81a36d8e663961c4acca343 (diff) | |
parent | 44231e686b2ba3b5702db867bb84e6d76b7cf2c7 (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: (21 commits)
ore: Enable RAID5 mounts
exofs: Support for RAID5 read-4-write interface.
ore: RAID5 Write
ore: RAID5 read
fs/Makefile: Always inspect exofs/
ore: Make ore_calc_stripe_info EXPORT_SYMBOL
ore/exofs: Change ore_check_io API
ore/exofs: Define new ore_verify_layout
ore: Support for partial component table
ore: Support for short read/writes
exofs: Support for short read/writes
ore: Remove check for ios->kern_buff in _prepare_for_striping to later
ore: cleanup: Embed an ore_striping_info inside ore_io_state
ore: Only IO one group at a time (API change)
ore/exofs: Change the type of the devices array (API change)
ore: Make ore_striping_info and ore_calc_stripe_info public
exofs: Remove unused data_map member from exofs_sb_info
exofs: Rename struct ore_components comps => oc
exofs/super.c: local functions should be static
exofs/ore.c: local functions should be static
...
Diffstat (limited to 'include')
-rw-r--r-- | include/scsi/osd_ore.h | 80 |
1 files changed, 77 insertions, 3 deletions
diff --git a/include/scsi/osd_ore.h b/include/scsi/osd_ore.h index c5c5e008e6de..f05fa826f89e 100644 --- a/include/scsi/osd_ore.h +++ b/include/scsi/osd_ore.h | |||
@@ -34,15 +34,30 @@ struct ore_comp { | |||
34 | 34 | ||
35 | struct ore_layout { | 35 | struct ore_layout { |
36 | /* Our way of looking at the data_map */ | 36 | /* Our way of looking at the data_map */ |
37 | enum pnfs_osd_raid_algorithm4 | ||
38 | raid_algorithm; | ||
37 | unsigned stripe_unit; | 39 | unsigned stripe_unit; |
38 | unsigned mirrors_p1; | 40 | unsigned mirrors_p1; |
39 | 41 | ||
40 | unsigned group_width; | 42 | unsigned group_width; |
43 | unsigned parity; | ||
41 | u64 group_depth; | 44 | u64 group_depth; |
42 | unsigned group_count; | 45 | unsigned group_count; |
46 | |||
47 | /* Cached often needed calculations filled in by | ||
48 | * ore_verify_layout | ||
49 | */ | ||
50 | unsigned long max_io_length; /* Max length that should be passed to | ||
51 | * ore_get_rw_state | ||
52 | */ | ||
53 | }; | ||
54 | |||
55 | struct ore_dev { | ||
56 | struct osd_dev *od; | ||
43 | }; | 57 | }; |
44 | 58 | ||
45 | struct ore_components { | 59 | struct ore_components { |
60 | unsigned first_dev; /* First logical device no */ | ||
46 | unsigned numdevs; /* Num of devices in array */ | 61 | unsigned numdevs; /* Num of devices in array */ |
47 | /* If @single_comp == EC_SINGLE_COMP, @comps points to a single | 62 | /* If @single_comp == EC_SINGLE_COMP, @comps points to a single |
48 | * component. else there are @numdevs components | 63 | * component. else there are @numdevs components |
@@ -51,20 +66,60 @@ struct ore_components { | |||
51 | EC_SINGLE_COMP = 0, EC_MULTPLE_COMPS = 0xffffffff | 66 | EC_SINGLE_COMP = 0, EC_MULTPLE_COMPS = 0xffffffff |
52 | } single_comp; | 67 | } single_comp; |
53 | struct ore_comp *comps; | 68 | struct ore_comp *comps; |
54 | struct osd_dev **ods; /* osd_dev array */ | 69 | |
70 | /* Array of pointers to ore_dev-* . User will usually have these pointed | ||
71 | * too a bigger struct which contain an "ore_dev ored" member and use | ||
72 | * container_of(oc->ods[i], struct foo_dev, ored) to access the bigger | ||
73 | * structure. | ||
74 | */ | ||
75 | struct ore_dev **ods; | ||
76 | }; | ||
77 | |||
78 | /* ore_comp_dev Recievies a logical device index */ | ||
79 | static inline struct osd_dev *ore_comp_dev( | ||
80 | const struct ore_components *oc, unsigned i) | ||
81 | { | ||
82 | BUG_ON((i < oc->first_dev) || (oc->first_dev + oc->numdevs <= i)); | ||
83 | return oc->ods[i - oc->first_dev]->od; | ||
84 | } | ||
85 | |||
86 | static inline void ore_comp_set_dev( | ||
87 | struct ore_components *oc, unsigned i, struct osd_dev *od) | ||
88 | { | ||
89 | oc->ods[i - oc->first_dev]->od = od; | ||
90 | } | ||
91 | |||
92 | struct ore_striping_info { | ||
93 | u64 offset; | ||
94 | u64 obj_offset; | ||
95 | u64 length; | ||
96 | u64 first_stripe_start; /* only used in raid writes */ | ||
97 | u64 M; /* for truncate */ | ||
98 | unsigned bytes_in_stripe; | ||
99 | unsigned dev; | ||
100 | unsigned par_dev; | ||
101 | unsigned unit_off; | ||
102 | unsigned cur_pg; | ||
103 | unsigned cur_comp; | ||
55 | }; | 104 | }; |
56 | 105 | ||
57 | struct ore_io_state; | 106 | struct ore_io_state; |
58 | typedef void (*ore_io_done_fn)(struct ore_io_state *ios, void *private); | 107 | typedef void (*ore_io_done_fn)(struct ore_io_state *ios, void *private); |
108 | struct _ore_r4w_op { | ||
109 | /* @Priv given here is passed ios->private */ | ||
110 | struct page * (*get_page)(void *priv, u64 page_index, bool *uptodate); | ||
111 | void (*put_page)(void *priv, struct page *page); | ||
112 | }; | ||
59 | 113 | ||
60 | struct ore_io_state { | 114 | struct ore_io_state { |
61 | struct kref kref; | 115 | struct kref kref; |
116 | struct ore_striping_info si; | ||
62 | 117 | ||
63 | void *private; | 118 | void *private; |
64 | ore_io_done_fn done; | 119 | ore_io_done_fn done; |
65 | 120 | ||
66 | struct ore_layout *layout; | 121 | struct ore_layout *layout; |
67 | struct ore_components *comps; | 122 | struct ore_components *oc; |
68 | 123 | ||
69 | /* Global read/write IO*/ | 124 | /* Global read/write IO*/ |
70 | loff_t offset; | 125 | loff_t offset; |
@@ -84,6 +139,16 @@ struct ore_io_state { | |||
84 | 139 | ||
85 | bool reading; | 140 | bool reading; |
86 | 141 | ||
142 | /* House keeping of Parity pages */ | ||
143 | bool extra_part_alloc; | ||
144 | struct page **parity_pages; | ||
145 | unsigned max_par_pages; | ||
146 | unsigned cur_par_page; | ||
147 | unsigned sgs_per_dev; | ||
148 | struct __stripe_pages_2d *sp2d; | ||
149 | struct ore_io_state *ios_read_4_write; | ||
150 | const struct _ore_r4w_op *r4w; | ||
151 | |||
87 | /* Variable array of size numdevs */ | 152 | /* Variable array of size numdevs */ |
88 | unsigned numdevs; | 153 | unsigned numdevs; |
89 | struct ore_per_dev_state { | 154 | struct ore_per_dev_state { |
@@ -91,7 +156,10 @@ struct ore_io_state { | |||
91 | struct bio *bio; | 156 | struct bio *bio; |
92 | loff_t offset; | 157 | loff_t offset; |
93 | unsigned length; | 158 | unsigned length; |
159 | unsigned last_sgs_total; | ||
94 | unsigned dev; | 160 | unsigned dev; |
161 | struct osd_sg_entry *sglist; | ||
162 | unsigned cur_sg; | ||
95 | } per_dev[]; | 163 | } per_dev[]; |
96 | }; | 164 | }; |
97 | 165 | ||
@@ -102,6 +170,9 @@ static inline unsigned ore_io_state_size(unsigned numdevs) | |||
102 | } | 170 | } |
103 | 171 | ||
104 | /* ore.c */ | 172 | /* ore.c */ |
173 | int ore_verify_layout(unsigned total_comps, struct ore_layout *layout); | ||
174 | void ore_calc_stripe_info(struct ore_layout *layout, u64 file_offset, | ||
175 | u64 length, struct ore_striping_info *si); | ||
105 | int ore_get_rw_state(struct ore_layout *layout, struct ore_components *comps, | 176 | int ore_get_rw_state(struct ore_layout *layout, struct ore_components *comps, |
106 | bool is_reading, u64 offset, u64 length, | 177 | bool is_reading, u64 offset, u64 length, |
107 | struct ore_io_state **ios); | 178 | struct ore_io_state **ios); |
@@ -109,7 +180,10 @@ int ore_get_io_state(struct ore_layout *layout, struct ore_components *comps, | |||
109 | struct ore_io_state **ios); | 180 | struct ore_io_state **ios); |
110 | void ore_put_io_state(struct ore_io_state *ios); | 181 | void ore_put_io_state(struct ore_io_state *ios); |
111 | 182 | ||
112 | int ore_check_io(struct ore_io_state *ios, u64 *resid); | 183 | typedef void (*ore_on_dev_error)(struct ore_io_state *ios, struct ore_dev *od, |
184 | unsigned dev_index, enum osd_err_priority oep, | ||
185 | u64 dev_offset, u64 dev_len); | ||
186 | int ore_check_io(struct ore_io_state *ios, ore_on_dev_error rep); | ||
113 | 187 | ||
114 | int ore_create(struct ore_io_state *ios); | 188 | int ore_create(struct ore_io_state *ios); |
115 | int ore_remove(struct ore_io_state *ios); | 189 | int ore_remove(struct ore_io_state *ios); |