diff options
-rw-r--r-- | fs/ceph/ioctl.c | 2 | ||||
-rw-r--r-- | include/linux/ceph/osdmap.h | 2 | ||||
-rw-r--r-- | net/ceph/osd_client.c | 6 | ||||
-rw-r--r-- | net/ceph/osdmap.c | 9 |
4 files changed, 10 insertions, 9 deletions
diff --git a/fs/ceph/ioctl.c b/fs/ceph/ioctl.c index 36549a46e311..3b22150d3e19 100644 --- a/fs/ceph/ioctl.c +++ b/fs/ceph/ioctl.c | |||
@@ -194,7 +194,7 @@ static long ceph_ioctl_get_dataloc(struct file *file, void __user *arg) | |||
194 | return -EFAULT; | 194 | return -EFAULT; |
195 | 195 | ||
196 | down_read(&osdc->map_sem); | 196 | down_read(&osdc->map_sem); |
197 | r = ceph_calc_file_object_mapping(&ci->i_layout, dl.file_offset, &len, | 197 | r = ceph_calc_file_object_mapping(&ci->i_layout, dl.file_offset, len, |
198 | &dl.object_no, &dl.object_offset, | 198 | &dl.object_no, &dl.object_offset, |
199 | &olen); | 199 | &olen); |
200 | if (r < 0) | 200 | if (r < 0) |
diff --git a/include/linux/ceph/osdmap.h b/include/linux/ceph/osdmap.h index 5ea57ba69320..1f653e2ff5cc 100644 --- a/include/linux/ceph/osdmap.h +++ b/include/linux/ceph/osdmap.h | |||
@@ -110,7 +110,7 @@ extern void ceph_osdmap_destroy(struct ceph_osdmap *map); | |||
110 | 110 | ||
111 | /* calculate mapping of a file extent to an object */ | 111 | /* calculate mapping of a file extent to an object */ |
112 | extern int ceph_calc_file_object_mapping(struct ceph_file_layout *layout, | 112 | extern int ceph_calc_file_object_mapping(struct ceph_file_layout *layout, |
113 | u64 off, u64 *plen, | 113 | u64 off, u64 len, |
114 | u64 *bno, u64 *oxoff, u64 *oxlen); | 114 | u64 *bno, u64 *oxoff, u64 *oxlen); |
115 | 115 | ||
116 | /* calculate mapping of object to a placement group */ | 116 | /* calculate mapping of object to a placement group */ |
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index e29a3ed92958..47e5f5b1f94c 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c | |||
@@ -53,13 +53,15 @@ int ceph_calc_raw_layout(struct ceph_osd_client *osdc, | |||
53 | reqhead->snapid = cpu_to_le64(snapid); | 53 | reqhead->snapid = cpu_to_le64(snapid); |
54 | 54 | ||
55 | /* object extent? */ | 55 | /* object extent? */ |
56 | r = ceph_calc_file_object_mapping(layout, off, plen, bno, | 56 | r = ceph_calc_file_object_mapping(layout, off, orig_len, bno, |
57 | &objoff, &objlen); | 57 | &objoff, &objlen); |
58 | if (r < 0) | 58 | if (r < 0) |
59 | return r; | 59 | return r; |
60 | if (*plen < orig_len) | 60 | if (objlen < orig_len) { |
61 | *plen = objlen; | ||
61 | dout(" skipping last %llu, final file extent %llu~%llu\n", | 62 | dout(" skipping last %llu, final file extent %llu~%llu\n", |
62 | orig_len - *plen, off, *plen); | 63 | orig_len - *plen, off, *plen); |
64 | } | ||
63 | 65 | ||
64 | if (op_has_extent(op->op)) { | 66 | if (op_has_extent(op->op)) { |
65 | u32 osize = le32_to_cpu(layout->fl_object_size); | 67 | u32 osize = le32_to_cpu(layout->fl_object_size); |
diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c index ca05871635bc..369f03ba9ee5 100644 --- a/net/ceph/osdmap.c +++ b/net/ceph/osdmap.c | |||
@@ -1016,7 +1016,7 @@ bad: | |||
1016 | * pass a stride back to the caller. | 1016 | * pass a stride back to the caller. |
1017 | */ | 1017 | */ |
1018 | int ceph_calc_file_object_mapping(struct ceph_file_layout *layout, | 1018 | int ceph_calc_file_object_mapping(struct ceph_file_layout *layout, |
1019 | u64 off, u64 *plen, | 1019 | u64 off, u64 len, |
1020 | u64 *ono, | 1020 | u64 *ono, |
1021 | u64 *oxoff, u64 *oxlen) | 1021 | u64 *oxoff, u64 *oxlen) |
1022 | { | 1022 | { |
@@ -1027,7 +1027,7 @@ int ceph_calc_file_object_mapping(struct ceph_file_layout *layout, | |||
1027 | u32 su_per_object; | 1027 | u32 su_per_object; |
1028 | u64 t, su_offset; | 1028 | u64 t, su_offset; |
1029 | 1029 | ||
1030 | dout("mapping %llu~%llu osize %u fl_su %u\n", off, *plen, | 1030 | dout("mapping %llu~%llu osize %u fl_su %u\n", off, len, |
1031 | osize, su); | 1031 | osize, su); |
1032 | if (su == 0 || sc == 0) | 1032 | if (su == 0 || sc == 0) |
1033 | goto invalid; | 1033 | goto invalid; |
@@ -1060,11 +1060,10 @@ int ceph_calc_file_object_mapping(struct ceph_file_layout *layout, | |||
1060 | 1060 | ||
1061 | /* | 1061 | /* |
1062 | * Calculate the length of the extent being written to the selected | 1062 | * Calculate the length of the extent being written to the selected |
1063 | * object. This is the minimum of the full length requested (plen) or | 1063 | * object. This is the minimum of the full length requested (len) or |
1064 | * the remainder of the current stripe being written to. | 1064 | * the remainder of the current stripe being written to. |
1065 | */ | 1065 | */ |
1066 | *oxlen = min_t(u64, *plen, su - su_offset); | 1066 | *oxlen = min_t(u64, len, su - su_offset); |
1067 | *plen = *oxlen; | ||
1068 | 1067 | ||
1069 | dout(" obj extent %llu~%llu\n", *oxoff, *oxlen); | 1068 | dout(" obj extent %llu~%llu\n", *oxoff, *oxlen); |
1070 | return 0; | 1069 | return 0; |