| To: | david@xxxxxxxxxxxxx, darrick.wong@xxxxxxxxxx |
|---|---|
| Subject: | [PATCH 19/71] xfs: adjust refcount when unmapping file blocks |
| From: | "Darrick J. Wong" <darrick.wong@xxxxxxxxxx> |
| Date: | Thu, 25 Aug 2016 16:34:00 -0700 |
| Cc: | linux-xfs@xxxxxxxxxxxxxxx, xfs@xxxxxxxxxxx |
| Delivered-to: | xfs@xxxxxxxxxxx |
| In-reply-to: | <147216791538.867.12413509832420924168.stgit@xxxxxxxxxxxxxxxx> |
| References: | <147216791538.867.12413509832420924168.stgit@xxxxxxxxxxxxxxxx> |
| User-agent: | StGit/0.17.1-dirty |
When we're unmapping blocks from a reflinked file, decrease the
refcount of the affected blocks and free the extents that are no
longer in use.
v2: Use deferred ops system to avoid deadlocks and running out of
transaction reservation.
Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
---
fs/xfs/libxfs/xfs_bmap.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
index 042d7bf..5e0c9ec 100644
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -48,6 +48,7 @@
#include "xfs_filestream.h"
#include "xfs_rmap.h"
#include "xfs_ag_resv.h"
+#include "xfs_refcount.h"
kmem_zone_t *xfs_bmap_free_item_zone;
@@ -5062,9 +5063,16 @@ xfs_bmap_del_extent(
/*
* If we need to, add to list of extents to delete.
*/
- if (do_fx)
- xfs_bmap_add_free(mp, dfops, del->br_startblock,
- del->br_blockcount, NULL);
+ if (do_fx) {
+ if (xfs_is_reflink_inode(ip) && whichfork == XFS_DATA_FORK) {
+ error = xfs_refcount_decrease_extent(mp, dfops, del);
+ if (error)
+ goto done;
+ } else
+ xfs_bmap_add_free(mp, dfops, del->br_startblock,
+ del->br_blockcount, NULL);
+ }
+
/*
* Adjust inode # blocks in the file.
*/
|
| Previous by Date: | [PATCH 18/71] xfs: connect refcount adjust functions to upper layers, Darrick J. Wong |
|---|---|
| Next by Date: | [PATCH 20/71] xfs: add refcount btree block detection to log recovery, Darrick J. Wong |
| Previous by Thread: | [PATCH 18/71] xfs: connect refcount adjust functions to upper layers, Darrick J. Wong |
| Next by Thread: | [PATCH 20/71] xfs: add refcount btree block detection to log recovery, Darrick J. Wong |
| Indexes: | [Date] [Thread] [Top] [All Lists] |