xfs_fs_subr.c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /*
  2. * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc.
  3. * All Rights Reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it would be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write the Free Software Foundation,
  16. * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #include "xfs.h"
  19. /*
  20. * Stub for no-op vnode operations that return error status.
  21. */
  22. int
  23. fs_noerr(void)
  24. {
  25. return 0;
  26. }
  27. /*
  28. * Operation unsupported under this file system.
  29. */
  30. int
  31. fs_nosys(void)
  32. {
  33. return ENOSYS;
  34. }
  35. /*
  36. * Stub for inactive, strategy, and read/write lock/unlock. Does nothing.
  37. */
  38. /* ARGSUSED */
  39. void
  40. fs_noval(void)
  41. {
  42. }
  43. /*
  44. * vnode pcache layer for vnode_tosspages.
  45. * 'last' parameter unused but left in for IRIX compatibility
  46. */
  47. void
  48. fs_tosspages(
  49. bhv_desc_t *bdp,
  50. xfs_off_t first,
  51. xfs_off_t last,
  52. int fiopt)
  53. {
  54. vnode_t *vp = BHV_TO_VNODE(bdp);
  55. struct inode *ip = vn_to_inode(vp);
  56. if (VN_CACHED(vp))
  57. truncate_inode_pages(ip->i_mapping, first);
  58. }
  59. /*
  60. * vnode pcache layer for vnode_flushinval_pages.
  61. * 'last' parameter unused but left in for IRIX compatibility
  62. */
  63. void
  64. fs_flushinval_pages(
  65. bhv_desc_t *bdp,
  66. xfs_off_t first,
  67. xfs_off_t last,
  68. int fiopt)
  69. {
  70. vnode_t *vp = BHV_TO_VNODE(bdp);
  71. struct inode *ip = vn_to_inode(vp);
  72. if (VN_CACHED(vp)) {
  73. filemap_write_and_wait(ip->i_mapping);
  74. truncate_inode_pages(ip->i_mapping, first);
  75. }
  76. }
  77. /*
  78. * vnode pcache layer for vnode_flush_pages.
  79. * 'last' parameter unused but left in for IRIX compatibility
  80. */
  81. int
  82. fs_flush_pages(
  83. bhv_desc_t *bdp,
  84. xfs_off_t first,
  85. xfs_off_t last,
  86. uint64_t flags,
  87. int fiopt)
  88. {
  89. vnode_t *vp = BHV_TO_VNODE(bdp);
  90. struct inode *ip = vn_to_inode(vp);
  91. if (VN_CACHED(vp)) {
  92. filemap_fdatawrite(ip->i_mapping);
  93. if (flags & XFS_B_ASYNC)
  94. return 0;
  95. filemap_fdatawait(ip->i_mapping);
  96. }
  97. return 0;
  98. }