summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fs/ceph/addr.c1
-rw-r--r--fs/ceph/ioctl.c2
-rw-r--r--include/linux/ceph/osdmap.h5
-rw-r--r--include/linux/ceph/striper.h4
-rw-r--r--net/ceph/osd_client.c1
-rw-r--r--net/ceph/osdmap.c37
-rw-r--r--net/ceph/striper.c37
7 files changed, 43 insertions, 44 deletions
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index c0fe1b6f47ac..c3557a9ea73d 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -15,6 +15,7 @@
#include "mds_client.h"
#include "cache.h"
#include <linux/ceph/osd_client.h>
+#include <linux/ceph/striper.h>
/*
* Ceph address space ops.
diff --git a/fs/ceph/ioctl.c b/fs/ceph/ioctl.c
index b855d24a895a..c90f03beb15d 100644
--- a/fs/ceph/ioctl.c
+++ b/fs/ceph/ioctl.c
@@ -5,7 +5,7 @@
#include "super.h"
#include "mds_client.h"
#include "ioctl.h"
-
+#include <linux/ceph/striper.h>
/*
* ioctls
diff --git a/include/linux/ceph/osdmap.h b/include/linux/ceph/osdmap.h
index 92314035dac1..e71fb222c7c3 100644
--- a/include/linux/ceph/osdmap.h
+++ b/include/linux/ceph/osdmap.h
@@ -5,7 +5,6 @@
#include <linux/rbtree.h>
#include <linux/ceph/types.h>
#include <linux/ceph/decode.h>
-#include <linux/ceph/ceph_fs.h>
#include <linux/crush/crush.h>
/*
@@ -280,10 +279,6 @@ bool ceph_osds_changed(const struct ceph_osds *old_acting,
const struct ceph_osds *new_acting,
bool any_change);
-void ceph_calc_file_object_mapping(struct ceph_file_layout *l,
- u64 off, u64 len,
- u64 *objno, u64 *objoff, u32 *xlen);
-
int __ceph_object_locator_to_pg(struct ceph_pg_pool_info *pi,
const struct ceph_object_id *oid,
const struct ceph_object_locator *oloc,
diff --git a/include/linux/ceph/striper.h b/include/linux/ceph/striper.h
index 74134ee5fdc8..cbd0d24b7148 100644
--- a/include/linux/ceph/striper.h
+++ b/include/linux/ceph/striper.h
@@ -7,6 +7,10 @@
struct ceph_file_layout;
+void ceph_calc_file_object_mapping(struct ceph_file_layout *l,
+ u64 off, u64 len,
+ u64 *objno, u64 *objoff, u32 *xlen);
+
struct ceph_object_extent {
struct list_head oe_item;
u64 oe_objno;
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 407be0533c18..4a3af96dc057 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -20,6 +20,7 @@
#include <linux/ceph/decode.h>
#include <linux/ceph/auth.h>
#include <linux/ceph/pagelist.h>
+#include <linux/ceph/striper.h>
#define OSD_OPREPLY_FRONT_LEN 512
diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c
index e3ebbe2ecdad..9645ffd6acfb 100644
--- a/net/ceph/osdmap.c
+++ b/net/ceph/osdmap.c
@@ -4,7 +4,6 @@
#include <linux/module.h>
#include <linux/slab.h>
-#include <asm/div64.h>
#include <linux/ceph/libceph.h>
#include <linux/ceph/osdmap.h>
@@ -2141,42 +2140,6 @@ bool ceph_osds_changed(const struct ceph_osds *old_acting,
}
/*
- * Map a file extent to a stripe unit within an object.
- * Fill in objno, offset into object, and object extent length (i.e. the
- * number of bytes mapped, less than or equal to @l->stripe_unit).
- *
- * Example for stripe_count = 3, stripes_per_object = 4:
- *
- * blockno | 0 3 6 9 | 1 4 7 10 | 2 5 8 11 | 12 15 18 21 | 13 16 19
- * stripeno | 0 1 2 3 | 0 1 2 3 | 0 1 2 3 | 4 5 6 7 | 4 5 6
- * stripepos | 0 | 1 | 2 | 0 | 1
- * objno | 0 | 1 | 2 | 3 | 4
- * objsetno | 0 | 1
- */
-void ceph_calc_file_object_mapping(struct ceph_file_layout *l,
- u64 off, u64 len,
- 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) */
- u32 blockoff; /* offset into su */
- u64 stripeno; /* which stripe */
- u32 stripepos; /* which su in the stripe,
- which object in the object set */
- u64 objsetno; /* which object set */
- u32 objsetpos; /* which stripe in the object set */
-
- blockno = div_u64_rem(off, l->stripe_unit, &blockoff);
- stripeno = div_u64_rem(blockno, l->stripe_count, &stripepos);
- objsetno = div_u64_rem(stripeno, stripes_per_object, &objsetpos);
-
- *objno = objsetno * l->stripe_count + stripepos;
- *objoff = objsetpos * l->stripe_unit + blockoff;
- *xlen = min_t(u64, len, l->stripe_unit - blockoff);
-}
-EXPORT_SYMBOL(ceph_calc_file_object_mapping);
-
-/*
* Map an object into a PG.
*
* Should only be called with target_oid and target_oloc (as opposed to
diff --git a/net/ceph/striper.c b/net/ceph/striper.c
index bc1e4de30df9..c36462dc86b7 100644
--- a/net/ceph/striper.c
+++ b/net/ceph/striper.c
@@ -5,11 +5,46 @@
#include <linux/math64.h>
#include <linux/slab.h>
-#include <linux/ceph/osdmap.h>
#include <linux/ceph/striper.h>
#include <linux/ceph/types.h>
/*
+ * Map a file extent to a stripe unit within an object.
+ * Fill in objno, offset into object, and object extent length (i.e. the
+ * number of bytes mapped, less than or equal to @l->stripe_unit).
+ *
+ * Example for stripe_count = 3, stripes_per_object = 4:
+ *
+ * blockno | 0 3 6 9 | 1 4 7 10 | 2 5 8 11 | 12 15 18 21 | 13 16 19
+ * stripeno | 0 1 2 3 | 0 1 2 3 | 0 1 2 3 | 4 5 6 7 | 4 5 6
+ * stripepos | 0 | 1 | 2 | 0 | 1
+ * objno | 0 | 1 | 2 | 3 | 4
+ * objsetno | 0 | 1
+ */
+void ceph_calc_file_object_mapping(struct ceph_file_layout *l,
+ u64 off, u64 len,
+ 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) */
+ u32 blockoff; /* offset into su */
+ u64 stripeno; /* which stripe */
+ u32 stripepos; /* which su in the stripe,
+ which object in the object set */
+ u64 objsetno; /* which object set */
+ u32 objsetpos; /* which stripe in the object set */
+
+ blockno = div_u64_rem(off, l->stripe_unit, &blockoff);
+ stripeno = div_u64_rem(blockno, l->stripe_count, &stripepos);
+ objsetno = div_u64_rem(stripeno, stripes_per_object, &objsetpos);
+
+ *objno = objsetno * l->stripe_count + stripepos;
+ *objoff = objsetpos * l->stripe_unit + blockoff;
+ *xlen = min_t(u64, len, l->stripe_unit - blockoff);
+}
+EXPORT_SYMBOL(ceph_calc_file_object_mapping);
+
+/*
* Return the last extent with given objno (@object_extents is sorted
* by objno). If not found, return NULL and set @add_pos so that the
* new extent can be added with list_add(add_pos, new_ex).