From: Haicheng Li <haicheng.li@linux.intel.com>
To: Gu Zheng <guz.fnst@cn.fujitsu.com>
Cc: Gao feng <gaofeng@cn.fujitsu.com>, Kim <jaegeuk.kim@samsung.com>,
f2fs <linux-f2fs-devel@lists.sourceforge.net>,
fsdevel <linux-fsdevel@vger.kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] f2fs: introduce f2fs_kmem_cache_alloc to hide the unfailed kmem cache allocation
Date: Tue, 22 Oct 2013 14:15:40 +0800 [thread overview]
Message-ID: <20131022061540.GL21006@hli22-desktop> (raw)
In-Reply-To: <52660E62.9090409@cn.fujitsu.com>
On Tue, Oct 22, 2013 at 01:34:26PM +0800, Gu Zheng wrote:
> On 10/22/2013 01:16 PM, Haicheng Li wrote:
>
> > On Tue, Oct 22, 2013 at 11:49:58AM +0800, Gao feng wrote:
> >> On 10/21/2013 03:24 PM, Gu Zheng wrote:
> >>> +static inline void *f2fs_kmem_cache_alloc(struct kmem_cache *cachep,
> >>> + gfp_t flags)
> >>> +{
> >>> + void *entry = kmem_cache_alloc(cachep, flags);
> >>> +retry:
> >>
> >> retry after kmem_cache_alloc?
> >
> > Good catch.
> >
> > Sorry for the carelessness in my previous review.
> > Besides this, I also found another issue as below:
> >
> >> On Mon, Oct 21, 2013 at 03:24:55PM +0800, Gu Zheng wrote:
> >>> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
> >>> index ef80f79..fe3cf8e 100644
> >>> --- a/fs/f2fs/node.c
> >>> +++ b/fs/f2fs/node.c
> >>> @@ -1308,11 +1308,7 @@ static int add_free_nid(struct f2fs_nm_info *nm_i, nid_t nid, bool build)
> >>> if (allocated)
> >>> return 0;
> >>> retry:
> > -retry?
>
> Can be removed here, this tag still used by front goto jumping. But it
> seems that we need to use another suitable name rather than "retry".
how about like this?
---
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index fe3cf8e..4fa3fd5 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -1296,18 +1296,17 @@ static int add_free_nid(struct f2fs_nm_info *nm_i, nid_t nid, bool build)
if (nid == 0)
return 0;
- if (!build)
- goto retry;
+ if (build) {
+ /* do not add allocated nids */
+ read_lock(&nm_i->nat_tree_lock);
+ ne = __lookup_nat_cache(nm_i, nid);
+ if (ne && nat_get_blkaddr(ne) != NULL_ADDR)
+ allocated = true;
+ read_unlock(&nm_i->nat_tree_lock);
+ if (allocated)
+ return 0;
+ }
- /* do not add allocated nids */
- read_lock(&nm_i->nat_tree_lock);
- ne = __lookup_nat_cache(nm_i, nid);
- if (ne && nat_get_blkaddr(ne) != NULL_ADDR)
- allocated = true;
- read_unlock(&nm_i->nat_tree_lock);
- if (allocated)
- return 0;
-retry:
i = f2fs_kmem_cache_alloc(free_nid_slab, GFP_NOFS);
i->nid = nid;
i->state = NID_NEW;
next prev parent reply other threads:[~2013-10-22 6:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-21 7:24 [PATCH] f2fs: introduce f2fs_kmem_cache_alloc to hide the unfailed kmem cache allocation Gu Zheng
2013-10-22 2:45 ` Haicheng Li
2013-10-22 5:17 ` Haicheng Li
2013-10-22 3:49 ` Gao feng
2013-10-22 5:16 ` Haicheng Li
2013-10-22 5:34 ` Gu Zheng
2013-10-22 6:15 ` Haicheng Li [this message]
2013-10-22 6:26 ` Gu Zheng
2013-10-22 5:30 ` Gu Zheng
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=20131022061540.GL21006@hli22-desktop \
--to=haicheng.li@linux.intel.com \
--cc=gaofeng@cn.fujitsu.com \
--cc=guz.fnst@cn.fujitsu.com \
--cc=jaegeuk.kim@samsung.com \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@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 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).