xfs: add bmapi nodiscard flag
Freed extents are unconditionally discarded when online discard is enabled. Define XFS_BMAPI_NODISCARD to allow callers to bypass discards when unnecessary. For example, this will be useful for eofblocks trimming. This patch does not change behavior. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
This commit is contained in:

committed by
Darrick J. Wong

parent
e6631f8554
commit
fcb762f5de
@@ -68,6 +68,7 @@ struct xfs_extent_free_item
|
||||
xfs_extlen_t xefi_blockcount;/* number of blocks in extent */
|
||||
struct list_head xefi_list;
|
||||
struct xfs_owner_info xefi_oinfo; /* extent owner */
|
||||
bool xefi_skip_discard;
|
||||
};
|
||||
|
||||
#define XFS_BMAP_MAX_NMAP 4
|
||||
@@ -116,6 +117,9 @@ struct xfs_extent_free_item
|
||||
/* Only convert unwritten extents, don't allocate new blocks */
|
||||
#define XFS_BMAPI_CONVERT_ONLY 0x800
|
||||
|
||||
/* Skip online discard of freed extents */
|
||||
#define XFS_BMAPI_NODISCARD 0x1000
|
||||
|
||||
#define XFS_BMAPI_FLAGS \
|
||||
{ XFS_BMAPI_ENTIRE, "ENTIRE" }, \
|
||||
{ XFS_BMAPI_METADATA, "METADATA" }, \
|
||||
@@ -128,7 +132,8 @@ struct xfs_extent_free_item
|
||||
{ XFS_BMAPI_REMAP, "REMAP" }, \
|
||||
{ XFS_BMAPI_COWFORK, "COWFORK" }, \
|
||||
{ XFS_BMAPI_DELALLOC, "DELALLOC" }, \
|
||||
{ XFS_BMAPI_CONVERT_ONLY, "CONVERT_ONLY" }
|
||||
{ XFS_BMAPI_CONVERT_ONLY, "CONVERT_ONLY" }, \
|
||||
{ XFS_BMAPI_NODISCARD, "NODISCARD" }
|
||||
|
||||
|
||||
static inline int xfs_bmapi_aflag(int w)
|
||||
@@ -192,9 +197,9 @@ void xfs_trim_extent(struct xfs_bmbt_irec *irec, xfs_fileoff_t bno,
|
||||
void xfs_trim_extent_eof(struct xfs_bmbt_irec *, struct xfs_inode *);
|
||||
int xfs_bmap_add_attrfork(struct xfs_inode *ip, int size, int rsvd);
|
||||
void xfs_bmap_local_to_extents_empty(struct xfs_inode *ip, int whichfork);
|
||||
void xfs_bmap_add_free(struct xfs_mount *mp, struct xfs_defer_ops *dfops,
|
||||
void __xfs_bmap_add_free(struct xfs_mount *mp, struct xfs_defer_ops *dfops,
|
||||
xfs_fsblock_t bno, xfs_filblks_t len,
|
||||
struct xfs_owner_info *oinfo);
|
||||
struct xfs_owner_info *oinfo, bool skip_discard);
|
||||
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);
|
||||
@@ -240,6 +245,28 @@ int xfs_bmapi_reserve_delalloc(struct xfs_inode *ip, int whichfork,
|
||||
struct xfs_bmbt_irec *got, struct xfs_iext_cursor *cur,
|
||||
int eof);
|
||||
|
||||
static inline void
|
||||
xfs_bmap_add_free(
|
||||
struct xfs_mount *mp,
|
||||
struct xfs_defer_ops *dfops,
|
||||
xfs_fsblock_t bno,
|
||||
xfs_filblks_t len,
|
||||
struct xfs_owner_info *oinfo)
|
||||
{
|
||||
__xfs_bmap_add_free(mp, dfops, bno, len, oinfo, false);
|
||||
}
|
||||
|
||||
static inline void
|
||||
xfs_bmap_add_free_nodiscard(
|
||||
struct xfs_mount *mp,
|
||||
struct xfs_defer_ops *dfops,
|
||||
xfs_fsblock_t bno,
|
||||
xfs_filblks_t len,
|
||||
struct xfs_owner_info *oinfo)
|
||||
{
|
||||
__xfs_bmap_add_free(mp, dfops, bno, len, oinfo, true);
|
||||
}
|
||||
|
||||
enum xfs_bmap_intent_type {
|
||||
XFS_BMAP_MAP = 1,
|
||||
XFS_BMAP_UNMAP,
|
||||
|
Reference in New Issue
Block a user