Commit 8a5d8dd8 authored by Russell Cattelan's avatar Russell Cattelan Committed by Nathan Scott

[XFS] move the iomap data structures out of pagebuf

SGI Modid: 2.5.x-xfs:slinx:162048a
parent db46361e
This diff is collapsed.
...@@ -67,6 +67,7 @@ ...@@ -67,6 +67,7 @@
#include "xfs_buf_item.h" #include "xfs_buf_item.h"
#include "xfs_trans_space.h" #include "xfs_trans_space.h"
#include "xfs_utils.h" #include "xfs_utils.h"
#include "xfs_iomap.h"
#define XFS_WRITEIO_ALIGN(mp,off) (((off) >> mp->m_writeio_log) \ #define XFS_WRITEIO_ALIGN(mp,off) (((off) >> mp->m_writeio_log) \
<< mp->m_writeio_log) << mp->m_writeio_log)
...@@ -78,9 +79,9 @@ xfs_imap_to_bmap( ...@@ -78,9 +79,9 @@ xfs_imap_to_bmap(
xfs_iocore_t *io, xfs_iocore_t *io,
xfs_off_t offset, xfs_off_t offset,
xfs_bmbt_irec_t *imap, xfs_bmbt_irec_t *imap,
page_buf_bmap_t *pbmapp, xfs_iomap_t *iomapp,
int imaps, /* Number of imap entries */ int imaps, /* Number of imap entries */
int bmaps, /* Number of bmap entries */ int iomaps, /* Number of iomap entries */
int flags) int flags)
{ {
xfs_mount_t *mp; xfs_mount_t *mp;
...@@ -93,32 +94,32 @@ xfs_imap_to_bmap( ...@@ -93,32 +94,32 @@ xfs_imap_to_bmap(
if (io->io_new_size > nisize) if (io->io_new_size > nisize)
nisize = io->io_new_size; nisize = io->io_new_size;
for (pbm = 0; imaps && pbm < bmaps; imaps--, pbmapp++, imap++, pbm++) { for (pbm = 0; imaps && pbm < iomaps; imaps--, iomapp++, imap++, pbm++) {
pbmapp->pbm_target = io->io_flags & XFS_IOCORE_RT ? iomapp->iomap_target = io->io_flags & XFS_IOCORE_RT ?
mp->m_rtdev_targp : mp->m_ddev_targp; mp->m_rtdev_targp : mp->m_ddev_targp;
pbmapp->pbm_offset = XFS_FSB_TO_B(mp, imap->br_startoff); iomapp->iomap_offset = XFS_FSB_TO_B(mp, imap->br_startoff);
pbmapp->pbm_delta = offset - pbmapp->pbm_offset; iomapp->iomap_delta = offset - iomapp->iomap_offset;
pbmapp->pbm_bsize = XFS_FSB_TO_B(mp, imap->br_blockcount); iomapp->iomap_bsize = XFS_FSB_TO_B(mp, imap->br_blockcount);
pbmapp->pbm_flags = flags; iomapp->iomap_flags = flags;
start_block = imap->br_startblock; start_block = imap->br_startblock;
if (start_block == HOLESTARTBLOCK) { if (start_block == HOLESTARTBLOCK) {
pbmapp->pbm_bn = PAGE_BUF_DADDR_NULL; iomapp->iomap_bn = IOMAP_DADDR_NULL;
pbmapp->pbm_flags = PBMF_HOLE; iomapp->iomap_flags = IOMAP_HOLE;
} else if (start_block == DELAYSTARTBLOCK) { } else if (start_block == DELAYSTARTBLOCK) {
pbmapp->pbm_bn = PAGE_BUF_DADDR_NULL; iomapp->iomap_bn = IOMAP_DADDR_NULL;
pbmapp->pbm_flags = PBMF_DELAY; iomapp->iomap_flags = IOMAP_DELAY;
} else { } else {
pbmapp->pbm_bn = XFS_FSB_TO_DB_IO(io, start_block); iomapp->iomap_bn = XFS_FSB_TO_DB_IO(io, start_block);
if (ISUNWRITTEN(imap)) if (ISUNWRITTEN(imap))
pbmapp->pbm_flags |= PBMF_UNWRITTEN; iomapp->iomap_flags |= IOMAP_UNWRITTEN;
} }
if ((pbmapp->pbm_offset + pbmapp->pbm_bsize) >= nisize) { if ((iomapp->iomap_offset + iomapp->iomap_bsize) >= nisize) {
pbmapp->pbm_flags |= PBMF_EOF; iomapp->iomap_flags |= IOMAP_EOF;
} }
offset += pbmapp->pbm_bsize - pbmapp->pbm_delta; offset += iomapp->iomap_bsize - iomapp->iomap_delta;
} }
return pbm; /* Return the number filled */ return pbm; /* Return the number filled */
} }
...@@ -129,8 +130,8 @@ xfs_iomap( ...@@ -129,8 +130,8 @@ xfs_iomap(
xfs_off_t offset, xfs_off_t offset,
ssize_t count, ssize_t count,
int flags, int flags,
page_buf_bmap_t *pbmapp, xfs_iomap_t *iomapp,
int *npbmaps) int *niomaps)
{ {
xfs_mount_t *mp = io->io_mount; xfs_mount_t *mp = io->io_mount;
xfs_fileoff_t offset_fsb, end_fsb; xfs_fileoff_t offset_fsb, end_fsb;
...@@ -139,44 +140,44 @@ xfs_iomap( ...@@ -139,44 +140,44 @@ xfs_iomap(
xfs_bmbt_irec_t imap; xfs_bmbt_irec_t imap;
int nimaps = 1; int nimaps = 1;
int bmapi_flags = 0; int bmapi_flags = 0;
int bmapv_flags = 0; int iomap_flags = 0;
if (XFS_FORCED_SHUTDOWN(mp)) if (XFS_FORCED_SHUTDOWN(mp))
return XFS_ERROR(EIO); return XFS_ERROR(EIO);
switch (flags & switch (flags &
(BMAP_READ | BMAP_WRITE | BMAP_ALLOCATE | (BMAPI_READ | BMAPI_WRITE | BMAPI_ALLOCATE |
BMAP_UNWRITTEN | BMAP_DEVICE)) { BMAPI_UNWRITTEN | BMAPI_DEVICE)) {
case BMAP_READ: case BMAPI_READ:
lockmode = XFS_LCK_MAP_SHARED(mp, io); lockmode = XFS_LCK_MAP_SHARED(mp, io);
bmapi_flags = XFS_BMAPI_ENTIRE; bmapi_flags = XFS_BMAPI_ENTIRE;
if (flags & BMAP_IGNSTATE) if (flags & BMAPI_IGNSTATE)
bmapi_flags |= XFS_BMAPI_IGSTATE; bmapi_flags |= XFS_BMAPI_IGSTATE;
break; break;
case BMAP_WRITE: case BMAPI_WRITE:
lockmode = XFS_ILOCK_EXCL|XFS_EXTSIZE_WR; lockmode = XFS_ILOCK_EXCL|XFS_EXTSIZE_WR;
bmapi_flags = 0; bmapi_flags = 0;
XFS_ILOCK(mp, io, lockmode); XFS_ILOCK(mp, io, lockmode);
break; break;
case BMAP_ALLOCATE: case BMAPI_ALLOCATE:
lockmode = XFS_ILOCK_SHARED|XFS_EXTSIZE_RD; lockmode = XFS_ILOCK_SHARED|XFS_EXTSIZE_RD;
bmapi_flags = XFS_BMAPI_ENTIRE; bmapi_flags = XFS_BMAPI_ENTIRE;
/* Attempt non-blocking lock */ /* Attempt non-blocking lock */
if (flags & BMAP_TRYLOCK) { if (flags & BMAPI_TRYLOCK) {
if (!XFS_ILOCK_NOWAIT(mp, io, lockmode)) if (!XFS_ILOCK_NOWAIT(mp, io, lockmode))
return XFS_ERROR(EAGAIN); return XFS_ERROR(EAGAIN);
} else { } else {
XFS_ILOCK(mp, io, lockmode); XFS_ILOCK(mp, io, lockmode);
} }
break; break;
case BMAP_UNWRITTEN: case BMAPI_UNWRITTEN:
goto phase2; goto phase2;
case BMAP_DEVICE: case BMAPI_DEVICE:
lockmode = XFS_LCK_MAP_SHARED(mp, io); lockmode = XFS_LCK_MAP_SHARED(mp, io);
pbmapp->pbm_target = io->io_flags & XFS_IOCORE_RT ? iomapp->iomap_target = io->io_flags & XFS_IOCORE_RT ?
mp->m_rtdev_targp : mp->m_ddev_targp; mp->m_rtdev_targp : mp->m_ddev_targp;
error = 0; error = 0;
*npbmaps = 1; *niomaps = 1;
goto out; goto out;
default: default:
BUG(); BUG();
...@@ -197,22 +198,22 @@ xfs_iomap( ...@@ -197,22 +198,22 @@ xfs_iomap(
goto out; goto out;
phase2: phase2:
switch (flags & (BMAP_WRITE|BMAP_ALLOCATE|BMAP_UNWRITTEN)) { switch (flags & (BMAPI_WRITE|BMAPI_ALLOCATE|BMAPI_UNWRITTEN)) {
case BMAP_WRITE: case BMAPI_WRITE:
/* If we found an extent, return it */ /* If we found an extent, return it */
if (nimaps && (imap.br_startblock != HOLESTARTBLOCK)) if (nimaps && (imap.br_startblock != HOLESTARTBLOCK))
break; break;
if (flags & (BMAP_DIRECT|BMAP_MMAP)) { if (flags & (BMAPI_DIRECT|BMAPI_MMAP)) {
error = XFS_IOMAP_WRITE_DIRECT(mp, io, offset, error = XFS_IOMAP_WRITE_DIRECT(mp, io, offset,
count, flags, &imap, &nimaps, nimaps); count, flags, &imap, &nimaps, nimaps);
} else { } else {
error = XFS_IOMAP_WRITE_DELAY(mp, io, offset, count, error = XFS_IOMAP_WRITE_DELAY(mp, io, offset, count,
flags, &imap, &nimaps); flags, &imap, &nimaps);
} }
bmapv_flags = PBMF_NEW; iomap_flags = IOMAP_NEW;
break; break;
case BMAP_ALLOCATE: case BMAPI_ALLOCATE:
/* If we found an extent, return it */ /* If we found an extent, return it */
XFS_IUNLOCK(mp, io, lockmode); XFS_IUNLOCK(mp, io, lockmode);
lockmode = 0; lockmode = 0;
...@@ -222,7 +223,7 @@ xfs_iomap( ...@@ -222,7 +223,7 @@ xfs_iomap(
error = XFS_IOMAP_WRITE_ALLOCATE(mp, io, &imap, &nimaps); error = XFS_IOMAP_WRITE_ALLOCATE(mp, io, &imap, &nimaps);
break; break;
case BMAP_UNWRITTEN: case BMAPI_UNWRITTEN:
lockmode = 0; lockmode = 0;
error = XFS_IOMAP_WRITE_UNWRITTEN(mp, io, offset, count); error = XFS_IOMAP_WRITE_UNWRITTEN(mp, io, offset, count);
nimaps = 0; nimaps = 0;
...@@ -230,10 +231,10 @@ xfs_iomap( ...@@ -230,10 +231,10 @@ xfs_iomap(
} }
if (nimaps) { if (nimaps) {
*npbmaps = xfs_imap_to_bmap(io, offset, &imap, *niomaps = xfs_imap_to_bmap(io, offset, &imap,
pbmapp, nimaps, *npbmaps, bmapv_flags); iomapp, nimaps, *niomaps, iomap_flags);
} else if (npbmaps) { } else if (niomaps) {
*npbmaps = 0; *niomaps = 0;
} }
out: out:
...@@ -256,13 +257,13 @@ xfs_flush_space( ...@@ -256,13 +257,13 @@ xfs_flush_space(
xfs_ilock(ip, XFS_ILOCK_EXCL); xfs_ilock(ip, XFS_ILOCK_EXCL);
*fsynced = 1; *fsynced = 1;
} else { } else {
*ioflags |= BMAP_SYNC; *ioflags |= BMAPI_SYNC;
*fsynced = 2; *fsynced = 2;
} }
return 0; return 0;
case 1: case 1:
*fsynced = 2; *fsynced = 2;
*ioflags |= BMAP_SYNC; *ioflags |= BMAPI_SYNC;
return 0; return 0;
case 2: case 2:
xfs_iunlock(ip, XFS_ILOCK_EXCL); xfs_iunlock(ip, XFS_ILOCK_EXCL);
...@@ -393,7 +394,7 @@ xfs_iomap_write_direct( ...@@ -393,7 +394,7 @@ xfs_iomap_write_direct(
xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
xfs_trans_ihold(tp, ip); xfs_trans_ihold(tp, ip);
if (!(flags & BMAP_MMAP) && (offset < ip->i_d.di_size || rt)) if (!(flags & BMAPI_MMAP) && (offset < ip->i_d.di_size || rt))
bmapi_flag |= XFS_BMAPI_PREALLOC; bmapi_flag |= XFS_BMAPI_PREALLOC;
/* /*
...@@ -492,7 +493,7 @@ xfs_iomap_write_delay( ...@@ -492,7 +493,7 @@ xfs_iomap_write_delay(
* We don't bother with this for sync writes, because we need * We don't bother with this for sync writes, because we need
* to minimize the amount we write for good performance. * to minimize the amount we write for good performance.
*/ */
if (!(ioflag & BMAP_SYNC) && ((offset + count) > ip->i_d.di_size)) { if (!(ioflag & BMAPI_SYNC) && ((offset + count) > ip->i_d.di_size)) {
xfs_off_t aligned_offset; xfs_off_t aligned_offset;
unsigned int iosize; unsigned int iosize;
xfs_fileoff_t ioalign; xfs_fileoff_t ioalign;
......
...@@ -71,6 +71,7 @@ ...@@ -71,6 +71,7 @@
#include "xfs_inode_item.h" #include "xfs_inode_item.h"
#include "xfs_buf_item.h" #include "xfs_buf_item.h"
#include "xfs_utils.h" #include "xfs_utils.h"
#include "xfs_iomap.h"
#include <linux/capability.h> #include <linux/capability.h>
...@@ -967,8 +968,8 @@ xfs_bmap(bhv_desc_t *bdp, ...@@ -967,8 +968,8 @@ xfs_bmap(bhv_desc_t *bdp,
xfs_off_t offset, xfs_off_t offset,
ssize_t count, ssize_t count,
int flags, int flags,
page_buf_bmap_t *pbmapp, xfs_iomap_t *iomapp,
int *npbmaps) int *niomaps)
{ {
xfs_inode_t *ip = XFS_BHVTOI(bdp); xfs_inode_t *ip = XFS_BHVTOI(bdp);
xfs_iocore_t *io = &ip->i_iocore; xfs_iocore_t *io = &ip->i_iocore;
...@@ -977,7 +978,7 @@ xfs_bmap(bhv_desc_t *bdp, ...@@ -977,7 +978,7 @@ xfs_bmap(bhv_desc_t *bdp,
ASSERT(((ip->i_d.di_flags & XFS_DIFLAG_REALTIME) != 0) == ASSERT(((ip->i_d.di_flags & XFS_DIFLAG_REALTIME) != 0) ==
((ip->i_iocore.io_flags & XFS_IOCORE_RT) != 0)); ((ip->i_iocore.io_flags & XFS_IOCORE_RT) != 0));
return xfs_iomap(io, offset, count, flags, pbmapp, npbmaps); return xfs_iomap(io, offset, count, flags, iomapp, niomaps);
} }
/* /*
......
...@@ -39,7 +39,7 @@ struct xfs_iocore; ...@@ -39,7 +39,7 @@ struct xfs_iocore;
struct xfs_inode; struct xfs_inode;
struct xfs_bmbt_irec; struct xfs_bmbt_irec;
struct page_buf_s; struct page_buf_s;
struct page_buf_bmap_s; struct xfs_iomap;
#if defined(XFS_RW_TRACE) #if defined(XFS_RW_TRACE)
/* /*
...@@ -84,7 +84,7 @@ extern void xfs_inval_cached_trace(struct xfs_iocore *, ...@@ -84,7 +84,7 @@ extern void xfs_inval_cached_trace(struct xfs_iocore *,
#define XFS_MAX_RW_NBMAPS 4 #define XFS_MAX_RW_NBMAPS 4
extern int xfs_bmap(struct bhv_desc *, xfs_off_t, ssize_t, int, extern int xfs_bmap(struct bhv_desc *, xfs_off_t, ssize_t, int,
struct page_buf_bmap_s *, int *); struct xfs_iomap *, int *);
extern int xfsbdstrat(struct xfs_mount *, struct page_buf_s *); extern int xfsbdstrat(struct xfs_mount *, struct page_buf_s *);
extern int xfs_bdstrat_cb(struct page_buf_s *); extern int xfs_bdstrat_cb(struct page_buf_s *);
...@@ -102,16 +102,6 @@ extern ssize_t xfs_sendfile(struct bhv_desc *, struct file *, ...@@ -102,16 +102,6 @@ extern ssize_t xfs_sendfile(struct bhv_desc *, struct file *,
loff_t *, int, size_t, read_actor_t, loff_t *, int, size_t, read_actor_t,
void *, struct cred *); void *, struct cred *);
extern int xfs_iomap(struct xfs_iocore *, xfs_off_t, ssize_t, int,
struct page_buf_bmap_s *, int *);
extern int xfs_iomap_write_direct(struct xfs_inode *, loff_t, size_t,
int, struct xfs_bmbt_irec *, int *, int);
extern int xfs_iomap_write_delay(struct xfs_inode *, loff_t, size_t,
int, struct xfs_bmbt_irec *, int *);
extern int xfs_iomap_write_allocate(struct xfs_inode *,
struct xfs_bmbt_irec *, int *);
extern int xfs_iomap_write_unwritten(struct xfs_inode *, loff_t, size_t);
extern int xfs_dev_is_read_only(struct xfs_mount *, char *); extern int xfs_dev_is_read_only(struct xfs_mount *, char *);
#define XFS_FSB_TO_DB_IO(io,fsb) \ #define XFS_FSB_TO_DB_IO(io,fsb) \
......
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
struct uio; struct uio;
struct file; struct file;
struct vattr; struct vattr;
struct page_buf_bmap_s; struct xfs_iomap;
struct attrlist_cursor_kern; struct attrlist_cursor_kern;
/* /*
...@@ -226,7 +226,7 @@ typedef int (*vop_release_t)(bhv_desc_t *); ...@@ -226,7 +226,7 @@ typedef int (*vop_release_t)(bhv_desc_t *);
typedef int (*vop_rwlock_t)(bhv_desc_t *, vrwlock_t); typedef int (*vop_rwlock_t)(bhv_desc_t *, vrwlock_t);
typedef void (*vop_rwunlock_t)(bhv_desc_t *, vrwlock_t); typedef void (*vop_rwunlock_t)(bhv_desc_t *, vrwlock_t);
typedef int (*vop_bmap_t)(bhv_desc_t *, xfs_off_t, ssize_t, int, typedef int (*vop_bmap_t)(bhv_desc_t *, xfs_off_t, ssize_t, int,
struct page_buf_bmap_s *, int *); struct xfs_iomap *, int *);
typedef int (*vop_reclaim_t)(bhv_desc_t *); typedef int (*vop_reclaim_t)(bhv_desc_t *);
typedef int (*vop_attr_get_t)(bhv_desc_t *, char *, char *, int *, int, typedef int (*vop_attr_get_t)(bhv_desc_t *, char *, char *, int *, int,
struct cred *); struct cred *);
......
...@@ -67,29 +67,6 @@ typedef enum page_buf_rw_e { ...@@ -67,29 +67,6 @@ typedef enum page_buf_rw_e {
PBRW_ZERO = 3 /* Zero target memory */ PBRW_ZERO = 3 /* Zero target memory */
} page_buf_rw_t; } page_buf_rw_t;
typedef enum { /* pbm_flags values */
PBMF_EOF = 0x01, /* mapping contains EOF */
PBMF_HOLE = 0x02, /* mapping covers a hole */
PBMF_DELAY = 0x04, /* mapping covers delalloc region */
PBMF_UNWRITTEN = 0x20, /* mapping covers allocated */
/* but uninitialized file data */
PBMF_NEW = 0x40 /* just allocated */
} bmap_flags_t;
typedef enum {
/* base extent manipulation calls */
BMAP_READ = (1 << 0), /* read extents */
BMAP_WRITE = (1 << 1), /* create extents */
BMAP_ALLOCATE = (1 << 2), /* delayed allocate to real extents */
BMAP_UNWRITTEN = (1 << 3), /* unwritten extents to real extents */
/* modifiers */
BMAP_IGNSTATE = (1 << 4), /* ignore unwritten state on read */
BMAP_DIRECT = (1 << 5), /* direct instead of buffered write */
BMAP_MMAP = (1 << 6), /* allocate for mmap write */
BMAP_SYNC = (1 << 7), /* sync write */
BMAP_TRYLOCK = (1 << 8), /* non-blocking request */
BMAP_DEVICE = (1 << 9), /* we only want to know the device */
} bmapi_flags_t;
typedef enum page_buf_flags_e { /* pb_flags values */ typedef enum page_buf_flags_e { /* pb_flags values */
PBF_READ = (1 << 0), /* buffer intended for reading from device */ PBF_READ = (1 << 0), /* buffer intended for reading from device */
...@@ -138,36 +115,6 @@ typedef struct pb_target { ...@@ -138,36 +115,6 @@ typedef struct pb_target {
size_t pbr_smask; size_t pbr_smask;
} pb_target_t; } pb_target_t;
/*
* page_buf_bmap_t: File system I/O map
*
* The pbm_bn, pbm_offset and pbm_length fields are expressed in disk blocks.
* The pbm_length field specifies the size of the underlying backing store
* for the particular mapping.
*
* The pbm_bsize, pbm_size and pbm_delta fields are in bytes and indicate
* the size of the mapping, the number of bytes that are valid to access
* (read or write), and the offset into the mapping, given the offset
* supplied to the file I/O map routine. pbm_delta is the offset of the
* desired data from the beginning of the mapping.
*
* When a request is made to read beyond the logical end of the object,
* pbm_size may be set to 0, but pbm_offset and pbm_length should be set to
* the actual amount of underlying storage that has been allocated, if any.
*/
typedef struct page_buf_bmap_s {
page_buf_daddr_t pbm_bn; /* block number in file system */
pb_target_t *pbm_target; /* device to do I/O to */
loff_t pbm_offset; /* byte offset of mapping in file */
size_t pbm_delta; /* offset of request into bmap */
size_t pbm_bsize; /* size of this mapping in bytes */
bmap_flags_t pbm_flags; /* options flags for mapping */
} page_buf_bmap_t;
typedef page_buf_bmap_t pb_bmap_t;
/* /*
* page_buf_t: Buffer structure for page cache-based buffers * page_buf_t: Buffer structure for page cache-based buffers
* *
......
...@@ -61,6 +61,7 @@ ...@@ -61,6 +61,7 @@
#include "xfs_rw.h" #include "xfs_rw.h"
#include "xfs_quota.h" #include "xfs_quota.h"
#include "xfs_trans_space.h" #include "xfs_trans_space.h"
#include "xfs_iomap.h"
STATIC xfs_fsize_t STATIC xfs_fsize_t
......
/*
* Copyright (c) 2003 Silicon Graphics, Inc. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* 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.
*
* Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement
* or the like. Any license provided herein, whether implied or
* otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston MA 02111-1307, USA.
*
* Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
* Mountain View, CA 94043, or:
*
* http://www.sgi.com
*
* For further information regarding this notice, see:
*
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
#ifndef __XFS_IOMAP_H__
#define __XFS_IOMAP_H__
#define IOMAP_DADDR_NULL ((xfs_daddr_t) (-1LL))
typedef enum { /* iomap_flags values */
IOMAP_EOF = 0x01, /* mapping contains EOF */
IOMAP_HOLE = 0x02, /* mapping covers a hole */
IOMAP_DELAY = 0x04, /* mapping covers delalloc region */
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 */
BMAPI_UNWRITTEN = (1 << 3), /* unwritten extents to real extents */
/* modifiers */
BMAPI_IGNSTATE = (1 << 4), /* ignore unwritten state on read */
BMAPI_DIRECT = (1 << 5), /* direct instead of buffered write */
BMAPI_MMAP = (1 << 6), /* allocate for mmap write */
BMAPI_SYNC = (1 << 7), /* sync write */
BMAPI_TRYLOCK = (1 << 8), /* non-blocking request */
BMAPI_DEVICE = (1 << 9), /* we only want to know the device */
} bmapi_flags_t;
/*
* xfs_iomap_t: File system I/O map
*
* The iomap_bn, iomap_offset and iomap_length fields are expressed in disk blocks.
* The iomap_length field specifies the size of the underlying backing store
* for the particular mapping.
*
* The iomap_bsize, iomap_size and iomap_delta fields are in bytes and indicate
* the size of the mapping, the number of bytes that are valid to access
* (read or write), and the offset into the mapping, given the offset
* supplied to the file I/O map routine. iomap_delta is the offset of the
* desired data from the beginning of the mapping.
*
* 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;
xfs_buftarg_t *iomap_target;
loff_t iomap_offset;
size_t iomap_delta;
size_t iomap_bsize;
iomap_flags_t iomap_flags;
} xfs_iomap_t;
struct xfs_iocore;
struct xfs_inode;
struct xfs_bmbt_irec;
extern int xfs_iomap(struct xfs_iocore *, xfs_off_t, ssize_t, int,
struct xfs_iomap *, int *);
extern int xfs_iomap_write_direct(struct xfs_inode *, loff_t, size_t,
int, struct xfs_bmbt_irec *, int *, int);
extern int xfs_iomap_write_delay(struct xfs_inode *, loff_t, size_t, int,
struct xfs_bmbt_irec *, int *);
extern int xfs_iomap_write_allocate(struct xfs_inode *,
struct xfs_bmbt_irec *, int *);
extern int xfs_iomap_write_unwritten(struct xfs_inode *, loff_t, size_t);
#endif /* __XFS_IOMAP_H__*/
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment