aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ceph
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2013-04-30 01:44:32 -0400
committerSage Weil <sage@inktank.com>2013-05-02 00:20:08 -0400
commit4f0dcb10cf1454a1c38aeaa04cb2757535e4905e (patch)
tree1637c6a8961c95bdf02b7326cea79ca9b0b8e07f /include/linux/ceph
parentb536f69a3a589113992c32982bf2981c8225c9da (diff)
libceph: create source file "net/ceph/snapshot.c"
This creates a new source file "net/ceph/snapshot.c" to contain utility routines related to ceph snapshot contexts. The main motivation was to define ceph_create_snap_context() as a common way to create these structures, but I've moved the definitions of ceph_get_snap_context() and ceph_put_snap_context() there too. (The benefit of inlining those is very small, and I'd rather keep this collection of functions together.) Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'include/linux/ceph')
-rw-r--r--include/linux/ceph/libceph.h30
1 files changed, 5 insertions, 25 deletions
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h
index 5493d7b86423..2e3024881a5e 100644
--- a/include/linux/ceph/libceph.h
+++ b/include/linux/ceph/libceph.h
@@ -157,31 +157,11 @@ struct ceph_snap_context {
157 u64 snaps[]; 157 u64 snaps[];
158}; 158};
159 159
160static inline struct ceph_snap_context * 160extern struct ceph_snap_context *ceph_create_snap_context(u32 snap_count,
161ceph_get_snap_context(struct ceph_snap_context *sc) 161 gfp_t gfp_flags);
162{ 162extern struct ceph_snap_context *ceph_get_snap_context(
163 /* 163 struct ceph_snap_context *sc);
164 printk("get_snap_context %p %d -> %d\n", sc, atomic_read(&sc->nref), 164extern void ceph_put_snap_context(struct ceph_snap_context *sc);
165 atomic_read(&sc->nref)+1);
166 */
167 if (sc)
168 atomic_inc(&sc->nref);
169 return sc;
170}
171
172static inline void ceph_put_snap_context(struct ceph_snap_context *sc)
173{
174 if (!sc)
175 return;
176 /*
177 printk("put_snap_context %p %d -> %d\n", sc, atomic_read(&sc->nref),
178 atomic_read(&sc->nref)-1);
179 */
180 if (atomic_dec_and_test(&sc->nref)) {
181 /*printk(" deleting snap_context %p\n", sc);*/
182 kfree(sc);
183 }
184}
185 165
186/* 166/*
187 * calculate the number of pages a given length and offset map onto, 167 * calculate the number of pages a given length and offset map onto,