diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-10-26 23:33:50 +0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-10-26 23:33:50 +0400 |
commit | c28cfd60e4ec3f494b73ef7d6c661f5f491cd84f (patch) | |
tree | 390c23c07b4f484528b6fa5a72bae1b879df35b1 /include | |
parent | dfa4a423cf80afe8f81a36d8e663961c4acca343 (diff) | |
parent | 44231e686b2ba3b5702db867bb84e6d76b7cf2c7 (diff) | |
download | linux-c28cfd60e4ec3f494b73ef7d6c661f5f491cd84f.tar.xz |
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 { struct ore_layout { /* Our way of looking at the data_map */ + enum pnfs_osd_raid_algorithm4 + raid_algorithm; unsigned stripe_unit; unsigned mirrors_p1; unsigned group_width; + unsigned parity; u64 group_depth; unsigned group_count; + + /* Cached often needed calculations filled in by + * ore_verify_layout + */ + unsigned long max_io_length; /* Max length that should be passed to + * ore_get_rw_state + */ +}; + +struct ore_dev { + struct osd_dev *od; }; struct ore_components { + unsigned first_dev; /* First logical device no */ unsigned numdevs; /* Num of devices in array */ /* If @single_comp == EC_SINGLE_COMP, @comps points to a single * component. else there are @numdevs components @@ -51,20 +66,60 @@ struct ore_components { EC_SINGLE_COMP = 0, EC_MULTPLE_COMPS = 0xffffffff } single_comp; struct ore_comp *comps; - struct osd_dev **ods; /* osd_dev array */ + + /* Array of pointers to ore_dev-* . User will usually have these pointed + * too a bigger struct which contain an "ore_dev ored" member and use + * container_of(oc->ods[i], struct foo_dev, ored) to access the bigger + * structure. + */ + struct ore_dev **ods; +}; + +/* ore_comp_dev Recievies a logical device index */ +static inline struct osd_dev *ore_comp_dev( + const struct ore_components *oc, unsigned i) +{ + BUG_ON((i < oc->first_dev) || (oc->first_dev + oc->numdevs <= i)); + return oc->ods[i - oc->first_dev]->od; +} + +static inline void ore_comp_set_dev( + struct ore_components *oc, unsigned i, struct osd_dev *od) +{ + oc->ods[i - oc->first_dev]->od = od; +} + +struct ore_striping_info { + u64 offset; + u64 obj_offset; + u64 length; + u64 first_stripe_start; /* only used in raid writes */ + u64 M; /* for truncate */ + unsigned bytes_in_stripe; + unsigned dev; + unsigned par_dev; + unsigned unit_off; + unsigned cur_pg; + unsigned cur_comp; }; struct ore_io_state; typedef void (*ore_io_done_fn)(struct ore_io_state *ios, void *private); +struct _ore_r4w_op { + /* @Priv given here is passed ios->private */ + struct page * (*get_page)(void *priv, u64 page_index, bool *uptodate); + void (*put_page)(void *priv, struct page *page); +}; struct ore_io_state { struct kref kref; + struct ore_striping_info si; void *private; ore_io_done_fn done; struct ore_layout *layout; - struct ore_components *comps; + struct ore_components *oc; /* Global read/write IO*/ loff_t offset; @@ -84,6 +139,16 @@ struct ore_io_state { bool reading; + /* House keeping of Parity pages */ + bool extra_part_alloc; + struct page **parity_pages; + unsigned max_par_pages; + unsigned cur_par_page; + unsigned sgs_per_dev; + struct __stripe_pages_2d *sp2d; + struct ore_io_state *ios_read_4_write; + const struct _ore_r4w_op *r4w; + /* Variable array of size numdevs */ unsigned numdevs; struct ore_per_dev_state { @@ -91,7 +156,10 @@ struct ore_io_state { struct bio *bio; loff_t offset; unsigned length; + unsigned last_sgs_total; unsigned dev; + struct osd_sg_entry *sglist; + unsigned cur_sg; } per_dev[]; }; @@ -102,6 +170,9 @@ static inline unsigned ore_io_state_size(unsigned numdevs) } /* ore.c */ +int ore_verify_layout(unsigned total_comps, struct ore_layout *layout); +void ore_calc_stripe_info(struct ore_layout *layout, u64 file_offset, + u64 length, struct ore_striping_info *si); int ore_get_rw_state(struct ore_layout *layout, struct ore_components *comps, bool is_reading, u64 offset, u64 length, struct ore_io_state **ios); @@ -109,7 +180,10 @@ int ore_get_io_state(struct ore_layout *layout, struct ore_components *comps, struct ore_io_state **ios); void ore_put_io_state(struct ore_io_state *ios); -int ore_check_io(struct ore_io_state *ios, u64 *resid); +typedef void (*ore_on_dev_error)(struct ore_io_state *ios, struct ore_dev *od, + unsigned dev_index, enum osd_err_priority oep, + u64 dev_offset, u64 dev_len); +int ore_check_io(struct ore_io_state *ios, ore_on_dev_error rep); int ore_create(struct ore_io_state *ios); int ore_remove(struct ore_io_state *ios); |