page.h 1.9 KB

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