Linux-2.6.12-rc2
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / fs / xfs / linux-2.6 / xfs_lrw.h
blobd723e35254a0b977b169e2bf65b6de34e27599b5
1 /*
2 * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
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.
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.
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.
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.
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
26 * http://www.sgi.com
28 * For further information regarding this notice, see:
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
32 #ifndef __XFS_LRW_H__
33 #define __XFS_LRW_H__
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;
44 #if defined(XFS_RW_TRACE)
46 * Defines for the trace mechanisms in xfs_lrw.c.
48 #define XFS_RW_KTRACE_SIZE 128
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 void *, 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, data, size, offset, ioflags)
82 #define xfs_inval_cached_trace(io, offset, len, first, last)
83 #endif
86 * Maximum count of bmaps used by read and write paths.
88 #define XFS_MAX_RW_NBMAPS 4
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 *);
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 kiocb *,
100 const struct iovec *, unsigned int,
101 loff_t *, int, struct cred *);
102 extern ssize_t xfs_write(struct bhv_desc *, struct kiocb *,
103 const struct iovec *, unsigned int,
104 loff_t *, int, struct cred *);
105 extern ssize_t xfs_sendfile(struct bhv_desc *, struct file *,
106 loff_t *, int, size_t, read_actor_t,
107 void *, struct cred *);
109 extern int xfs_dev_is_read_only(struct xfs_mount *, char *);
111 #define XFS_FSB_TO_DB_IO(io,fsb) \
112 (((io)->io_flags & XFS_IOCORE_RT) ? \
113 XFS_FSB_TO_BB((io)->io_mount, (fsb)) : \
114 XFS_FSB_TO_DADDR((io)->io_mount, (fsb)))
116 #endif /* __XFS_LRW_H__ */