diff options
Diffstat (limited to 'fs/nilfs2/page.c')
-rw-r--r-- | fs/nilfs2/page.c | 53 |
1 files changed, 1 insertions, 52 deletions
diff --git a/fs/nilfs2/page.c b/fs/nilfs2/page.c index 1168059c7efd..b3b988c2018f 100644 --- a/fs/nilfs2/page.c +++ b/fs/nilfs2/page.c | |||
@@ -37,8 +37,7 @@ | |||
37 | 37 | ||
38 | #define NILFS_BUFFER_INHERENT_BITS \ | 38 | #define NILFS_BUFFER_INHERENT_BITS \ |
39 | ((1UL << BH_Uptodate) | (1UL << BH_Mapped) | (1UL << BH_NILFS_Node) | \ | 39 | ((1UL << BH_Uptodate) | (1UL << BH_Mapped) | (1UL << BH_NILFS_Node) | \ |
40 | (1UL << BH_NILFS_Volatile) | (1UL << BH_NILFS_Allocated) | \ | 40 | (1UL << BH_NILFS_Volatile) | (1UL << BH_NILFS_Checked)) |
41 | (1UL << BH_NILFS_Checked)) | ||
42 | 41 | ||
43 | static struct buffer_head * | 42 | static struct buffer_head * |
44 | __nilfs_get_page_block(struct page *page, unsigned long block, pgoff_t index, | 43 | __nilfs_get_page_block(struct page *page, unsigned long block, pgoff_t index, |
@@ -217,56 +216,6 @@ void nilfs_page_bug(struct page *page) | |||
217 | } | 216 | } |
218 | 217 | ||
219 | /** | 218 | /** |
220 | * nilfs_alloc_private_page - allocate a private page with buffer heads | ||
221 | * | ||
222 | * Return Value: On success, a pointer to the allocated page is returned. | ||
223 | * On error, NULL is returned. | ||
224 | */ | ||
225 | struct page *nilfs_alloc_private_page(struct block_device *bdev, int size, | ||
226 | unsigned long state) | ||
227 | { | ||
228 | struct buffer_head *bh, *head, *tail; | ||
229 | struct page *page; | ||
230 | |||
231 | page = alloc_page(GFP_NOFS); /* page_count of the returned page is 1 */ | ||
232 | if (unlikely(!page)) | ||
233 | return NULL; | ||
234 | |||
235 | lock_page(page); | ||
236 | head = alloc_page_buffers(page, size, 0); | ||
237 | if (unlikely(!head)) { | ||
238 | unlock_page(page); | ||
239 | __free_page(page); | ||
240 | return NULL; | ||
241 | } | ||
242 | |||
243 | bh = head; | ||
244 | do { | ||
245 | bh->b_state = (1UL << BH_NILFS_Allocated) | state; | ||
246 | tail = bh; | ||
247 | bh->b_bdev = bdev; | ||
248 | bh = bh->b_this_page; | ||
249 | } while (bh); | ||
250 | |||
251 | tail->b_this_page = head; | ||
252 | attach_page_buffers(page, head); | ||
253 | |||
254 | return page; | ||
255 | } | ||
256 | |||
257 | void nilfs_free_private_page(struct page *page) | ||
258 | { | ||
259 | BUG_ON(!PageLocked(page)); | ||
260 | BUG_ON(page->mapping); | ||
261 | |||
262 | if (page_has_buffers(page) && !try_to_free_buffers(page)) | ||
263 | NILFS_PAGE_BUG(page, "failed to free page"); | ||
264 | |||
265 | unlock_page(page); | ||
266 | __free_page(page); | ||
267 | } | ||
268 | |||
269 | /** | ||
270 | * nilfs_copy_page -- copy the page with buffers | 219 | * nilfs_copy_page -- copy the page with buffers |
271 | * @dst: destination page | 220 | * @dst: destination page |
272 | * @src: source page | 221 | * @src: source page |