All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joseph Qi <joseph.qi@huawei.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH] ocfs2: correctly update i_used in ocfs2_free_local_alloc_bits
Date: Mon, 25 Nov 2013 14:11:00 +0800	[thread overview]
Message-ID: <5292E9F4.9090808@huawei.com> (raw)

This patch is based on ocfs2-free-allocated-clusters-if-error-occurs-
after-ocfs2_claim_clusters.patch.
https://oss.oracle.com/pipermail/ocfs2-devel/2013-November/009461.html
We should note down num of bits to be freed, so as to update i_used
correspondingly after clearing those bits in bitmap.

Signed-off-by: Joseph Qi <joseph.qi@huawei.com>
---
 fs/ocfs2/localalloc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c
index 25ec3b7..0440134 100644
--- a/fs/ocfs2/localalloc.c
+++ b/fs/ocfs2/localalloc.c
@@ -788,6 +788,7 @@ int ocfs2_free_local_alloc_bits(struct ocfs2_super *osb,
 				u32 num_bits)
 {
 	int status, start;
+	u32 clear_bits;
 	struct inode *local_alloc_inode;
 	void *bitmap;
 	struct ocfs2_dinode *alloc;
@@ -801,6 +802,7 @@ int ocfs2_free_local_alloc_bits(struct ocfs2_super *osb,
 
 	bitmap = la->la_bitmap;
 	start = bit_off - le32_to_cpu(la->la_bm_off);
+	clear_bits = num_bits;
 
 	status = ocfs2_journal_access_di(handle,
 			INODE_CACHE(local_alloc_inode),
@@ -811,7 +813,7 @@ int ocfs2_free_local_alloc_bits(struct ocfs2_super *osb,
 		goto bail;
 	}
 
-	while (num_bits--)
+	while (clear_bits--)
 		ocfs2_clear_bit(start++, bitmap);
 
 	le32_add_cpu(&alloc->id1.bitmap1.i_used, -num_bits);
-- 
1.8.4.3

                 reply	other threads:[~2013-11-25  6:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=5292E9F4.9090808@huawei.com \
    --to=joseph.qi@huawei.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.