2 #include <linux/pagemap.h>
3 #include <linux/highmem.h>
7 int ceph_pagelist_release(struct ceph_pagelist
*pl
)
10 kunmap(pl
->mapped_tail
);
11 while (!list_empty(&pl
->head
)) {
12 struct page
*page
= list_first_entry(&pl
->head
, struct page
,
20 static int ceph_pagelist_addpage(struct ceph_pagelist
*pl
)
22 struct page
*page
= alloc_page(GFP_NOFS
);
25 pl
->room
+= PAGE_SIZE
;
26 list_add_tail(&page
->lru
, &pl
->head
);
28 kunmap(pl
->mapped_tail
);
29 pl
->mapped_tail
= kmap(page
);
33 int ceph_pagelist_append(struct ceph_pagelist
*pl
, void *buf
, size_t len
)
35 while (pl
->room
< len
) {
36 size_t bit
= pl
->room
;
39 memcpy(pl
->mapped_tail
+ (pl
->length
& ~PAGE_CACHE_MASK
),
45 ret
= ceph_pagelist_addpage(pl
);
50 memcpy(pl
->mapped_tail
+ (pl
->length
& ~PAGE_CACHE_MASK
), buf
, len
);