2005-04-17 06:20:36 +08:00
|
|
|
/*
|
2006-06-09 12:48:12 +08:00
|
|
|
* Copyright (c) 2000-2006 Silicon Graphics, Inc.
|
2005-11-02 11:58:39 +08:00
|
|
|
* All Rights Reserved.
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
2005-11-02 11:58:39 +08:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
2005-04-17 06:20:36 +08:00
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
2005-11-02 11:58:39 +08:00
|
|
|
* 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.
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
2005-11-02 11:58:39 +08:00
|
|
|
* 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
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
|
|
|
#ifndef __XFS_BMAP_H__
|
|
|
|
#define __XFS_BMAP_H__
|
|
|
|
|
|
|
|
struct getbmap;
|
|
|
|
struct xfs_bmbt_irec;
|
2006-03-14 10:29:52 +08:00
|
|
|
struct xfs_ifork;
|
2005-04-17 06:20:36 +08:00
|
|
|
struct xfs_inode;
|
|
|
|
struct xfs_mount;
|
|
|
|
struct xfs_trans;
|
|
|
|
|
2007-11-23 13:28:09 +08:00
|
|
|
extern kmem_zone_t *xfs_bmap_free_item_zone;
|
|
|
|
|
2015-01-09 07:46:49 +08:00
|
|
|
/*
|
|
|
|
* Argument structure for xfs_bmap_alloc.
|
|
|
|
*/
|
|
|
|
struct xfs_bmalloca {
|
|
|
|
xfs_fsblock_t *firstblock; /* i/o first block allocated */
|
2016-08-03 09:19:29 +08:00
|
|
|
struct xfs_defer_ops *dfops; /* bmap freelist */
|
2015-01-09 07:46:49 +08:00
|
|
|
struct xfs_trans *tp; /* transaction pointer */
|
|
|
|
struct xfs_inode *ip; /* incore inode pointer */
|
|
|
|
struct xfs_bmbt_irec prev; /* extent before the new one */
|
|
|
|
struct xfs_bmbt_irec got; /* extent after, or delayed */
|
|
|
|
|
|
|
|
xfs_fileoff_t offset; /* offset in file filling in */
|
|
|
|
xfs_extlen_t length; /* i/o length asked/allocated */
|
|
|
|
xfs_fsblock_t blkno; /* starting block of new extent */
|
|
|
|
|
|
|
|
struct xfs_btree_cur *cur; /* btree cursor */
|
2017-11-04 01:34:43 +08:00
|
|
|
struct xfs_iext_cursor icur; /* incore extent cursor */
|
2015-01-09 07:46:49 +08:00
|
|
|
int nallocs;/* number of extents alloc'd */
|
|
|
|
int logflags;/* flags for transaction logging */
|
|
|
|
|
|
|
|
xfs_extlen_t total; /* total blocks needed for xaction */
|
|
|
|
xfs_extlen_t minlen; /* minimum allocation size (blocks) */
|
|
|
|
xfs_extlen_t minleft; /* amount must be left after alloc */
|
|
|
|
bool eof; /* set if allocating past last extent */
|
|
|
|
bool wasdel; /* replacing a delayed allocation */
|
|
|
|
bool aeof; /* allocated space at eof */
|
|
|
|
bool conv; /* overwriting unwritten extents */
|
xfs: remote attribute blocks aren't really userdata
When adding a new remote attribute, we write the attribute to the
new extent before the allocation transaction is committed. This
means we cannot reuse busy extents as that violates crash
consistency semantics. Hence we currently treat remote attribute
extent allocation like userdata because it has the same overwrite
ordering constraints as userdata.
Unfortunately, this also allows the allocator to incorrectly apply
extent size hints to the remote attribute extent allocation. This
results in interesting failures, such as transaction block
reservation overruns and in-memory inode attribute fork corruption.
To fix this, we need to separate the busy extent reuse configuration
from the userdata configuration. This changes the definition of
XFS_BMAPI_METADATA slightly - it now means that allocation is
metadata and reuse of busy extents is acceptible due to the metadata
ordering semantics of the journal. If this flag is not set, it
means the allocation is that has unordered data writeback, and hence
busy extent reuse is not allowed. It no longer implies the
allocation is for user data, just that the data write will not be
strictly ordered. This matches the semantics for both user data
and remote attribute block allocation.
As such, This patch changes the "userdata" field to a "datatype"
field, and adds a "no busy reuse" flag to the field.
When we detect an unordered data extent allocation, we immediately set
the no reuse flag. We then set the "user data" flags based on the
inode fork we are allocating the extent to. Hence we only set
userdata flags on data fork allocations now and consider attribute
fork remote extents to be an unordered metadata extent.
The result is that remote attribute extents now have the expected
allocation semantics, and the data fork allocation behaviour is
completely unchanged.
It should be noted that there may be other ways to fix this (e.g.
use ordered metadata buffers for the remote attribute extent data
write) but they are more invasive and difficult to validate both
from a design and implementation POV. Hence this patch takes the
simple, obvious route to fixing the problem...
Reported-and-tested-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2016-09-26 06:21:28 +08:00
|
|
|
int datatype;/* data type being allocated */
|
2015-01-09 07:46:49 +08:00
|
|
|
int flags;
|
|
|
|
};
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* List of extents to be free "later".
|
|
|
|
* The list is kept sorted on xbf_startblock.
|
|
|
|
*/
|
2016-08-03 09:18:10 +08:00
|
|
|
struct xfs_extent_free_item
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2016-08-03 09:18:10 +08:00
|
|
|
xfs_fsblock_t xefi_startblock;/* starting fs block number */
|
|
|
|
xfs_extlen_t xefi_blockcount;/* number of blocks in extent */
|
|
|
|
struct list_head xefi_list;
|
2016-08-03 09:33:42 +08:00
|
|
|
struct xfs_owner_info xefi_oinfo; /* extent owner */
|
2016-06-21 09:53:28 +08:00
|
|
|
};
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#define XFS_BMAP_MAX_NMAP 4
|
|
|
|
|
|
|
|
/*
|
2011-09-19 04:40:52 +08:00
|
|
|
* Flags for xfs_bmapi_*
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
2011-09-19 04:40:52 +08:00
|
|
|
#define XFS_BMAPI_ENTIRE 0x001 /* return entire extent, not trimmed */
|
|
|
|
#define XFS_BMAPI_METADATA 0x002 /* mapping metadata not user data */
|
|
|
|
#define XFS_BMAPI_ATTRFORK 0x004 /* use attribute fork not data */
|
|
|
|
#define XFS_BMAPI_PREALLOC 0x008 /* preallocation op: unwritten space */
|
|
|
|
#define XFS_BMAPI_IGSTATE 0x010 /* Ignore state - */
|
2005-04-17 06:20:36 +08:00
|
|
|
/* combine contig. space */
|
2011-09-19 04:40:52 +08:00
|
|
|
#define XFS_BMAPI_CONTIG 0x020 /* must allocate only one extent */
|
2010-08-24 10:02:11 +08:00
|
|
|
/*
|
|
|
|
* unwritten extent conversion - this needs write cache flushing and no additional
|
|
|
|
* allocation alignments. When specified with XFS_BMAPI_PREALLOC it converts
|
|
|
|
* from written to unwritten, otherwise convert from unwritten to written.
|
|
|
|
*/
|
2011-09-19 04:40:52 +08:00
|
|
|
#define XFS_BMAPI_CONVERT 0x040
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2015-11-03 09:27:22 +08:00
|
|
|
/*
|
|
|
|
* allocate zeroed extents - this requires all newly allocated user data extents
|
|
|
|
* to be initialised to zero. It will be ignored if XFS_BMAPI_METADATA is set.
|
|
|
|
* Use in conjunction with XFS_BMAPI_CONVERT to convert unwritten extents found
|
|
|
|
* during the allocation range to zeroed written extents.
|
|
|
|
*/
|
|
|
|
#define XFS_BMAPI_ZERO 0x080
|
|
|
|
|
2016-10-04 00:11:27 +08:00
|
|
|
/*
|
|
|
|
* Map the inode offset to the block given in ap->firstblock. Primarily
|
|
|
|
* used for reflink. The range must be in a hole, and this flag cannot be
|
|
|
|
* turned on with PREALLOC or CONVERT, and cannot be used on the attr fork.
|
2016-10-04 00:11:27 +08:00
|
|
|
*
|
|
|
|
* For bunmapi, this flag unmaps the range without adjusting quota, reducing
|
|
|
|
* refcount, or freeing the blocks.
|
2016-10-04 00:11:27 +08:00
|
|
|
*/
|
|
|
|
#define XFS_BMAPI_REMAP 0x100
|
|
|
|
|
2016-10-04 00:11:32 +08:00
|
|
|
/* Map something in the CoW fork. */
|
|
|
|
#define XFS_BMAPI_COWFORK 0x200
|
|
|
|
|
2017-01-21 01:31:54 +08:00
|
|
|
/* Only convert delalloc space, don't allocate entirely new extents */
|
|
|
|
#define XFS_BMAPI_DELALLOC 0x400
|
|
|
|
|
2017-11-04 01:34:44 +08:00
|
|
|
/* Only convert unwritten extents, don't allocate new blocks */
|
|
|
|
#define XFS_BMAPI_CONVERT_ONLY 0x800
|
|
|
|
|
2009-12-15 07:14:59 +08:00
|
|
|
#define XFS_BMAPI_FLAGS \
|
|
|
|
{ XFS_BMAPI_ENTIRE, "ENTIRE" }, \
|
|
|
|
{ XFS_BMAPI_METADATA, "METADATA" }, \
|
|
|
|
{ XFS_BMAPI_ATTRFORK, "ATTRFORK" }, \
|
|
|
|
{ XFS_BMAPI_PREALLOC, "PREALLOC" }, \
|
|
|
|
{ XFS_BMAPI_IGSTATE, "IGSTATE" }, \
|
|
|
|
{ XFS_BMAPI_CONTIG, "CONTIG" }, \
|
2015-11-03 09:27:22 +08:00
|
|
|
{ XFS_BMAPI_CONVERT, "CONVERT" }, \
|
2016-10-04 00:11:27 +08:00
|
|
|
{ XFS_BMAPI_ZERO, "ZERO" }, \
|
2016-10-04 00:11:32 +08:00
|
|
|
{ XFS_BMAPI_REMAP, "REMAP" }, \
|
2017-01-21 01:31:54 +08:00
|
|
|
{ XFS_BMAPI_COWFORK, "COWFORK" }, \
|
2017-11-04 01:34:44 +08:00
|
|
|
{ XFS_BMAPI_DELALLOC, "DELALLOC" }, \
|
|
|
|
{ XFS_BMAPI_CONVERT_ONLY, "CONVERT_ONLY" }
|
2009-12-15 07:14:59 +08:00
|
|
|
|
|
|
|
|
2005-11-02 11:38:42 +08:00
|
|
|
static inline int xfs_bmapi_aflag(int w)
|
|
|
|
{
|
2016-10-04 00:11:32 +08:00
|
|
|
return (w == XFS_ATTR_FORK ? XFS_BMAPI_ATTRFORK :
|
|
|
|
(w == XFS_COW_FORK ? XFS_BMAPI_COWFORK : 0));
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int xfs_bmapi_whichfork(int bmapi_flags)
|
|
|
|
{
|
|
|
|
if (bmapi_flags & XFS_BMAPI_COWFORK)
|
|
|
|
return XFS_COW_FORK;
|
|
|
|
else if (bmapi_flags & XFS_BMAPI_ATTRFORK)
|
|
|
|
return XFS_ATTR_FORK;
|
|
|
|
return XFS_DATA_FORK;
|
2005-11-02 11:38:42 +08:00
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Special values for xfs_bmbt_irec_t br_startblock field.
|
|
|
|
*/
|
|
|
|
#define DELAYSTARTBLOCK ((xfs_fsblock_t)-1LL)
|
|
|
|
#define HOLESTARTBLOCK ((xfs_fsblock_t)-2LL)
|
|
|
|
|
2009-11-25 08:00:19 +08:00
|
|
|
/*
|
|
|
|
* Flags for xfs_bmap_add_extent*.
|
|
|
|
*/
|
|
|
|
#define BMAP_LEFT_CONTIG (1 << 0)
|
|
|
|
#define BMAP_RIGHT_CONTIG (1 << 1)
|
|
|
|
#define BMAP_LEFT_FILLING (1 << 2)
|
|
|
|
#define BMAP_RIGHT_FILLING (1 << 3)
|
|
|
|
#define BMAP_LEFT_DELAY (1 << 4)
|
|
|
|
#define BMAP_RIGHT_DELAY (1 << 5)
|
|
|
|
#define BMAP_LEFT_VALID (1 << 6)
|
|
|
|
#define BMAP_RIGHT_VALID (1 << 7)
|
2009-11-25 08:00:21 +08:00
|
|
|
#define BMAP_ATTRFORK (1 << 8)
|
2016-10-04 00:11:32 +08:00
|
|
|
#define BMAP_COWFORK (1 << 9)
|
2009-11-25 08:00:19 +08:00
|
|
|
|
2009-12-15 07:14:59 +08:00
|
|
|
#define XFS_BMAP_EXT_FLAGS \
|
|
|
|
{ BMAP_LEFT_CONTIG, "LC" }, \
|
|
|
|
{ BMAP_RIGHT_CONTIG, "RC" }, \
|
|
|
|
{ BMAP_LEFT_FILLING, "LF" }, \
|
|
|
|
{ BMAP_RIGHT_FILLING, "RF" }, \
|
2016-10-04 00:11:32 +08:00
|
|
|
{ BMAP_ATTRFORK, "ATTR" }, \
|
|
|
|
{ BMAP_COWFORK, "COW" }
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2014-02-24 07:58:19 +08:00
|
|
|
|
2017-03-29 05:53:35 +08:00
|
|
|
/*
|
|
|
|
* Return true if the extent is a real, allocated extent, or false if it is a
|
|
|
|
* delayed allocation, and unwritten extent or a hole.
|
|
|
|
*/
|
|
|
|
static inline bool xfs_bmap_is_real_extent(struct xfs_bmbt_irec *irec)
|
|
|
|
{
|
|
|
|
return irec->br_state != XFS_EXT_UNWRITTEN &&
|
|
|
|
irec->br_startblock != HOLESTARTBLOCK &&
|
|
|
|
irec->br_startblock != DELAYSTARTBLOCK &&
|
|
|
|
!isnullstartblock(irec->br_startblock);
|
|
|
|
}
|
|
|
|
|
2016-10-20 12:51:50 +08:00
|
|
|
void xfs_trim_extent(struct xfs_bmbt_irec *irec, xfs_fileoff_t bno,
|
|
|
|
xfs_filblks_t len);
|
xfs: trim writepage mapping to within eof
The writeback rework in commit fbcc02561359 ("xfs: Introduce
writeback context for writepages") introduced a subtle change in
behavior with regard to the block mapping used across the
->writepages() sequence. The previous xfs_cluster_write() code would
only flush pages up to EOF at the time of the writepage, thus
ensuring that any pages due to file-extending writes would be
handled on a separate cycle and with a new, updated block mapping.
The updated code establishes a block mapping in xfs_writepage_map()
that could extend beyond EOF if the file has post-eof preallocation.
Because we now use the generic writeback infrastructure and pass the
cached mapping to each writepage call, there is no implicit EOF
limit in place. If eofblocks trimming occurs during ->writepages(),
any post-eof portion of the cached mapping becomes invalid. The
eofblocks code has no means to serialize against writeback because
there are no pages associated with post-eof blocks. Therefore if an
eofblocks trim occurs and is followed by a file-extending buffered
write, not only has the mapping become invalid, but we could end up
writing a page to disk based on the invalid mapping.
Consider the following sequence of events:
- A buffered write creates a delalloc extent and post-eof
speculative preallocation.
- Writeback starts and on the first writepage cycle, the delalloc
extent is converted to real blocks (including the post-eof blocks)
and the mapping is cached.
- The file is closed and xfs_release() trims post-eof blocks. The
cached writeback mapping is now invalid.
- Another buffered write appends the file with a delalloc extent.
- The concurrent writeback cycle picks up the just written page
because the writeback range end is LLONG_MAX. xfs_writepage_map()
attributes it to the (now invalid) cached mapping and writes the
data to an incorrect location on disk (and where the file offset is
still backed by a delalloc extent).
This problem is reproduced by xfstests test generic/464, which
triggers racing writes, appends, open/closes and writeback requests.
To address this problem, trim the mapping used during writeback to
within EOF when the mapping is validated. This ensures the mapping
is revalidated for any pages encountered beyond EOF as of the time
the current mapping was cached or last validated.
Reported-by: Eryu Guan <eguan@redhat.com>
Diagnosed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2017-10-14 00:47:46 +08:00
|
|
|
void xfs_trim_extent_eof(struct xfs_bmbt_irec *, struct xfs_inode *);
|
2011-09-19 04:41:07 +08:00
|
|
|
int xfs_bmap_add_attrfork(struct xfs_inode *ip, int size, int rsvd);
|
2013-07-10 05:04:00 +08:00
|
|
|
void xfs_bmap_local_to_extents_empty(struct xfs_inode *ip, int whichfork);
|
2016-08-03 09:19:29 +08:00
|
|
|
void xfs_bmap_add_free(struct xfs_mount *mp, struct xfs_defer_ops *dfops,
|
2016-08-03 09:33:42 +08:00
|
|
|
xfs_fsblock_t bno, xfs_filblks_t len,
|
|
|
|
struct xfs_owner_info *oinfo);
|
2011-09-19 04:41:07 +08:00
|
|
|
void xfs_bmap_compute_maxlevels(struct xfs_mount *mp, int whichfork);
|
|
|
|
int xfs_bmap_first_unused(struct xfs_trans *tp, struct xfs_inode *ip,
|
|
|
|
xfs_extlen_t len, xfs_fileoff_t *unused, int whichfork);
|
|
|
|
int xfs_bmap_last_before(struct xfs_trans *tp, struct xfs_inode *ip,
|
|
|
|
xfs_fileoff_t *last_block, int whichfork);
|
2014-04-14 16:58:05 +08:00
|
|
|
int xfs_bmap_last_offset(struct xfs_inode *ip, xfs_fileoff_t *unused,
|
|
|
|
int whichfork);
|
2011-09-19 04:41:07 +08:00
|
|
|
int xfs_bmap_one_block(struct xfs_inode *ip, int whichfork);
|
2011-09-19 04:40:45 +08:00
|
|
|
int xfs_bmapi_read(struct xfs_inode *ip, xfs_fileoff_t bno,
|
|
|
|
xfs_filblks_t len, struct xfs_bmbt_irec *mval,
|
|
|
|
int *nmap, int flags);
|
2011-09-19 04:40:52 +08:00
|
|
|
int xfs_bmapi_write(struct xfs_trans *tp, struct xfs_inode *ip,
|
|
|
|
xfs_fileoff_t bno, xfs_filblks_t len, int flags,
|
|
|
|
xfs_fsblock_t *firstblock, xfs_extlen_t total,
|
|
|
|
struct xfs_bmbt_irec *mval, int *nmap,
|
2016-08-03 09:19:29 +08:00
|
|
|
struct xfs_defer_ops *dfops);
|
2016-10-04 00:11:29 +08:00
|
|
|
int __xfs_bunmapi(struct xfs_trans *tp, struct xfs_inode *ip,
|
|
|
|
xfs_fileoff_t bno, xfs_filblks_t *rlen, int flags,
|
|
|
|
xfs_extnum_t nexts, xfs_fsblock_t *firstblock,
|
|
|
|
struct xfs_defer_ops *dfops);
|
2011-09-19 04:41:07 +08:00
|
|
|
int xfs_bunmapi(struct xfs_trans *tp, struct xfs_inode *ip,
|
|
|
|
xfs_fileoff_t bno, xfs_filblks_t len, int flags,
|
|
|
|
xfs_extnum_t nexts, xfs_fsblock_t *firstblock,
|
2016-08-03 09:19:29 +08:00
|
|
|
struct xfs_defer_ops *dfops, int *done);
|
2016-10-20 12:54:14 +08:00
|
|
|
int xfs_bmap_del_extent_delay(struct xfs_inode *ip, int whichfork,
|
2017-11-04 01:34:43 +08:00
|
|
|
struct xfs_iext_cursor *cur, struct xfs_bmbt_irec *got,
|
|
|
|
struct xfs_bmbt_irec *del);
|
|
|
|
void xfs_bmap_del_extent_cow(struct xfs_inode *ip,
|
|
|
|
struct xfs_iext_cursor *cur, struct xfs_bmbt_irec *got,
|
2016-10-20 12:54:14 +08:00
|
|
|
struct xfs_bmbt_irec *del);
|
2011-09-19 04:41:07 +08:00
|
|
|
uint xfs_default_attroffset(struct xfs_inode *ip);
|
2017-10-20 02:07:11 +08:00
|
|
|
int xfs_bmap_collapse_extents(struct xfs_trans *tp, struct xfs_inode *ip,
|
2015-03-25 12:08:56 +08:00
|
|
|
xfs_fileoff_t *next_fsb, xfs_fileoff_t offset_shift_fsb,
|
2017-10-20 02:07:11 +08:00
|
|
|
bool *done, xfs_fileoff_t stop_fsb, xfs_fsblock_t *firstblock,
|
|
|
|
struct xfs_defer_ops *dfops);
|
|
|
|
int xfs_bmap_insert_extents(struct xfs_trans *tp, struct xfs_inode *ip,
|
|
|
|
xfs_fileoff_t *next_fsb, xfs_fileoff_t offset_shift_fsb,
|
|
|
|
bool *done, xfs_fileoff_t stop_fsb, xfs_fsblock_t *firstblock,
|
|
|
|
struct xfs_defer_ops *dfops);
|
2015-03-25 12:08:56 +08:00
|
|
|
int xfs_bmap_split_extent(struct xfs_inode *ip, xfs_fileoff_t split_offset);
|
2016-10-04 00:11:32 +08:00
|
|
|
int xfs_bmapi_reserve_delalloc(struct xfs_inode *ip, int whichfork,
|
2016-11-28 11:57:42 +08:00
|
|
|
xfs_fileoff_t off, xfs_filblks_t len, xfs_filblks_t prealloc,
|
2017-11-04 01:34:43 +08:00
|
|
|
struct xfs_bmbt_irec *got, struct xfs_iext_cursor *cur,
|
|
|
|
int eof);
|
2009-03-30 01:26:46 +08:00
|
|
|
|
2016-10-04 00:11:26 +08:00
|
|
|
enum xfs_bmap_intent_type {
|
|
|
|
XFS_BMAP_MAP = 1,
|
|
|
|
XFS_BMAP_UNMAP,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct xfs_bmap_intent {
|
|
|
|
struct list_head bi_list;
|
|
|
|
enum xfs_bmap_intent_type bi_type;
|
|
|
|
struct xfs_inode *bi_owner;
|
|
|
|
int bi_whichfork;
|
|
|
|
struct xfs_bmbt_irec bi_bmap;
|
|
|
|
};
|
|
|
|
|
2016-10-04 00:11:28 +08:00
|
|
|
int xfs_bmap_finish_one(struct xfs_trans *tp, struct xfs_defer_ops *dfops,
|
|
|
|
struct xfs_inode *ip, enum xfs_bmap_intent_type type,
|
|
|
|
int whichfork, xfs_fileoff_t startoff, xfs_fsblock_t startblock,
|
2017-06-15 12:25:57 +08:00
|
|
|
xfs_filblks_t *blockcount, xfs_exntst_t state);
|
2016-10-04 00:11:28 +08:00
|
|
|
int xfs_bmap_map_extent(struct xfs_mount *mp, struct xfs_defer_ops *dfops,
|
|
|
|
struct xfs_inode *ip, struct xfs_bmbt_irec *imap);
|
|
|
|
int xfs_bmap_unmap_extent(struct xfs_mount *mp, struct xfs_defer_ops *dfops,
|
|
|
|
struct xfs_inode *ip, struct xfs_bmbt_irec *imap);
|
|
|
|
|
2017-10-20 02:02:29 +08:00
|
|
|
static inline int xfs_bmap_fork_to_state(int whichfork)
|
|
|
|
{
|
|
|
|
switch (whichfork) {
|
|
|
|
case XFS_ATTR_FORK:
|
|
|
|
return BMAP_ATTRFORK;
|
|
|
|
case XFS_COW_FORK:
|
|
|
|
return BMAP_COWFORK;
|
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
#endif /* __XFS_BMAP_H__ */
|