From: Li Zefan <lizf@cn.fujitsu.com>
To: "linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: [PATCH v2 2/7] Btrfs: Use bitmap_set/clear()
Date: Mon, 25 Apr 2011 16:58:42 +0800 [thread overview]
Message-ID: <4DB537C2.3020205@cn.fujitsu.com> (raw)
In-Reply-To: <4DB5378B.2070904@cn.fujitsu.com>
No functional change.
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
fs/btrfs/free-space-cache.c | 20 ++++++++------------
1 files changed, 8 insertions(+), 12 deletions(-)
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index 3af64c6..0e23bba 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -1134,15 +1134,13 @@ static void bitmap_clear_bits(struct btrfs_block_group_cache *block_group,
struct btrfs_free_space *info, u64 offset,
u64 bytes)
{
- unsigned long start, end;
- unsigned long i;
+ unsigned long start, count;
start = offset_to_bit(info->offset, block_group->sectorsize, offset);
- end = start + bytes_to_bits(bytes, block_group->sectorsize);
- BUG_ON(end > BITS_PER_BITMAP);
+ count = bytes_to_bits(bytes, block_group->sectorsize);
+ BUG_ON(start + count > BITS_PER_BITMAP);
- for (i = start; i < end; i++)
- clear_bit(i, info->bitmap);
+ bitmap_clear(info->bitmap, start, count);
info->bytes -= bytes;
block_group->free_space -= bytes;
@@ -1152,15 +1150,13 @@ static void bitmap_set_bits(struct btrfs_block_group_cache *block_group,
struct btrfs_free_space *info, u64 offset,
u64 bytes)
{
- unsigned long start, end;
- unsigned long i;
+ unsigned long start, count;
start = offset_to_bit(info->offset, block_group->sectorsize, offset);
- end = start + bytes_to_bits(bytes, block_group->sectorsize);
- BUG_ON(end > BITS_PER_BITMAP);
+ count = bytes_to_bits(bytes, block_group->sectorsize);
+ BUG_ON(start + count > BITS_PER_BITMAP);
- for (i = start; i < end; i++)
- set_bit(i, info->bitmap);
+ bitmap_set(info->bitmap, start, count);
info->bytes += bytes;
block_group->free_space += bytes;
--
1.7.3.1
next prev parent reply other threads:[~2011-04-25 8:58 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-25 8:57 [PATCH v2 0/7] Btrfs: New inode number allocator Li Zefan
2011-04-25 8:58 ` Li Zefan [this message]
2011-04-25 8:59 ` [PATCH v2 3/7] Btrfs: Make free space cache code generic Li Zefan
2011-04-25 8:59 ` [PATCH v2 4/7] Btrfs: Cache free inode numbers in memory Li Zefan
2011-04-25 8:59 ` [PATCH v2 5/7] Btrfs: Make the code for reading/writing free space cache generic Li Zefan
2011-04-25 8:59 ` [PATCH v2 6/7] Btrfs: Always use 64bit inode number Li Zefan
2011-04-25 9:00 ` [PATCH v2 7/7] Btrfs: Support reading/writing on disk free ino cache Li Zefan
2011-04-25 9:02 ` [PATCH v2 0/7] Btrfs: New inode number allocator Li Zefan
2011-04-25 17:15 ` Chris Mason
2011-04-25 20:44 ` Chris Mason
2011-05-31 21:01 ` Johannes Hirte
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=4DB537C2.3020205@cn.fujitsu.com \
--to=lizf@cn.fujitsu.com \
--cc=linux-btrfs@vger.kernel.org \
/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.