diff options
author | Sage Weil <sage@newdream.net> | 2009-10-28 18:15:05 -0400 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2009-10-28 20:45:41 -0400 |
commit | 645a102581b3639836b17d147c35d574fd6e8267 (patch) | |
tree | f7117157b3f4eb4803189eccd7a5d6464d4fb255 /fs/ceph/osdmap.c | |
parent | 5600f5ebd318f7af6f4b19a29f08d18bb85264e5 (diff) |
ceph: fix object striping calculation for non-default striping schemes
We were incorrectly calculationing of object offset. If we have multiple
stripe units per object, we need to shift to the start of the current
su in addition to the offset within the su.
Also rename bno to ono (object number) to avoid some variable naming
confusion.
Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/osdmap.c')
-rw-r--r-- | fs/ceph/osdmap.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/fs/ceph/osdmap.c b/fs/ceph/osdmap.c index a9a4143234fa..5a5520c5a2b3 100644 --- a/fs/ceph/osdmap.c +++ b/fs/ceph/osdmap.c | |||
@@ -723,7 +723,7 @@ bad: | |||
723 | */ | 723 | */ |
724 | void ceph_calc_file_object_mapping(struct ceph_file_layout *layout, | 724 | void ceph_calc_file_object_mapping(struct ceph_file_layout *layout, |
725 | u64 off, u64 *plen, | 725 | u64 off, u64 *plen, |
726 | u64 *bno, | 726 | u64 *ono, |
727 | u64 *oxoff, u64 *oxlen) | 727 | u64 *oxoff, u64 *oxlen) |
728 | { | 728 | { |
729 | u32 osize = le32_to_cpu(layout->fl_object_size); | 729 | u32 osize = le32_to_cpu(layout->fl_object_size); |
@@ -750,11 +750,14 @@ void ceph_calc_file_object_mapping(struct ceph_file_layout *layout, | |||
750 | stripepos = bl % sc; | 750 | stripepos = bl % sc; |
751 | objsetno = stripeno / su_per_object; | 751 | objsetno = stripeno / su_per_object; |
752 | 752 | ||
753 | *bno = objsetno * sc + stripepos; | 753 | *ono = objsetno * sc + stripepos; |
754 | dout("objset %u * sc %u = bno %u\n", objsetno, sc, (unsigned)*bno); | 754 | dout("objset %u * sc %u = ono %u\n", objsetno, sc, (unsigned)*ono); |
755 | /* *oxoff = *off % layout->fl_stripe_unit; */ | 755 | |
756 | /* *oxoff = *off % layout->fl_stripe_unit; # offset in su */ | ||
756 | t = off; | 757 | t = off; |
757 | *oxoff = do_div(t, su); | 758 | *oxoff = do_div(t, su); |
759 | *oxoff += (stripeno % su_per_object) * su; | ||
760 | |||
758 | *oxlen = min_t(u64, *plen, su - *oxoff); | 761 | *oxlen = min_t(u64, *plen, su - *oxoff); |
759 | *plen = *oxlen; | 762 | *plen = *oxlen; |
760 | 763 | ||