All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benny Halevy <bhalevy@tonian.com>
To: Peng Tao <bergwolf@gmail.com>
Cc: linux-nfs@vger.kernel.org, Trond.Myklebust@netapp.com,
	Peng Tao <peng_tao@emc.com>
Subject: Re: [PATCH 6/8] pnfsblock: clean up _add_entry
Date: Thu, 10 Nov 2011 10:44:13 +0200	[thread overview]
Message-ID: <4EBB8EDD.9090107@tonian.com> (raw)
In-Reply-To: <1320851766-1834-7-git-send-email-bergwolf@gmail.com>

On 2011-11-09 17:16, Peng Tao wrote:
> It is wrong to kmalloc in _add_entry() as it is inside
> spinlock. memory should be already allocated _add_entry() is called.

What about the call from _set_range, it is passing NULL?

> So BUG instead if we fail to find a match and no memory preallocated.
> 
> Signed-off-by: Peng Tao <peng_tao@emc.com>
> ---
>  fs/nfs/blocklayout/extents.c |    9 ++-------
>  1 files changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/fs/nfs/blocklayout/extents.c b/fs/nfs/blocklayout/extents.c
> index f383524..952ea8a 100644
> --- a/fs/nfs/blocklayout/extents.c
> +++ b/fs/nfs/blocklayout/extents.c
> @@ -110,13 +110,8 @@ static int _add_entry(struct my_tree *tree, u64 s, int32_t tag,
>  		return 0;
>  	} else {
>  		struct pnfs_inval_tracking *new;
> -		if (storage)
> -			new = storage;
> -		else {
> -			new = kmalloc(sizeof(*new), GFP_NOFS);
> -			if (!new)
> -				return -ENOMEM;
> -		}
> +		BUG_ON(!storage);

The BUG isn't needed as you dereference the pointer right away.

Benny

> +		new = storage;
>  		new->it_sector = s;
>  		new->it_tags = (1 << tag);
>  		list_add(&new->it_link, &pos->it_link);

  reply	other threads:[~2011-11-10  8:44 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-09 15:15 [PATCH 0/8] pnfsblock cleanup and fixes Peng Tao
2011-11-09 15:15 ` [PATCH 1/8] pnfsblock: cleanup bl_mark_sectors_init Peng Tao
2011-11-09 15:16 ` [PATCH 3/8] pnfsblock: move find lock page logic out of bl_write_pagelist Peng Tao
2011-11-10  8:32   ` Benny Halevy
2011-11-10  8:49     ` tao.peng
2011-11-10  9:31       ` Benny Halevy
2011-11-10  9:40         ` tao.peng
2011-11-09 15:16 ` [PATCH 4/8] pnfsblock: set read/write tk_status to pnfs_error Peng Tao
2011-11-09 15:16 ` [PATCH 5/8] pnfsblock: remove rpc_call_ops from struct parallel_io Peng Tao
2011-11-09 15:16 ` [PATCH 6/8] pnfsblock: clean up _add_entry Peng Tao
2011-11-10  8:44   ` Benny Halevy [this message]
2011-11-10  8:56     ` tao.peng
2011-11-10  9:11     ` tao.peng
2011-11-09 15:16 ` [PATCH 7/8] pnfsblock: add im_extents to pnfs_inval_markings Peng Tao
2011-11-10  8:54   ` Benny Halevy
2011-11-10  9:08     ` tao.peng
2011-11-10  9:37       ` Benny Halevy
2011-11-10  9:20     ` Benny Halevy
2011-11-10  9:37       ` tao.peng
2011-11-10  9:39         ` Benny Halevy
2011-11-09 15:16 ` [PATCH 8/8] pnfsblock: alloc short extent before submit bio Peng Tao
2011-11-10  9:22   ` Benny Halevy
2011-11-10  2:09 ` [PATCH 0/8] pnfsblock cleanup and fixes tao.peng
2011-11-10  7:06   ` Benny Halevy
2011-11-10  8:37 ` Benny Halevy
2011-11-10  8:51   ` tao.peng

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=4EBB8EDD.9090107@tonian.com \
    --to=bhalevy@tonian.com \
    --cc=Trond.Myklebust@netapp.com \
    --cc=bergwolf@gmail.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=peng_tao@emc.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.