From: Nikolay Borisov <nborisov@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: dsterba@suse.cz, Nikolay Borisov <nborisov@suse.com>
Subject: [PATCH] btrfs: Remove redundant code
Date: Wed, 12 Jul 2017 09:32:15 +0300 [thread overview]
Message-ID: <1499841135-18251-1-git-send-email-nborisov@suse.com> (raw)
insert_into_bitmap has only one caller which always allocates the info struct
passed. As such remove the any NULL checks for info and also remove code
to allocate info in case it was NULL.
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
fs/btrfs/free-space-cache.c | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index c5e6180cdb8c..fd24fb99d6dc 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -2101,7 +2101,7 @@ static int insert_into_bitmap(struct btrfs_free_space_ctl *ctl,
goto again;
new_bitmap:
- if (info && info->bitmap) {
+ if (info->bitmap) {
add_new_bitmap(ctl, info, offset);
added = 1;
info = NULL;
@@ -2109,17 +2109,6 @@ static int insert_into_bitmap(struct btrfs_free_space_ctl *ctl,
} else {
spin_unlock(&ctl->tree_lock);
- /* no pre-allocated info, allocate a new one */
- if (!info) {
- info = kmem_cache_zalloc(btrfs_free_space_cachep,
- GFP_NOFS);
- if (!info) {
- spin_lock(&ctl->tree_lock);
- ret = -ENOMEM;
- goto out;
- }
- }
-
/* allocate the bitmap */
info->bitmap = kzalloc(PAGE_SIZE, GFP_NOFS);
spin_lock(&ctl->tree_lock);
--
2.7.4
next reply other threads:[~2017-07-12 6:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-12 6:32 Nikolay Borisov [this message]
2017-07-12 14:55 ` [PATCH] btrfs: Remove redundant code David Sterba
2022-09-18 7:26 [PATCH] btrfs: remove " flyingpeng(彭浩)
2022-09-23 14:56 Hao Peng
2022-10-07 16:32 ` David Sterba
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=1499841135-18251-1-git-send-email-nborisov@suse.com \
--to=nborisov@suse.com \
--cc=dsterba@suse.cz \
--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.