diff options
author | Noah Watkins <noah@noahdesu.com> | 2009-10-30 15:57:30 -0400 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2009-10-30 16:56:14 -0400 |
commit | ff1d1f7179363209b7f1493ea39b666f50d05cf4 (patch) | |
tree | 3031029b3cc7d4c45beed61ebc0885192a306bf0 /fs/ceph/osdmap.c | |
parent | 645a102581b3639836b17d147c35d574fd6e8267 (diff) |
ceph: fix intra strip unit length calculation
Commit 645a102581b3639836b17d147c35d574fd6e8267 fixes calculation of object
offset for layouts with multiple stripes per object. This updates the
calculation of the length written to take into account multiple stripes per
object.
Signed-off-by: Noah Watkins <noah@noahdesu.com>
Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/osdmap.c')
-rw-r--r-- | fs/ceph/osdmap.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/fs/ceph/osdmap.c b/fs/ceph/osdmap.c index 5a5520c5a2b3..d62e111b8a34 100644 --- a/fs/ceph/osdmap.c +++ b/fs/ceph/osdmap.c | |||
@@ -731,7 +731,7 @@ void ceph_calc_file_object_mapping(struct ceph_file_layout *layout, | |||
731 | u32 sc = le32_to_cpu(layout->fl_stripe_count); | 731 | u32 sc = le32_to_cpu(layout->fl_stripe_count); |
732 | u32 bl, stripeno, stripepos, objsetno; | 732 | u32 bl, stripeno, stripepos, objsetno; |
733 | u32 su_per_object; | 733 | u32 su_per_object; |
734 | u64 t; | 734 | u64 t, su_offset; |
735 | 735 | ||
736 | dout("mapping %llu~%llu osize %u fl_su %u\n", off, *plen, | 736 | dout("mapping %llu~%llu osize %u fl_su %u\n", off, *plen, |
737 | osize, su); | 737 | osize, su); |
@@ -755,10 +755,15 @@ void ceph_calc_file_object_mapping(struct ceph_file_layout *layout, | |||
755 | 755 | ||
756 | /* *oxoff = *off % layout->fl_stripe_unit; # offset in su */ | 756 | /* *oxoff = *off % layout->fl_stripe_unit; # offset in su */ |
757 | t = off; | 757 | t = off; |
758 | *oxoff = do_div(t, su); | 758 | su_offset = do_div(t, su); |
759 | *oxoff += (stripeno % su_per_object) * su; | 759 | *oxoff = su_offset + (stripeno % su_per_object) * su; |
760 | 760 | ||
761 | *oxlen = min_t(u64, *plen, su - *oxoff); | 761 | /* |
762 | * Calculate the length of the extent being written to the selected | ||
763 | * object. This is the minimum of the full length requested (plen) or | ||
764 | * the remainder of the current stripe being written to. | ||
765 | */ | ||
766 | *oxlen = min_t(u64, *plen, su - su_offset); | ||
762 | *plen = *oxlen; | 767 | *plen = *oxlen; |
763 | 768 | ||
764 | dout(" obj extent %llu~%llu\n", *oxoff, *oxlen); | 769 | dout(" obj extent %llu~%llu\n", *oxoff, *oxlen); |