From ca2a77695fe11292eadb98d3109a7483f590252f Mon Sep 17 00:00:00 2001 From: Noah Watkins Date: Fri, 30 Oct 2009 12:57:30 -0700 Subject: [PATCH] --- yaml --- r: 188599 b: refs/heads/master c: ff1d1f7179363209b7f1493ea39b666f50d05cf4 h: refs/heads/master i: 188597: e7213a1e8864e4833532f4523a3df52543ef3402 188595: 604442d2853ae52feaf1cdd83d0b6b57863c4832 188591: 38381e07d9b1979f2bed498a1dc92381bc9086c9 v: v3 --- [refs] | 2 +- trunk/fs/ceph/osdmap.c | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/[refs] b/[refs] index e5109b36dfd4..4d7da475ff79 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 645a102581b3639836b17d147c35d574fd6e8267 +refs/heads/master: ff1d1f7179363209b7f1493ea39b666f50d05cf4 diff --git a/trunk/fs/ceph/osdmap.c b/trunk/fs/ceph/osdmap.c index 5a5520c5a2b3..d62e111b8a34 100644 --- a/trunk/fs/ceph/osdmap.c +++ b/trunk/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);