Blame view

fs/xfs/xfs_iomap.h 3.31 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
  /*
7b7187698   Nathan Scott   [XFS] Update lice...
2
3
   * Copyright (c) 2003-2005 Silicon Graphics, Inc.
   * All Rights Reserved.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
4
   *
7b7187698   Nathan Scott   [XFS] Update lice...
5
6
   * This program is free software; you can redistribute it and/or
   * modify it under the terms of the GNU General Public License as
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
7
8
   * published by the Free Software Foundation.
   *
7b7187698   Nathan Scott   [XFS] Update lice...
9
10
11
12
   * This program is distributed in the hope that it would be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   * GNU General Public License for more details.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
13
   *
7b7187698   Nathan Scott   [XFS] Update lice...
14
15
16
   * You should have received a copy of the GNU General Public License
   * along with this program; if not, write the Free Software Foundation,
   * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
17
   */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
18
19
20
21
22
23
24
  #ifndef __XFS_IOMAP_H__
  #define __XFS_IOMAP_H__
  
  #define IOMAP_DADDR_NULL ((xfs_daddr_t) (-1LL))
  
  
  typedef enum {				/* iomap_flags values */
ba87ea699   Lachlan McIlroy   [XFS] Fix to prev...
25
  	IOMAP_READ =		0,	/* mapping for a read */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
26
27
28
29
30
31
32
33
34
35
36
37
38
  	IOMAP_HOLE =		0x02,	/* mapping covers a hole  */
  	IOMAP_DELAY =		0x04,	/* mapping covers delalloc region  */
  	IOMAP_REALTIME =	0x10,	/* mapping on the realtime device  */
  	IOMAP_UNWRITTEN =	0x20,	/* mapping covers allocated */
  					/* but uninitialized file data  */
  	IOMAP_NEW =		0x40	/* just allocate */
  } iomap_flags_t;
  
  typedef enum {
  	/* base extent manipulation calls */
  	BMAPI_READ = (1 << 0),		/* read extents */
  	BMAPI_WRITE = (1 << 1),		/* create extents */
  	BMAPI_ALLOCATE = (1 << 2),	/* delayed allocate to real extents */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
39
40
  	/* modifiers */
  	BMAPI_IGNSTATE = (1 << 4),	/* ignore unwritten state on read */
24e17b5fb   Nathan Scott   [XFS] Use the rig...
41
  	BMAPI_DIRECT = (1 << 5),	/* direct instead of buffered write */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
42
43
44
  	BMAPI_MMAP = (1 << 6),		/* allocate for mmap write */
  	BMAPI_SYNC = (1 << 7),		/* sync write to flush delalloc space */
  	BMAPI_TRYLOCK = (1 << 8),	/* non-blocking request */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
45
46
47
48
49
50
  } bmapi_flags_t;
  
  
  /*
   * xfs_iomap_t:  File system I/O map
   *
f403b7f45   Nathan Scott   [XFS] Cleanup use...
51
   * The iomap_bn field is expressed in 512-byte blocks, and is where the
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
52
53
54
55
   * mapping starts on disk.
   *
   * The iomap_offset, iomap_bsize and iomap_delta fields are in bytes.
   * iomap_offset is the offset of the mapping in the file itself.
f403b7f45   Nathan Scott   [XFS] Cleanup use...
56
57
   * iomap_bsize is the size of the mapping,  iomap_delta is the
   * desired data's offset into the mapping, given the offset supplied
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
58
59
60
61
62
63
64
65
66
67
   * to the file I/O map routine.
   *
   * When a request is made to read beyond the logical end of the object,
   * iomap_size may be set to 0, but iomap_offset and iomap_length should be set
   * to the actual amount of underlying storage that has been allocated, if any.
   */
  
  typedef struct xfs_iomap {
  	xfs_daddr_t		iomap_bn;	/* first 512b blk of mapping */
  	xfs_buftarg_t		*iomap_target;
f403b7f45   Nathan Scott   [XFS] Cleanup use...
68
69
  	xfs_off_t		iomap_offset;	/* offset of mapping, bytes */
  	xfs_off_t		iomap_bsize;	/* size of mapping, bytes */
55b02d74e   Eric Sandeen   [XFS] Fix potenti...
70
  	xfs_off_t		iomap_delta;	/* offset into mapping, bytes */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
71
72
  	iomap_flags_t		iomap_flags;
  } xfs_iomap_t;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
73
74
  struct xfs_inode;
  struct xfs_bmbt_irec;
541d7d3c4   Lachlan McIlroy   [XFS] kill unness...
75
  extern int xfs_iomap(struct xfs_inode *, xfs_off_t, ssize_t, int,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
76
  		     struct xfs_iomap *, int *);
f403b7f45   Nathan Scott   [XFS] Cleanup use...
77
  extern int xfs_iomap_write_direct(struct xfs_inode *, xfs_off_t, size_t,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
78
  				  int, struct xfs_bmbt_irec *, int *, int);
f403b7f45   Nathan Scott   [XFS] Cleanup use...
79
  extern int xfs_iomap_write_delay(struct xfs_inode *, xfs_off_t, size_t, int,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
80
  				 struct xfs_bmbt_irec *, int *);
f403b7f45   Nathan Scott   [XFS] Cleanup use...
81
  extern int xfs_iomap_write_allocate(struct xfs_inode *, xfs_off_t, size_t,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
82
  				struct xfs_bmbt_irec *, int *);
f403b7f45   Nathan Scott   [XFS] Cleanup use...
83
  extern int xfs_iomap_write_unwritten(struct xfs_inode *, xfs_off_t, size_t);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
84
85
  
  #endif /* __XFS_IOMAP_H__*/