xfs_lrw.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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_LRW_H__
  33. #define __XFS_LRW_H__
  34. struct vnode;
  35. struct bhv_desc;
  36. struct xfs_mount;
  37. struct xfs_iocore;
  38. struct xfs_inode;
  39. struct xfs_bmbt_irec;
  40. struct xfs_buf;
  41. struct xfs_iomap;
  42. #if defined(XFS_RW_TRACE)
  43. /*
  44. * Defines for the trace mechanisms in xfs_lrw.c.
  45. */
  46. #define XFS_RW_KTRACE_SIZE 128
  47. #define XFS_READ_ENTER 1
  48. #define XFS_WRITE_ENTER 2
  49. #define XFS_IOMAP_READ_ENTER 3
  50. #define XFS_IOMAP_WRITE_ENTER 4
  51. #define XFS_IOMAP_READ_MAP 5
  52. #define XFS_IOMAP_WRITE_MAP 6
  53. #define XFS_IOMAP_WRITE_NOSPACE 7
  54. #define XFS_ITRUNC_START 8
  55. #define XFS_ITRUNC_FINISH1 9
  56. #define XFS_ITRUNC_FINISH2 10
  57. #define XFS_CTRUNC1 11
  58. #define XFS_CTRUNC2 12
  59. #define XFS_CTRUNC3 13
  60. #define XFS_CTRUNC4 14
  61. #define XFS_CTRUNC5 15
  62. #define XFS_CTRUNC6 16
  63. #define XFS_BUNMAPI 17
  64. #define XFS_INVAL_CACHED 18
  65. #define XFS_DIORD_ENTER 19
  66. #define XFS_DIOWR_ENTER 20
  67. #define XFS_SENDFILE_ENTER 21
  68. #define XFS_WRITEPAGE_ENTER 22
  69. #define XFS_RELEASEPAGE_ENTER 23
  70. #define XFS_IOMAP_ALLOC_ENTER 24
  71. #define XFS_IOMAP_ALLOC_MAP 25
  72. #define XFS_IOMAP_UNWRITTEN 26
  73. extern void xfs_rw_enter_trace(int, struct xfs_iocore *,
  74. void *, size_t, loff_t, int);
  75. extern void xfs_inval_cached_trace(struct xfs_iocore *,
  76. xfs_off_t, xfs_off_t, xfs_off_t, xfs_off_t);
  77. #else
  78. #define xfs_rw_enter_trace(tag, io, data, size, offset, ioflags)
  79. #define xfs_inval_cached_trace(io, offset, len, first, last)
  80. #endif
  81. /*
  82. * Maximum count of bmaps used by read and write paths.
  83. */
  84. #define XFS_MAX_RW_NBMAPS 4
  85. extern int xfs_bmap(struct bhv_desc *, xfs_off_t, ssize_t, int,
  86. struct xfs_iomap *, int *);
  87. extern int xfsbdstrat(struct xfs_mount *, struct xfs_buf *);
  88. extern int xfs_bdstrat_cb(struct xfs_buf *);
  89. extern int xfs_zero_eof(struct vnode *, struct xfs_iocore *, xfs_off_t,
  90. xfs_fsize_t, xfs_fsize_t);
  91. extern ssize_t xfs_read(struct bhv_desc *, struct kiocb *,
  92. const struct iovec *, unsigned int,
  93. loff_t *, int, struct cred *);
  94. extern ssize_t xfs_write(struct bhv_desc *, struct kiocb *,
  95. const struct iovec *, unsigned int,
  96. loff_t *, int, struct cred *);
  97. extern ssize_t xfs_sendfile(struct bhv_desc *, struct file *,
  98. loff_t *, int, size_t, read_actor_t,
  99. void *, struct cred *);
  100. extern int xfs_dev_is_read_only(struct xfs_mount *, char *);
  101. #define XFS_FSB_TO_DB_IO(io,fsb) \
  102. (((io)->io_flags & XFS_IOCORE_RT) ? \
  103. XFS_FSB_TO_BB((io)->io_mount, (fsb)) : \
  104. XFS_FSB_TO_DADDR((io)->io_mount, (fsb)))
  105. #endif /* __XFS_LRW_H__ */