From 3bd9856857339d7ee8c4ad50030583f1b9415c39 Mon Sep 17 00:00:00 2001 From: Boaz Harrosh Date: Wed, 28 Sep 2011 12:04:23 +0300 Subject: ore: Support for partial component table Users like the objlayout-driver would like to only pass a partial device table that covers the IO in question. For example exofs divides the file into raid-group-sized chunks and only serves group_width number of devices at a time. The partiality is communicated by setting ore_componets->first_dev and the array covers all logical devices from oc->first_dev upto (oc->first_dev + oc->numdevs) The ore_comp_dev() API receives a logical device index and returns the actual present device in the table. An out-of-range dev_index will BUG. Logical device index is the theoretical device index as if all the devices of a file are present. .i.e: total_devs = group_width * mirror_p1 * group_count 0 <= dev_index < total_devs Signed-off-by: Boaz Harrosh --- include/scsi/osd_ore.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'include/scsi/osd_ore.h') diff --git a/include/scsi/osd_ore.h b/include/scsi/osd_ore.h index baeef0200a1f..492b70d43bb6 100644 --- a/include/scsi/osd_ore.h +++ b/include/scsi/osd_ore.h @@ -49,6 +49,7 @@ struct ore_dev { }; 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 @@ -70,14 +71,14 @@ struct ore_components { static inline struct osd_dev *ore_comp_dev( const struct ore_components *oc, unsigned i) { - BUG_ON(oc->numdevs <= i); - return oc->ods[i]->od; + 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]->od = od; + oc->ods[i - oc->first_dev]->od = od; } struct ore_striping_info { -- cgit v1.2.3-59-g8ed1b