Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

libceph, ceph: move ceph_calc_file_object_mapping() to striper.c

ceph_calc_file_object_mapping() has nothing to do with osdmaps.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>

+43 -44
+1
fs/ceph/addr.c
··· 15 15 #include "mds_client.h" 16 16 #include "cache.h" 17 17 #include <linux/ceph/osd_client.h> 18 + #include <linux/ceph/striper.h> 18 19 19 20 /* 20 21 * Ceph address space ops.
+1 -1
fs/ceph/ioctl.c
··· 5 5 #include "super.h" 6 6 #include "mds_client.h" 7 7 #include "ioctl.h" 8 - 8 + #include <linux/ceph/striper.h> 9 9 10 10 /* 11 11 * ioctls
-5
include/linux/ceph/osdmap.h
··· 5 5 #include <linux/rbtree.h> 6 6 #include <linux/ceph/types.h> 7 7 #include <linux/ceph/decode.h> 8 - #include <linux/ceph/ceph_fs.h> 9 8 #include <linux/crush/crush.h> 10 9 11 10 /* ··· 278 279 bool ceph_osds_changed(const struct ceph_osds *old_acting, 279 280 const struct ceph_osds *new_acting, 280 281 bool any_change); 281 - 282 - void ceph_calc_file_object_mapping(struct ceph_file_layout *l, 283 - u64 off, u64 len, 284 - u64 *objno, u64 *objoff, u32 *xlen); 285 282 286 283 int __ceph_object_locator_to_pg(struct ceph_pg_pool_info *pi, 287 284 const struct ceph_object_id *oid,
+4
include/linux/ceph/striper.h
··· 7 7 8 8 struct ceph_file_layout; 9 9 10 + void ceph_calc_file_object_mapping(struct ceph_file_layout *l, 11 + u64 off, u64 len, 12 + u64 *objno, u64 *objoff, u32 *xlen); 13 + 10 14 struct ceph_object_extent { 11 15 struct list_head oe_item; 12 16 u64 oe_objno;
+1
net/ceph/osd_client.c
··· 20 20 #include <linux/ceph/decode.h> 21 21 #include <linux/ceph/auth.h> 22 22 #include <linux/ceph/pagelist.h> 23 + #include <linux/ceph/striper.h> 23 24 24 25 #define OSD_OPREPLY_FRONT_LEN 512 25 26
-37
net/ceph/osdmap.c
··· 4 4 5 5 #include <linux/module.h> 6 6 #include <linux/slab.h> 7 - #include <asm/div64.h> 8 7 9 8 #include <linux/ceph/libceph.h> 10 9 #include <linux/ceph/osdmap.h> ··· 2138 2139 2139 2140 return false; 2140 2141 } 2141 - 2142 - /* 2143 - * Map a file extent to a stripe unit within an object. 2144 - * Fill in objno, offset into object, and object extent length (i.e. the 2145 - * number of bytes mapped, less than or equal to @l->stripe_unit). 2146 - * 2147 - * Example for stripe_count = 3, stripes_per_object = 4: 2148 - * 2149 - * blockno | 0 3 6 9 | 1 4 7 10 | 2 5 8 11 | 12 15 18 21 | 13 16 19 2150 - * stripeno | 0 1 2 3 | 0 1 2 3 | 0 1 2 3 | 4 5 6 7 | 4 5 6 2151 - * stripepos | 0 | 1 | 2 | 0 | 1 2152 - * objno | 0 | 1 | 2 | 3 | 4 2153 - * objsetno | 0 | 1 2154 - */ 2155 - void ceph_calc_file_object_mapping(struct ceph_file_layout *l, 2156 - u64 off, u64 len, 2157 - u64 *objno, u64 *objoff, u32 *xlen) 2158 - { 2159 - u32 stripes_per_object = l->object_size / l->stripe_unit; 2160 - u64 blockno; /* which su in the file (i.e. globally) */ 2161 - u32 blockoff; /* offset into su */ 2162 - u64 stripeno; /* which stripe */ 2163 - u32 stripepos; /* which su in the stripe, 2164 - which object in the object set */ 2165 - u64 objsetno; /* which object set */ 2166 - u32 objsetpos; /* which stripe in the object set */ 2167 - 2168 - blockno = div_u64_rem(off, l->stripe_unit, &blockoff); 2169 - stripeno = div_u64_rem(blockno, l->stripe_count, &stripepos); 2170 - objsetno = div_u64_rem(stripeno, stripes_per_object, &objsetpos); 2171 - 2172 - *objno = objsetno * l->stripe_count + stripepos; 2173 - *objoff = objsetpos * l->stripe_unit + blockoff; 2174 - *xlen = min_t(u64, len, l->stripe_unit - blockoff); 2175 - } 2176 - EXPORT_SYMBOL(ceph_calc_file_object_mapping); 2177 2142 2178 2143 /* 2179 2144 * Map an object into a PG.
+36 -1
net/ceph/striper.c
··· 5 5 #include <linux/math64.h> 6 6 #include <linux/slab.h> 7 7 8 - #include <linux/ceph/osdmap.h> 9 8 #include <linux/ceph/striper.h> 10 9 #include <linux/ceph/types.h> 10 + 11 + /* 12 + * Map a file extent to a stripe unit within an object. 13 + * Fill in objno, offset into object, and object extent length (i.e. the 14 + * number of bytes mapped, less than or equal to @l->stripe_unit). 15 + * 16 + * Example for stripe_count = 3, stripes_per_object = 4: 17 + * 18 + * blockno | 0 3 6 9 | 1 4 7 10 | 2 5 8 11 | 12 15 18 21 | 13 16 19 19 + * stripeno | 0 1 2 3 | 0 1 2 3 | 0 1 2 3 | 4 5 6 7 | 4 5 6 20 + * stripepos | 0 | 1 | 2 | 0 | 1 21 + * objno | 0 | 1 | 2 | 3 | 4 22 + * objsetno | 0 | 1 23 + */ 24 + void ceph_calc_file_object_mapping(struct ceph_file_layout *l, 25 + u64 off, u64 len, 26 + u64 *objno, u64 *objoff, u32 *xlen) 27 + { 28 + u32 stripes_per_object = l->object_size / l->stripe_unit; 29 + u64 blockno; /* which su in the file (i.e. globally) */ 30 + u32 blockoff; /* offset into su */ 31 + u64 stripeno; /* which stripe */ 32 + u32 stripepos; /* which su in the stripe, 33 + which object in the object set */ 34 + u64 objsetno; /* which object set */ 35 + u32 objsetpos; /* which stripe in the object set */ 36 + 37 + blockno = div_u64_rem(off, l->stripe_unit, &blockoff); 38 + stripeno = div_u64_rem(blockno, l->stripe_count, &stripepos); 39 + objsetno = div_u64_rem(stripeno, stripes_per_object, &objsetpos); 40 + 41 + *objno = objsetno * l->stripe_count + stripepos; 42 + *objoff = objsetpos * l->stripe_unit + blockoff; 43 + *xlen = min_t(u64, len, l->stripe_unit - blockoff); 44 + } 45 + EXPORT_SYMBOL(ceph_calc_file_object_mapping); 11 46 12 47 /* 13 48 * Return the last extent with given objno (@object_extents is sorted