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