3 #include <linux/pagemap.h>
4 #include <linux/highmem.h>
8 int ceph_pagelist_release(struct ceph_pagelist
*pl
)
11 kunmap(pl
->mapped_tail
);
12 while (!list_empty(&pl
->head
)) {
13 struct page
*page
= list_first_entry(&pl
->head
, struct page
,
21 static int ceph_pagelist_addpage(struct ceph_pagelist
*pl
)
23 struct page
*page
= alloc_page(GFP_NOFS
);
26 pl
->room
+= PAGE_SIZE
;
27 list_add_tail(&page
->lru
, &pl
->head
);
29 kunmap(pl
->mapped_tail
);
30 pl
->mapped_tail
= kmap(page
);
34 int ceph_pagelist_append(struct ceph_pagelist
*pl
, void *buf
, size_t len
)
36 while (pl
->room
< len
) {
37 size_t bit
= pl
->room
;
40 memcpy(pl
->mapped_tail
+ (pl
->length
& ~PAGE_CACHE_MASK
),
46 ret
= ceph_pagelist_addpage(pl
);
51 memcpy(pl
->mapped_tail
+ (pl
->length
& ~PAGE_CACHE_MASK
), buf
, len
);