aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_bmap.h
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2011-09-18 16:40:52 -0400
committerAlex Elder <aelder@sgi.com>2011-10-11 22:15:04 -0400
commitc0dc7828af6952643219292be29e482ef74cb261 (patch)
tree02f12935ec56f61a9ed396d1b902b21aaf4ffb3e /fs/xfs/xfs_bmap.h
parentb447fe5a05cbd01c4bf7fe2fa41cb9e99ce7e58e (diff)
xfs: rename xfs_bmapi to xfs_bmapi_write
Now that all the read-only users of xfs_bmapi have been converted to use xfs_bmapi_read(), we can remove all the read-only handling cases from xfs_bmapi(). Once this is done, rename xfs_bmapi to xfs_bmapi_write to reflect the fact it is for allocation only. This enables us to kill the XFS_BMAPI_WRITE flag as well. Also clean up xfs_bmapi_write to the style used in the newly added xfs_bmapi_read/delay functions. Signed-off-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Alex Elder <aelder@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_bmap.h')
-rw-r--r--fs/xfs/xfs_bmap.h50
1 files changed, 13 insertions, 37 deletions
diff --git a/fs/xfs/xfs_bmap.h b/fs/xfs/xfs_bmap.h
index c70c19c7f1fa..be235f56d2a6 100644
--- a/fs/xfs/xfs_bmap.h
+++ b/fs/xfs/xfs_bmap.h
@@ -62,25 +62,23 @@ typedef struct xfs_bmap_free
62#define XFS_BMAP_MAX_NMAP 4 62#define XFS_BMAP_MAX_NMAP 4
63 63
64/* 64/*
65 * Flags for xfs_bmapi 65 * Flags for xfs_bmapi_*
66 */ 66 */
67#define XFS_BMAPI_WRITE 0x001 /* write operation: allocate space */ 67#define XFS_BMAPI_ENTIRE 0x001 /* return entire extent, not trimmed */
68#define XFS_BMAPI_ENTIRE 0x004 /* return entire extent, not trimmed */ 68#define XFS_BMAPI_METADATA 0x002 /* mapping metadata not user data */
69#define XFS_BMAPI_METADATA 0x008 /* mapping metadata not user data */ 69#define XFS_BMAPI_ATTRFORK 0x004 /* use attribute fork not data */
70#define XFS_BMAPI_ATTRFORK 0x010 /* use attribute fork not data */ 70#define XFS_BMAPI_PREALLOC 0x008 /* preallocation op: unwritten space */
71#define XFS_BMAPI_PREALLOC 0x040 /* preallocation op: unwritten space */ 71#define XFS_BMAPI_IGSTATE 0x010 /* Ignore state - */
72#define XFS_BMAPI_IGSTATE 0x080 /* Ignore state - */
73 /* combine contig. space */ 72 /* combine contig. space */
74#define XFS_BMAPI_CONTIG 0x100 /* must allocate only one extent */ 73#define XFS_BMAPI_CONTIG 0x020 /* must allocate only one extent */
75/* 74/*
76 * unwritten extent conversion - this needs write cache flushing and no additional 75 * unwritten extent conversion - this needs write cache flushing and no additional
77 * allocation alignments. When specified with XFS_BMAPI_PREALLOC it converts 76 * allocation alignments. When specified with XFS_BMAPI_PREALLOC it converts
78 * from written to unwritten, otherwise convert from unwritten to written. 77 * from written to unwritten, otherwise convert from unwritten to written.
79 */ 78 */
80#define XFS_BMAPI_CONVERT 0x200 79#define XFS_BMAPI_CONVERT 0x040
81 80
82#define XFS_BMAPI_FLAGS \ 81#define XFS_BMAPI_FLAGS \
83 { XFS_BMAPI_WRITE, "WRITE" }, \
84 { XFS_BMAPI_ENTIRE, "ENTIRE" }, \ 82 { XFS_BMAPI_ENTIRE, "ENTIRE" }, \
85 { XFS_BMAPI_METADATA, "METADATA" }, \ 83 { XFS_BMAPI_METADATA, "METADATA" }, \
86 { XFS_BMAPI_ATTRFORK, "ATTRFORK" }, \ 84 { XFS_BMAPI_ATTRFORK, "ATTRFORK" }, \
@@ -265,39 +263,17 @@ xfs_bmap_read_extents(
265 struct xfs_inode *ip, /* incore inode */ 263 struct xfs_inode *ip, /* incore inode */
266 int whichfork); /* data or attr fork */ 264 int whichfork); /* data or attr fork */
267 265
268/*
269 * Map file blocks to filesystem blocks.
270 * File range is given by the bno/len pair.
271 * Adds blocks to file if a write ("flags & XFS_BMAPI_WRITE" set)
272 * into a hole or past eof.
273 * Only allocates blocks from a single allocation group,
274 * to avoid locking problems.
275 * The returned value in "firstblock" from the first call in a transaction
276 * must be remembered and presented to subsequent calls in "firstblock".
277 * An upper bound for the number of blocks to be allocated is supplied to
278 * the first call in "total"; if no allocation group has that many free
279 * blocks then the call will fail (return NULLFSBLOCK in "firstblock").
280 */
281int /* error */
282xfs_bmapi(
283 struct xfs_trans *tp, /* transaction pointer */
284 struct xfs_inode *ip, /* incore inode */
285 xfs_fileoff_t bno, /* starting file offs. mapped */
286 xfs_filblks_t len, /* length to map in file */
287 int flags, /* XFS_BMAPI_... */
288 xfs_fsblock_t *firstblock, /* first allocated block
289 controls a.g. for allocs */
290 xfs_extlen_t total, /* total blocks needed */
291 struct xfs_bmbt_irec *mval, /* output: map values */
292 int *nmap, /* i/o: mval size/count */
293 xfs_bmap_free_t *flist); /* i/o: list extents to free */
294
295int xfs_bmapi_read(struct xfs_inode *ip, xfs_fileoff_t bno, 266int xfs_bmapi_read(struct xfs_inode *ip, xfs_fileoff_t bno,
296 xfs_filblks_t len, struct xfs_bmbt_irec *mval, 267 xfs_filblks_t len, struct xfs_bmbt_irec *mval,
297 int *nmap, int flags); 268 int *nmap, int flags);
298int xfs_bmapi_delay(struct xfs_inode *ip, xfs_fileoff_t bno, 269int xfs_bmapi_delay(struct xfs_inode *ip, xfs_fileoff_t bno,
299 xfs_filblks_t len, struct xfs_bmbt_irec *mval, 270 xfs_filblks_t len, struct xfs_bmbt_irec *mval,
300 int *nmap, int flags); 271 int *nmap, int flags);
272int xfs_bmapi_write(struct xfs_trans *tp, struct xfs_inode *ip,
273 xfs_fileoff_t bno, xfs_filblks_t len, int flags,
274 xfs_fsblock_t *firstblock, xfs_extlen_t total,
275 struct xfs_bmbt_irec *mval, int *nmap,
276 struct xfs_bmap_free *flist);
301 277
302/* 278/*
303 * Unmap (remove) blocks from a file. 279 * Unmap (remove) blocks from a file.