Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0+ */
0002 /*
0003  * Buffer/page management specific to NILFS
0004  *
0005  * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation.
0006  *
0007  * Written by Ryusuke Konishi and Seiji Kihara.
0008  */
0009 
0010 #ifndef _NILFS_PAGE_H
0011 #define _NILFS_PAGE_H
0012 
0013 #include <linux/buffer_head.h>
0014 #include "nilfs.h"
0015 
0016 /*
0017  * Extended buffer state bits
0018  */
0019 enum {
0020     BH_NILFS_Allocated = BH_PrivateStart,
0021     BH_NILFS_Node,
0022     BH_NILFS_Volatile,
0023     BH_NILFS_Checked,
0024     BH_NILFS_Redirected,
0025 };
0026 
0027 BUFFER_FNS(NILFS_Node, nilfs_node)      /* nilfs node buffers */
0028 BUFFER_FNS(NILFS_Volatile, nilfs_volatile)
0029 BUFFER_FNS(NILFS_Checked, nilfs_checked)    /* buffer is verified */
0030 BUFFER_FNS(NILFS_Redirected, nilfs_redirected)  /* redirected to a copy */
0031 
0032 
0033 int __nilfs_clear_page_dirty(struct page *);
0034 
0035 struct buffer_head *nilfs_grab_buffer(struct inode *, struct address_space *,
0036                       unsigned long, unsigned long);
0037 void nilfs_forget_buffer(struct buffer_head *);
0038 void nilfs_copy_buffer(struct buffer_head *, struct buffer_head *);
0039 int nilfs_page_buffers_clean(struct page *);
0040 void nilfs_page_bug(struct page *);
0041 
0042 int nilfs_copy_dirty_pages(struct address_space *, struct address_space *);
0043 void nilfs_copy_back_pages(struct address_space *, struct address_space *);
0044 void nilfs_clear_dirty_page(struct page *, bool);
0045 void nilfs_clear_dirty_pages(struct address_space *, bool);
0046 unsigned int nilfs_page_count_clean_buffers(struct page *, unsigned int,
0047                         unsigned int);
0048 unsigned long nilfs_find_uncommitted_extent(struct inode *inode,
0049                         sector_t start_blk,
0050                         sector_t *blkoff);
0051 
0052 #define NILFS_PAGE_BUG(page, m, a...) \
0053     do { nilfs_page_bug(page); BUG(); } while (0)
0054 
0055 static inline struct buffer_head *
0056 nilfs_page_get_nth_block(struct page *page, unsigned int count)
0057 {
0058     struct buffer_head *bh = page_buffers(page);
0059 
0060     while (count-- > 0)
0061         bh = bh->b_this_page;
0062     get_bh(bh);
0063     return bh;
0064 }
0065 
0066 #endif /* _NILFS_PAGE_H */