All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: mfasheh@versity.com, akpm@linux-foundation.org,
	jlbec@evilplan.org, darrick.wong@oracle.com
Cc: linux-fsdevel@vger.kernel.org, hch@infradead.org,
	ocfs2-devel@oss.oracle.com
Subject: [PATCH 8/8] ocfs2: charge quota for reflinked blocks
Date: Thu, 01 Dec 2016 16:55:14 -0800	[thread overview]
Message-ID: <148064011424.14039.9933990570615486837.stgit@birch.djwong.org> (raw)
In-Reply-To: <148064006267.14039.3248903225701175868.stgit@birch.djwong.org>

When ocfs2 shares blocks from one file to another, it's necessary to
charge that many blocks to the quota because ocfs2 tallies block charges
according to the number of blocks mapped, not the number of physical
blocks used.

Without this patch, reflinking X blocks and then CoWing all of them
causes quota usage to *decrease* by X as seen in generic/305.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 fs/ocfs2/refcounttree.c |    7 +++++++
 1 file changed, 7 insertions(+)


diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c
index 57297ce..33555d58 100644
--- a/fs/ocfs2/refcounttree.c
+++ b/fs/ocfs2/refcounttree.c
@@ -3934,6 +3934,13 @@ static int ocfs2_add_refcounted_extent(struct inode *inode,
 	ret = ocfs2_increase_refcount(handle, ref_ci, ref_root_bh,
 				      p_cluster, num_clusters,
 				      meta_ac, dealloc);
+	if (ret) {
+		mlog_errno(ret);
+		goto out_commit;
+	}
+
+	ret = dquot_alloc_space_nodirty(inode,
+		ocfs2_clusters_to_bytes(osb->sb, num_clusters));
 	if (ret)
 		mlog_errno(ret);
 


WARNING: multiple messages have this Message-ID (diff)
From: Darrick J. Wong <darrick.wong@oracle.com>
To: mfasheh@versity.com, akpm@linux-foundation.org,
	jlbec@evilplan.org, darrick.wong@oracle.com
Cc: linux-fsdevel@vger.kernel.org, hch@infradead.org,
	ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH 8/8] ocfs2: charge quota for reflinked blocks
Date: Thu, 01 Dec 2016 16:55:14 -0800	[thread overview]
Message-ID: <148064011424.14039.9933990570615486837.stgit@birch.djwong.org> (raw)
In-Reply-To: <148064006267.14039.3248903225701175868.stgit@birch.djwong.org>

When ocfs2 shares blocks from one file to another, it's necessary to
charge that many blocks to the quota because ocfs2 tallies block charges
according to the number of blocks mapped, not the number of physical
blocks used.

Without this patch, reflinking X blocks and then CoWing all of them
causes quota usage to *decrease* by X as seen in generic/305.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 fs/ocfs2/refcounttree.c |    7 +++++++
 1 file changed, 7 insertions(+)


diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c
index 57297ce..33555d58 100644
--- a/fs/ocfs2/refcounttree.c
+++ b/fs/ocfs2/refcounttree.c
@@ -3934,6 +3934,13 @@ static int ocfs2_add_refcounted_extent(struct inode *inode,
 	ret = ocfs2_increase_refcount(handle, ref_ci, ref_root_bh,
 				      p_cluster, num_clusters,
 				      meta_ac, dealloc);
+	if (ret) {
+		mlog_errno(ret);
+		goto out_commit;
+	}
+
+	ret = dquot_alloc_space_nodirty(inode,
+		ocfs2_clusters_to_bytes(osb->sb, num_clusters));
 	if (ret)
 		mlog_errno(ret);
 

  parent reply	other threads:[~2016-12-02  0:56 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-02  0:54 [PATCH v3 0/8] ocfs2: wire up {clone,copy,dedupe}_range Darrick J. Wong
2016-12-02  0:54 ` [Ocfs2-devel] [PATCH v3 0/8] ocfs2: wire up {clone, copy, dedupe}_range Darrick J. Wong
2016-12-02  0:54 ` [PATCH 1/8] ocfs2: convert inode refcount test to a helper Darrick J. Wong
2016-12-02  0:54   ` [Ocfs2-devel] " Darrick J. Wong
2016-12-02  0:54 ` [PATCH 2/8] ocfs2: add newlines to some error messages Darrick J. Wong
2016-12-02  0:54   ` [Ocfs2-devel] " Darrick J. Wong
2016-12-02  0:54 ` [PATCH 3/8] ocfs2: prohibit refcounted swapfiles Darrick J. Wong
2016-12-02  0:54   ` [Ocfs2-devel] " Darrick J. Wong
2016-12-02  0:54 ` [PATCH 4/8] ocfs2: budget for extent tree splits when adding refcount flag Darrick J. Wong
2016-12-02  0:54   ` [Ocfs2-devel] " Darrick J. Wong
2016-12-02  0:54 ` [PATCH 5/8] ocfs2: don't eat io errors during _dio_end_io_write Darrick J. Wong
2016-12-02  0:54   ` [Ocfs2-devel] " Darrick J. Wong
2016-12-02  0:55 ` [PATCH 6/8] ocfs2: always unlock when completing dio writes Darrick J. Wong
2016-12-02  0:55   ` [Ocfs2-devel] " Darrick J. Wong
2016-12-02  0:55 ` [PATCH 7/8] ocfs2: implement the VFS clone_range, copy_range, and dedupe_range features Darrick J. Wong
2016-12-02  0:55   ` [Ocfs2-devel] " Darrick J. Wong
2016-12-02  0:55 ` Darrick J. Wong [this message]
2016-12-02  0:55   ` [Ocfs2-devel] [PATCH 8/8] ocfs2: charge quota for reflinked blocks Darrick J. Wong
2016-12-09  7:32 ` [PATCH v3 0/8] ocfs2: wire up {clone,copy,dedupe}_range Darrick J. Wong
2016-12-09  7:32   ` [Ocfs2-devel] [PATCH v3 0/8] ocfs2: wire up {clone, copy, dedupe}_range Darrick J. Wong
2016-12-09  8:22   ` [PATCH v3 0/8] ocfs2: wire up {clone,copy,dedupe}_range Christoph Hellwig
2016-12-09  8:22     ` [Ocfs2-devel] [PATCH v3 0/8] ocfs2: wire up {clone, copy, dedupe}_range Christoph Hellwig
2016-12-10  1:52     ` [PATCH v3 0/8] ocfs2: wire up {clone,copy,dedupe}_range Al Viro
2016-12-10  1:52       ` [Ocfs2-devel] [PATCH v3 0/8] ocfs2: wire up {clone, copy, dedupe}_range Al Viro
2016-12-10  8:46       ` [PATCH v3 0/8] ocfs2: wire up {clone,copy,dedupe}_range Christoph Hellwig
2016-12-10  8:46         ` [Ocfs2-devel] [PATCH v3 0/8] ocfs2: wire up {clone, copy, dedupe}_range Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=148064011424.14039.9933990570615486837.stgit@birch.djwong.org \
    --to=darrick.wong@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=hch@infradead.org \
    --cc=jlbec@evilplan.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=mfasheh@versity.com \
    --cc=ocfs2-devel@oss.oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.