diff options
author | Ilya Dryomov <idryomov@gmail.com> | 2018-02-17 09:29:58 +0100 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2018-04-02 10:12:38 +0200 |
commit | dccbf08005df800f5c8e948ab6132ed5536134bc (patch) | |
tree | 9df1438b466899a694f724fdbdca2c0f9aca514e /net/ceph | |
parent | libceph: eliminate overflows in ceph_calc_file_object_mapping() (diff) | |
download | linux-dccbf08005df800f5c8e948ab6132ed5536134bc.tar.xz linux-dccbf08005df800f5c8e948ab6132ed5536134bc.zip |
libceph, ceph: change ceph_calc_file_object_mapping() signature
- make it void
- xlen (object extent length) out parameter should be u32 because only
a single stripe unit is mapped at a time
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Diffstat (limited to 'net/ceph')
-rw-r--r-- | net/ceph/osd_client.c | 10 | ||||
-rw-r--r-- | net/ceph/osdmap.c | 6 |
2 files changed, 6 insertions, 10 deletions
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 2814dba5902d..4b0485458d26 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c @@ -103,13 +103,12 @@ static int calc_layout(struct ceph_file_layout *layout, u64 off, u64 *plen, u64 *objnum, u64 *objoff, u64 *objlen) { u64 orig_len = *plen; - int r; + u32 xlen; /* object extent? */ - r = ceph_calc_file_object_mapping(layout, off, orig_len, objnum, - objoff, objlen); - if (r < 0) - return r; + ceph_calc_file_object_mapping(layout, off, orig_len, objnum, + objoff, &xlen); + *objlen = xlen; if (*objlen < orig_len) { *plen = *objlen; dout(" skipping last %llu, final file extent %llu~%llu\n", @@ -117,7 +116,6 @@ static int calc_layout(struct ceph_file_layout *layout, u64 off, u64 *plen, } dout("calc_layout objnum=%llx %llu~%llu\n", *objnum, *objoff, *objlen); - return 0; } diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c index 3faa9e701518..e3ebbe2ecdad 100644 --- a/net/ceph/osdmap.c +++ b/net/ceph/osdmap.c @@ -2153,9 +2153,9 @@ bool ceph_osds_changed(const struct ceph_osds *old_acting, * objno | 0 | 1 | 2 | 3 | 4 * objsetno | 0 | 1 */ -int ceph_calc_file_object_mapping(struct ceph_file_layout *l, +void ceph_calc_file_object_mapping(struct ceph_file_layout *l, u64 off, u64 len, - u64 *objno, u64 *objoff, u64 *xlen) + u64 *objno, u64 *objoff, u32 *xlen) { u32 stripes_per_object = l->object_size / l->stripe_unit; u64 blockno; /* which su in the file (i.e. globally) */ @@ -2173,8 +2173,6 @@ int ceph_calc_file_object_mapping(struct ceph_file_layout *l, *objno = objsetno * l->stripe_count + stripepos; *objoff = objsetpos * l->stripe_unit + blockoff; *xlen = min_t(u64, len, l->stripe_unit - blockoff); - - return 0; } EXPORT_SYMBOL(ceph_calc_file_object_mapping); |