xfs_rw.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /*
  2. * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify it
  5. * under the terms of version 2 of the GNU General Public License as
  6. * published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it would be useful, but
  9. * WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. *
  12. * Further, this software is distributed without any warranty that it is
  13. * free of the rightful claim of any third person regarding infringement
  14. * or the like. Any license provided herein, whether implied or
  15. * otherwise, applies only to this software file. Patent licenses, if
  16. * any, provided herein do not apply to combinations of this program with
  17. * other software, or any other product whatsoever.
  18. *
  19. * You should have received a copy of the GNU General Public License along
  20. * with this program; if not, write the Free Software Foundation, Inc., 59
  21. * Temple Place - Suite 330, Boston MA 02111-1307, USA.
  22. *
  23. * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
  24. * Mountain View, CA 94043, or:
  25. *
  26. * http://www.sgi.com
  27. *
  28. * For further information regarding this notice, see:
  29. *
  30. * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
  31. */
  32. #ifndef __XFS_RW_H__
  33. #define __XFS_RW_H__
  34. struct xfs_buf;
  35. struct xfs_inode;
  36. struct xfs_mount;
  37. /*
  38. * Maximum count of bmaps used by read and write paths.
  39. */
  40. #define XFS_MAX_RW_NBMAPS 4
  41. /*
  42. * Counts of readahead buffers to use based on physical memory size.
  43. * None of these should be more than XFS_MAX_RW_NBMAPS.
  44. */
  45. #define XFS_RW_NREADAHEAD_16MB 2
  46. #define XFS_RW_NREADAHEAD_32MB 3
  47. #define XFS_RW_NREADAHEAD_K32 4
  48. #define XFS_RW_NREADAHEAD_K64 4
  49. /*
  50. * Maximum size of a buffer that we\'ll map. Making this
  51. * too big will degrade performance due to the number of
  52. * pages which need to be gathered. Making it too small
  53. * will prevent us from doing large I/O\'s to hardware that
  54. * needs it.
  55. *
  56. * This is currently set to 512 KB.
  57. */
  58. #define XFS_MAX_BMAP_LEN_BB 1024
  59. #define XFS_MAX_BMAP_LEN_BYTES 524288
  60. /*
  61. * Convert the given file system block to a disk block.
  62. * We have to treat it differently based on whether the
  63. * file is a real time file or not, because the bmap code
  64. * does.
  65. */
  66. #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_FSB_TO_DB)
  67. xfs_daddr_t xfs_fsb_to_db(struct xfs_inode *ip, xfs_fsblock_t fsb);
  68. #define XFS_FSB_TO_DB(ip,fsb) xfs_fsb_to_db(ip,fsb)
  69. #else
  70. #define XFS_FSB_TO_DB(ip,fsb) \
  71. (((ip)->i_d.di_flags & XFS_DIFLAG_REALTIME) ? \
  72. (xfs_daddr_t)XFS_FSB_TO_BB((ip)->i_mount, (fsb)) : \
  73. XFS_FSB_TO_DADDR((ip)->i_mount, (fsb)))
  74. #endif
  75. #define XFS_FSB_TO_DB_IO(io,fsb) \
  76. (((io)->io_flags & XFS_IOCORE_RT) ? \
  77. XFS_FSB_TO_BB((io)->io_mount, (fsb)) : \
  78. XFS_FSB_TO_DADDR((io)->io_mount, (fsb)))
  79. /*
  80. * Prototypes for functions in xfs_rw.c.
  81. */
  82. int
  83. xfs_write_clear_setuid(
  84. struct xfs_inode *ip);
  85. int
  86. xfs_bwrite(
  87. struct xfs_mount *mp,
  88. struct xfs_buf *bp);
  89. int
  90. xfs_bioerror(
  91. struct xfs_buf *b);
  92. int
  93. xfs_bioerror_relse(
  94. struct xfs_buf *b);
  95. int
  96. xfs_read_buf(
  97. struct xfs_mount *mp,
  98. xfs_buftarg_t *target,
  99. xfs_daddr_t blkno,
  100. int len,
  101. uint flags,
  102. struct xfs_buf **bpp);
  103. void
  104. xfs_ioerror_alert(
  105. char *func,
  106. struct xfs_mount *mp,
  107. xfs_buf_t *bp,
  108. xfs_daddr_t blkno);
  109. /*
  110. * Prototypes for functions in xfs_vnodeops.c.
  111. */
  112. int
  113. xfs_rwlock(
  114. bhv_desc_t *bdp,
  115. vrwlock_t write_lock);
  116. void
  117. xfs_rwunlock(
  118. bhv_desc_t *bdp,
  119. vrwlock_t write_lock);
  120. int
  121. xfs_change_file_space(
  122. bhv_desc_t *bdp,
  123. int cmd,
  124. xfs_flock64_t *bf,
  125. xfs_off_t offset,
  126. cred_t *credp,
  127. int flags);
  128. int
  129. xfs_set_dmattrs(
  130. bhv_desc_t *bdp,
  131. u_int evmask,
  132. u_int16_t state,
  133. cred_t *credp);
  134. #endif /* __XFS_RW_H__ */