diff options
| author | Yan, Zheng <zyan@redhat.com> | 2014-09-16 05:50:45 -0400 |
|---|---|---|
| committer | Sage Weil <sage@redhat.com> | 2014-10-14 15:56:48 -0400 |
| commit | e4339d28f640a7c0d92903bcf389a2dfa281270d (patch) | |
| tree | 428c172af1081d29613732cdcf7801f958be358f /include/linux/ceph | |
| parent | 0abb43dcacb52145aa265f82c914375d59dfe2da (diff) | |
libceph: reference counting pagelist
this allow pagelist to present data that may be sent multiple times.
Signed-off-by: Yan, Zheng <zyan@redhat.com>
Reviewed-by: Sage Weil <sage@redhat.com>
Diffstat (limited to 'include/linux/ceph')
| -rw-r--r-- | include/linux/ceph/pagelist.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/include/linux/ceph/pagelist.h b/include/linux/ceph/pagelist.h index 9660d6b0a35d..5f871d84ddce 100644 --- a/include/linux/ceph/pagelist.h +++ b/include/linux/ceph/pagelist.h | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | #define __FS_CEPH_PAGELIST_H | 2 | #define __FS_CEPH_PAGELIST_H |
| 3 | 3 | ||
| 4 | #include <linux/list.h> | 4 | #include <linux/list.h> |
| 5 | #include <linux/atomic.h> | ||
| 5 | 6 | ||
| 6 | struct ceph_pagelist { | 7 | struct ceph_pagelist { |
| 7 | struct list_head head; | 8 | struct list_head head; |
| @@ -10,6 +11,7 @@ struct ceph_pagelist { | |||
| 10 | size_t room; | 11 | size_t room; |
| 11 | struct list_head free_list; | 12 | struct list_head free_list; |
| 12 | size_t num_pages_free; | 13 | size_t num_pages_free; |
| 14 | atomic_t refcnt; | ||
| 13 | }; | 15 | }; |
| 14 | 16 | ||
| 15 | struct ceph_pagelist_cursor { | 17 | struct ceph_pagelist_cursor { |
| @@ -26,9 +28,10 @@ static inline void ceph_pagelist_init(struct ceph_pagelist *pl) | |||
| 26 | pl->room = 0; | 28 | pl->room = 0; |
| 27 | INIT_LIST_HEAD(&pl->free_list); | 29 | INIT_LIST_HEAD(&pl->free_list); |
| 28 | pl->num_pages_free = 0; | 30 | pl->num_pages_free = 0; |
| 31 | atomic_set(&pl->refcnt, 1); | ||
| 29 | } | 32 | } |
| 30 | 33 | ||
| 31 | extern int ceph_pagelist_release(struct ceph_pagelist *pl); | 34 | extern void ceph_pagelist_release(struct ceph_pagelist *pl); |
| 32 | 35 | ||
| 33 | extern int ceph_pagelist_append(struct ceph_pagelist *pl, const void *d, size_t l); | 36 | extern int ceph_pagelist_append(struct ceph_pagelist *pl, const void *d, size_t l); |
| 34 | 37 | ||
