login
Login
/
Register
Search
Search this site:
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2010
»
August
»
23
Re: [PATCH 2/6] btrfs: add helper function free_bitmap()
view
thread
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
[view in full thread]
From: Josef Bacik
Subject:
Re: [PATCH 2/6] btrfs: add helper function free_bitmap()
Date: Monday, August 23, 2010 - 6:03 am
On Mon, Aug 23, 2010 at 09:23:01AM +0800, Li Zefan wrote:
quoted text
> Remove some duplicated code. > > This prepares for the next patch. > > Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> > --- > fs/btrfs/free-space-cache.c | 37 ++++++++++++++++--------------------- > 1 files changed, 16 insertions(+), 21 deletions(-) > > diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c > index 7edbef6..017fd55 100644 > --- a/fs/btrfs/free-space-cache.c > +++ b/fs/btrfs/free-space-cache.c > @@ -422,6 +422,16 @@ static void add_new_bitmap(struct btrfs_block_group_cache *block_group, > recalculate_thresholds(block_group); > } > > +static void free_bitmap(struct btrfs_block_group_cache *block_group, > + struct btrfs_free_space *bitmap_info) > +{ > + unlink_free_space(block_group, bitmap_info); > + kfree(bitmap_info->bitmap); > + kfree(bitmap_info); > + block_group->total_bitmaps--; > + recalculate_thresholds(block_group); > +} > + > static noinline int remove_from_bitmap(struct btrfs_block_group_cache *block_group, > struct btrfs_free_space *bitmap_info, > u64 *offset, u64 *bytes) > @@ -462,13 +472,8 @@ again: > > if (*bytes) { > struct rb_node *next = rb_next(&bitmap_info->offset_index); > - if (!bitmap_info->bytes) { > - unlink_free_space(block_group, bitmap_info); > - kfree(bitmap_info->bitmap); > - kfree(bitmap_info); > - block_group->total_bitmaps--; > - recalculate_thresholds(block_group); > - } > + if (!bitmap_info->bytes) > + free_bitmap(block_group, bitmap_info); > > /* > * no entry after this bitmap, but we still have bytes to > @@ -501,13 +506,8 @@ again: > return -EAGAIN; > > goto again; > - } else if (!bitmap_info->bytes) { > - unlink_free_space(block_group, bitmap_info); > - kfree(bitmap_info->bitmap); > - kfree(bitmap_info); > - block_group->total_bitmaps--; > - recalculate_thresholds(block_group); > - } > + } else if (!bitmap_info->bytes) > + free_bitmap(block_group, bitmap_info); > > return 0; > } > @@ -936,13 +936,8 @@ u64 btrfs_find_space_for_alloc(struct btrfs_block_group_cache *block_group, > ret = offset; > if (entry->bitmap) { > bitmap_clear_bits(block_group, entry, offset, bytes); > - if (!entry->bytes) { > - unlink_free_space(block_group, entry); > - kfree(entry->bitmap); > - kfree(entry); > - block_group->total_bitmaps--; > - recalculate_thresholds(block_group); > - } > + if (!entry->bytes) > + free_bitmap(block_group, entry); > } else { > unlink_free_space(block_group, entry); > entry->offset += bytes; > -- > 1.7.0.1 >
Reviewed-by: Josef Bacik <josef@redhat.com> Thanks, Josef --
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
Messages in current thread:
[PATCH 0/6] btrfs: some bug fixes for free space cache
, Li Zefan
, (Sun Aug 22, 6:22 pm)
[PATCH 1/6] btrfs: fix threshold calculation for block gro ...
, Li Zefan
, (Sun Aug 22, 6:22 pm)
[PATCH 2/6] btrfs: add helper function free_bitmap()
, Li Zefan
, (Sun Aug 22, 6:23 pm)
[PATCH 3/6] btrfs: free fully occupied bitmap in cluster
, Li Zefan
, (Sun Aug 22, 6:23 pm)
[PATCH 4/6] btrfs: update stats when allocating from a cluster
, Li Zefan
, (Sun Aug 22, 6:23 pm)
[PATCH 5/6] btrfs: add a helper try_merge_free_space()
, Li Zefan
, (Sun Aug 22, 6:23 pm)
[PATCH 6/6] btrfs: check mergeable free space when removin ...
, Li Zefan
, (Sun Aug 22, 6:24 pm)
Re: [PATCH 1/6] btrfs: fix threshold calculation for block ...
, Josef Bacik
, (Mon Aug 23, 6:02 am)
Re: [PATCH 2/6] btrfs: add helper function free_bitmap()
, Josef Bacik
, (Mon Aug 23, 6:03 am)
Re: [PATCH 3/6] btrfs: free fully occupied bitmap in cluster
, Josef Bacik
, (Mon Aug 23, 6:04 am)
Re: [PATCH 4/6] btrfs: update stats when allocating from a ...
, Josef Bacik
, (Mon Aug 23, 6:09 am)
Re: [PATCH 6/6] btrfs: check mergeable free space when rem ...
, Josef Bacik
, (Mon Aug 23, 6:15 am)
Re: [PATCH 5/6] btrfs: add a helper try_merge_free_space()
, Josef Bacik
, (Mon Aug 23, 6:15 am)
Re: [PATCH 4/6] btrfs: update stats when allocating from a ...
, Li Zefan
, (Mon Aug 23, 5:50 pm)
Re: [PATCH 6/6] btrfs: check mergeable free space when rem ...
, Li Zefan
, (Mon Aug 23, 6:04 pm)
Re: [PATCH 4/6] btrfs: update stats when allocating from a ...
, Josef Bacik
, (Mon Aug 23, 7:50 pm)
Re: [PATCH 6/6] btrfs: check mergeable free space when rem ...
, Josef Bacik
, (Mon Aug 23, 7:58 pm)
Navigation
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Ken Chen
[patch] sched: fix inconsistency when redistribute per-cpu tg->cfs_rq shares.
Hugh Dickins
Re: Linux 2.6.26-rc1 - pgtable_32.c:178 pmd_bad
Bernhard Beck
[PATCH 001/001] usb-serial: Add ThinkOptics WavIT
Oleg Nesterov
Re: [PATCH 4/5] don't panic if /sbin/init exits or killed
Greg KH
[patch 07/21] rtc-pcf8563: detect polarity of century bit automatically
git
:
Jonathan del Strother
Re: [PATCH] Fixing path quoting issues
Gerrit Pape
[PATCH] fix skipping merge-order test with NO_OPENSSL=1.
Linus Torvalds
Re: Implementing branch attributes in git config
Johannes Schindelin
Re: Trying to use git-filter-branch to compress history by removing large, obsolet...
Gerrit Pape
[PATCH] hooks--update: fix test for properly set up project description file
linux-netdev
:
David Miller
Re: [PATCH 04/15] tg3: Preserve LAA when device control is released
Jean-Louis Dupond
Re: tg3 driver not advertising 1000mbit
Sven Wegener
[PATCH] ipvs: Add missing locking during connection table hashing and unhashing
David Miller
Re: [PATCH] qlcnic: dont assume NET_IP_ALIGN is 2
Stephen Hemminger
[PATCH 2/2] sky2: fix transmit state on resume
git-commits-head
:
Linux Kernel Mailing List
[SCSI] scsi ioctl: fix kernel-doc warning
Linux Kernel Mailing List
ALSA: HDA - Correct trivial typos in comments.
Linux Kernel Mailing List
i2c-viapro: Add support for SMBus Process Call transactions
Linux Kernel Mailing List
i2c: Documentation: upgrading clients HOWTO
Linux Kernel Mailing List
[PATCH] fix sysctl_nr_open bugs
openbsd-misc
:
Die Gestalt
Re: How to re-build openssl with SHA1 support?
Edwin Eyan Moragas
Re: managing routes for multiple PPPoE connections
Brian Candler
Re: OBSD's perspective on SELinux
Jonathan Schleifer
Why is getaddrinfo breaking POSIX?
Predrag Punosevac
Re: Kernel developers guide/tutorial
Colocation donated by:
Syndicate