^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0+ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * page.h - buffer/page management specific to NILFS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Written by Ryusuke Konishi and Seiji Kihara.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #ifndef _NILFS_PAGE_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #define _NILFS_PAGE_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/buffer_head.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include "nilfs.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) * Extended buffer state bits
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) BH_NILFS_Allocated = BH_PrivateStart,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) BH_NILFS_Node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) BH_NILFS_Volatile,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) BH_NILFS_Checked,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) BH_NILFS_Redirected,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) BUFFER_FNS(NILFS_Node, nilfs_node) /* nilfs node buffers */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) BUFFER_FNS(NILFS_Volatile, nilfs_volatile)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) BUFFER_FNS(NILFS_Checked, nilfs_checked) /* buffer is verified */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) BUFFER_FNS(NILFS_Redirected, nilfs_redirected) /* redirected to a copy */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) int __nilfs_clear_page_dirty(struct page *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) struct buffer_head *nilfs_grab_buffer(struct inode *, struct address_space *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) unsigned long, unsigned long);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) void nilfs_forget_buffer(struct buffer_head *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) void nilfs_copy_buffer(struct buffer_head *, struct buffer_head *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) int nilfs_page_buffers_clean(struct page *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) void nilfs_page_bug(struct page *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) int nilfs_copy_dirty_pages(struct address_space *, struct address_space *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) void nilfs_copy_back_pages(struct address_space *, struct address_space *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) void nilfs_clear_dirty_page(struct page *, bool);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) void nilfs_clear_dirty_pages(struct address_space *, bool);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) void nilfs_mapping_init(struct address_space *mapping, struct inode *inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) unsigned int nilfs_page_count_clean_buffers(struct page *, unsigned int,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) unsigned int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) unsigned long nilfs_find_uncommitted_extent(struct inode *inode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) sector_t start_blk,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) sector_t *blkoff);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) #define NILFS_PAGE_BUG(page, m, a...) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) do { nilfs_page_bug(page); BUG(); } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) static inline struct buffer_head *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) nilfs_page_get_nth_block(struct page *page, unsigned int count)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) struct buffer_head *bh = page_buffers(page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) while (count-- > 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) bh = bh->b_this_page;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) get_bh(bh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) return bh;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) #endif /* _NILFS_PAGE_H */