]> git.ipfire.org Git - people/ms/linux.git/blame - fs/nilfs2/page.h
Merge tag 'fuse-update-6.0' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi...
[people/ms/linux.git] / fs / nilfs2 / page.h
CommitLineData
ae98043f 1/* SPDX-License-Identifier: GPL-2.0+ */
0bd49f94 2/*
94ee1d91 3 * Buffer/page management specific to NILFS
0bd49f94
RK
4 *
5 * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation.
6 *
4b420ab4 7 * Written by Ryusuke Konishi and Seiji Kihara.
0bd49f94
RK
8 */
9
10#ifndef _NILFS_PAGE_H
11#define _NILFS_PAGE_H
12
13#include <linux/buffer_head.h>
14#include "nilfs.h"
15
16/*
17 * Extended buffer state bits
18 */
19enum {
20 BH_NILFS_Allocated = BH_PrivateStart,
21 BH_NILFS_Node,
22 BH_NILFS_Volatile,
4e13e66b 23 BH_NILFS_Checked,
b1f6a4f2 24 BH_NILFS_Redirected,
0bd49f94
RK
25};
26
0bd49f94
RK
27BUFFER_FNS(NILFS_Node, nilfs_node) /* nilfs node buffers */
28BUFFER_FNS(NILFS_Volatile, nilfs_volatile)
4e13e66b 29BUFFER_FNS(NILFS_Checked, nilfs_checked) /* buffer is verified */
b1f6a4f2 30BUFFER_FNS(NILFS_Redirected, nilfs_redirected) /* redirected to a copy */
0bd49f94
RK
31
32
0bd49f94
RK
33int __nilfs_clear_page_dirty(struct page *);
34
35struct buffer_head *nilfs_grab_buffer(struct inode *, struct address_space *,
36 unsigned long, unsigned long);
37void nilfs_forget_buffer(struct buffer_head *);
38void nilfs_copy_buffer(struct buffer_head *, struct buffer_head *);
39int nilfs_page_buffers_clean(struct page *);
40void nilfs_page_bug(struct page *);
0bd49f94
RK
41
42int nilfs_copy_dirty_pages(struct address_space *, struct address_space *);
43void nilfs_copy_back_pages(struct address_space *, struct address_space *);
8c26c4e2
VD
44void nilfs_clear_dirty_page(struct page *, bool);
45void nilfs_clear_dirty_pages(struct address_space *, bool);
0c6c44cb
RK
46unsigned int nilfs_page_count_clean_buffers(struct page *, unsigned int,
47 unsigned int);
622daaff
RK
48unsigned long nilfs_find_uncommitted_extent(struct inode *inode,
49 sector_t start_blk,
50 sector_t *blkoff);
0bd49f94
RK
51
52#define NILFS_PAGE_BUG(page, m, a...) \
53 do { nilfs_page_bug(page); BUG(); } while (0)
54
55static inline struct buffer_head *
56nilfs_page_get_nth_block(struct page *page, unsigned int count)
57{
58 struct buffer_head *bh = page_buffers(page);
59
60 while (count-- > 0)
61 bh = bh->b_this_page;
62 get_bh(bh);
63 return bh;
64}
65
66#endif /* _NILFS_PAGE_H */