blob: d723e35254a0b977b169e2bf65b6de34e27599b5 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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
35struct vnode;
36struct bhv_desc;
37struct xfs_mount;
38struct xfs_iocore;
39struct xfs_inode;
40struct xfs_bmbt_irec;
41struct xfs_buf;
42struct 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
76extern void xfs_rw_enter_trace(int, struct xfs_iocore *,
77 void *, size_t, loff_t, int);
78extern 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
84
85/*
86 * Maximum count of bmaps used by read and write paths.
87 */
88#define XFS_MAX_RW_NBMAPS 4
89
90extern int xfs_bmap(struct bhv_desc *, xfs_off_t, ssize_t, int,
91 struct xfs_iomap *, int *);
92extern int xfsbdstrat(struct xfs_mount *, struct xfs_buf *);
93extern int xfs_bdstrat_cb(struct xfs_buf *);
94
95extern int xfs_zero_eof(struct vnode *, struct xfs_iocore *, xfs_off_t,
96 xfs_fsize_t, xfs_fsize_t);
97extern void xfs_inval_cached_pages(struct vnode *, struct xfs_iocore *,
98 xfs_off_t, int, int);
99extern ssize_t xfs_read(struct bhv_desc *, struct kiocb *,
100 const struct iovec *, unsigned int,
101 loff_t *, int, struct cred *);
102extern ssize_t xfs_write(struct bhv_desc *, struct kiocb *,
103 const struct iovec *, unsigned int,
104 loff_t *, int, struct cred *);
105extern ssize_t xfs_sendfile(struct bhv_desc *, struct file *,
106 loff_t *, int, size_t, read_actor_t,
107 void *, struct cred *);
108
109extern int xfs_dev_is_read_only(struct xfs_mount *, char *);
110
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)))
115
116#endif /* __XFS_LRW_H__ */