linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ext4: fix __ext4_xattr_set_credits()
@ 2017-06-28 21:47 Tahsin Erdogan
  2017-06-28 22:26 ` Andreas Dilger
  2017-07-04  4:22 ` Theodore Ts'o
  0 siblings, 2 replies; 3+ messages in thread
From: Tahsin Erdogan @ 2017-06-28 21:47 UTC (permalink / raw)
  To: Andreas Dilger, Darrick J . Wong, Jan Kara, Theodore Ts'o,
	linux-ext4
  Cc: linux-kernel, Tahsin Erdogan

__ext4_xattr_set_credits() calculates journal credits needed for a
set xattr operation. Currently, credits needed for quota updates are
added only if ea_inode feature is enabled which is wrong. Fix this by
moving quota related additions to above ea_inode feature check.

Fixes: 74c5bfa651af ("ext4: xattr inode deduplication")

Signed-off-by: Tahsin Erdogan <tahsin@google.com>
---
 fs/ext4/xattr.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index ce12c3fb7e59..062756b4e6d8 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -845,6 +845,9 @@ static int __ext4_xattr_set_credits(struct super_block *sb,
 	 */
 	credits = 5;
 
+	/* Quota updates. */
+	credits += EXT4_MAXQUOTAS_TRANS_BLOCKS(sb);
+
 	/* We are done if ea_inode feature is not enabled. */
 	if (!ext4_has_feature_ea_inode(sb))
 		return credits;
@@ -878,9 +881,6 @@ static int __ext4_xattr_set_credits(struct super_block *sb,
 	/* Block bitmap and group descriptor updates for each block. */
 	credits += blocks * 2;
 
-	/* Quota updates. */
-	credits += EXT4_MAXQUOTAS_TRANS_BLOCKS(sb);
-
 	/* We may need to clone the existing xattr block in which case we need
 	 * to increment ref counts for existing ea_inodes referenced by it.
 	 */
-- 
2.13.2.725.g09c95d1e9-goog

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ext4: fix __ext4_xattr_set_credits()
  2017-06-28 21:47 [PATCH] ext4: fix __ext4_xattr_set_credits() Tahsin Erdogan
@ 2017-06-28 22:26 ` Andreas Dilger
  2017-07-04  4:22 ` Theodore Ts'o
  1 sibling, 0 replies; 3+ messages in thread
From: Andreas Dilger @ 2017-06-28 22:26 UTC (permalink / raw)
  To: Tahsin Erdogan
  Cc: Darrick J . Wong, Jan Kara, Theodore Ts'o, linux-ext4, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1565 bytes --]

On Jun 28, 2017, at 3:47 PM, Tahsin Erdogan <tahsin@google.com> wrote:
> 
> __ext4_xattr_set_credits() calculates journal credits needed for a
> set xattr operation. Currently, credits needed for quota updates are
> added only if ea_inode feature is enabled which is wrong. Fix this by
> moving quota related additions to above ea_inode feature check.
> 
> Fixes: 74c5bfa651af ("ext4: xattr inode deduplication")
> 
> Signed-off-by: Tahsin Erdogan <tahsin@google.com>

Reviewed-by: Andreas Dilger <adilger@dilger.ca>

> ---
> fs/ext4/xattr.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
> index ce12c3fb7e59..062756b4e6d8 100644
> --- a/fs/ext4/xattr.c
> +++ b/fs/ext4/xattr.c
> @@ -845,6 +845,9 @@ static int __ext4_xattr_set_credits(struct super_block *sb,
> 	 */
> 	credits = 5;
> 
> +	/* Quota updates. */
> +	credits += EXT4_MAXQUOTAS_TRANS_BLOCKS(sb);
> +
> 	/* We are done if ea_inode feature is not enabled. */
> 	if (!ext4_has_feature_ea_inode(sb))
> 		return credits;
> @@ -878,9 +881,6 @@ static int __ext4_xattr_set_credits(struct super_block *sb,
> 	/* Block bitmap and group descriptor updates for each block. */
> 	credits += blocks * 2;
> 
> -	/* Quota updates. */
> -	credits += EXT4_MAXQUOTAS_TRANS_BLOCKS(sb);
> -
> 	/* We may need to clone the existing xattr block in which case we need
> 	 * to increment ref counts for existing ea_inodes referenced by it.
> 	 */
> --
> 2.13.2.725.g09c95d1e9-goog
> 


Cheers, Andreas






[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ext4: fix __ext4_xattr_set_credits()
  2017-06-28 21:47 [PATCH] ext4: fix __ext4_xattr_set_credits() Tahsin Erdogan
  2017-06-28 22:26 ` Andreas Dilger
@ 2017-07-04  4:22 ` Theodore Ts'o
  1 sibling, 0 replies; 3+ messages in thread
From: Theodore Ts'o @ 2017-07-04  4:22 UTC (permalink / raw)
  To: Tahsin Erdogan
  Cc: Andreas Dilger, Darrick J . Wong, Jan Kara, linux-ext4, linux-kernel

On Wed, Jun 28, 2017 at 02:47:50PM -0700, Tahsin Erdogan wrote:
> __ext4_xattr_set_credits() calculates journal credits needed for a
> set xattr operation. Currently, credits needed for quota updates are
> added only if ea_inode feature is enabled which is wrong. Fix this by
> moving quota related additions to above ea_inode feature check.
> 
> Fixes: 74c5bfa651af ("ext4: xattr inode deduplication")
> 
> Signed-off-by: Tahsin Erdogan <tahsin@google.com>

Thanks, I've folded this into the xattr_inode_deduplication patch.

	     	    	      	  - Ted

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-07-04  4:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-28 21:47 [PATCH] ext4: fix __ext4_xattr_set_credits() Tahsin Erdogan
2017-06-28 22:26 ` Andreas Dilger
2017-07-04  4:22 ` Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).