aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoah Watkins <noah@noahdesu.com>2009-10-30 12:57:30 -0700
committerSage Weil <sage@newdream.net>2009-10-30 13:56:14 -0700
commitff1d1f7179363209b7f1493ea39b666f50d05cf4 (patch)
tree3031029b3cc7d4c45beed61ebc0885192a306bf0
parent645a102581b3639836b17d147c35d574fd6e8267 (diff)
downloadkernel_samsung_smdk4412-ff1d1f7179363209b7f1493ea39b666f50d05cf4.zip
kernel_samsung_smdk4412-ff1d1f7179363209b7f1493ea39b666f50d05cf4.tar.gz
kernel_samsung_smdk4412-ff1d1f7179363209b7f1493ea39b666f50d05cf4.tar.bz2
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>
-rw-r--r--fs/ceph/osdmap.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/fs/ceph/osdmap.c b/fs/ceph/osdmap.c
index 5a5520c..d62e111 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,
u32 sc = le32_to_cpu(layout->fl_stripe_count);
u32 bl, stripeno, stripepos, objsetno;
u32 su_per_object;
- u64 t;
+ u64 t, su_offset;
dout("mapping %llu~%llu osize %u fl_su %u\n", off, *plen,
osize, su);
@@ -755,10 +755,15 @@ void ceph_calc_file_object_mapping(struct ceph_file_layout *layout,
/* *oxoff = *off % layout->fl_stripe_unit; # offset in su */
t = off;
- *oxoff = do_div(t, su);
- *oxoff += (stripeno % su_per_object) * su;
-
- *oxlen = min_t(u64, *plen, su - *oxoff);
+ su_offset = do_div(t, su);
+ *oxoff = su_offset + (stripeno % su_per_object) * su;
+
+ /*
+ * Calculate the length of the extent being written to the selected
+ * object. This is the minimum of the full length requested (plen) or
+ * the remainder of the current stripe being written to.
+ */
+ *oxlen = min_t(u64, *plen, su - su_offset);
*plen = *oxlen;
dout(" obj extent %llu~%llu\n", *oxoff, *oxlen);