| To: | david@xxxxxxxxxxxxx, darrick.wong@xxxxxxxxxx |
|---|---|
| Subject: | [PATCH 43/71] xfs: cancel pending CoW reservations when destroying inodes |
| From: | "Darrick J. Wong" <darrick.wong@xxxxxxxxxx> |
| Date: | Thu, 25 Aug 2016 16:36:36 -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 destroying the inode, cancel all pending reservations in the CoW
fork so that all the reserved blocks go back to the free pile. In
theory this sort of cleanup is only needed to clean up after write
errors.
Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
---
fs/xfs/xfs_super.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index f62d50c..86afb15 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -49,6 +49,7 @@
#include "xfs_rmap_item.h"
#include "xfs_refcount_item.h"
#include "xfs_bmap_item.h"
+#include "xfs_reflink.h"
#include <linux/namei.h>
#include <linux/init.h>
@@ -938,6 +939,7 @@ xfs_fs_destroy_inode(
struct inode *inode)
{
struct xfs_inode *ip = XFS_I(inode);
+ int error;
trace_xfs_destroy_inode(ip);
@@ -945,6 +947,12 @@ xfs_fs_destroy_inode(
XFS_STATS_INC(ip->i_mount, vn_rele);
XFS_STATS_INC(ip->i_mount, vn_remove);
+ error = xfs_reflink_cancel_cow_range(ip, 0, NULLFILEOFF);
+ if (error && !XFS_FORCED_SHUTDOWN(ip->i_mount))
+ xfs_warn(ip->i_mount, "Error %d while evicting CoW blocks "
+ "for inode %llu.",
+ error, ip->i_ino);
+
xfs_inactive(ip);
ASSERT(XFS_FORCED_SHUTDOWN(ip->i_mount) || ip->i_delayed_blks == 0);
|
| Previous by Date: | [PATCH 42/71] xfs: cancel CoW reservations and clear inode reflink flag when freeing blocks, Darrick J. Wong |
|---|---|
| Next by Date: | [PATCH 44/71] xfs: store in-progress CoW allocations in the refcount btree, Darrick J. Wong |
| Previous by Thread: | [PATCH 42/71] xfs: cancel CoW reservations and clear inode reflink flag when freeing blocks, Darrick J. Wong |
| Next by Thread: | [PATCH 44/71] xfs: store in-progress CoW allocations in the refcount btree, Darrick J. Wong |
| Indexes: | [Date] [Thread] [Top] [All Lists] |