linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Li Zefan <lizf@cn.fujitsu.com>
To: Jan Schmidt <list.btrfs@jan-o-sch.net>
Cc: chris.mason@oracle.com, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v7 1/8] btrfs: added helper functions to iterate backrefs
Date: Wed, 27 Jul 2011 15:59:05 +0800	[thread overview]
Message-ID: <4E2FC549.90303@cn.fujitsu.com> (raw)
In-Reply-To: <c821ea4b363f4894b421a51d882c1f2b6c2eae00.1311333004.git.list.btrfs@jan-o-sch.net>

> +struct btrfs_data_container *init_data_container(s32 total_bytes)
> +{
> +	struct btrfs_data_container *data;
> +	unsigned long alloc_bytes;
> +
> +	if (total_bytes < 0)
> +		return ERR_PTR(-EINVAL);
> +
> +	alloc_bytes = max((unsigned long)total_bytes, sizeof(*data));

The return type of sizeof() is unsigned int, so this will cause compile
warning.

We can use max_t() instead.

> +	data = kmalloc(alloc_bytes, GFP_NOFS);
> +	if (!data)
> +		return ERR_PTR(-ENOMEM);
> +
> +	data->size = total_bytes - sizeof(*data);
> +	data->elem_cnt = 0;
> +	data->elem_missed = 0;
> +
> +	return data;
> +}

  reply	other threads:[~2011-07-27  7:59 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-22 11:12 [PATCH v7 0/8] Btrfs scrub: print path to corrupted files and trigger nodatasum fixup Jan Schmidt
2011-07-22 11:12 ` [PATCH v7 1/8] btrfs: added helper functions to iterate backrefs Jan Schmidt
2011-07-27  7:59   ` Li Zefan [this message]
2011-07-27  8:06     ` Li Zefan
2011-07-27  8:22       ` Jan Schmidt
2011-07-22 11:12 ` [PATCH v7 2/8] btrfs scrub: added unverified_errors Jan Schmidt
2011-07-22 11:12 ` [PATCH v7 3/8] btrfs scrub: print paths of corrupted files Jan Schmidt
2011-07-22 11:12 ` [PATCH v7 4/8] btrfs scrub: bugfix: mirror_num off by one Jan Schmidt
2011-07-22 11:12 ` [PATCH v7 5/8] btrfs: add mirror_num to extent_read_full_page Jan Schmidt
2011-07-22 11:12 ` [PATCH v7 6/8] btrfs scrub: use int for mirror_num, not u64 Jan Schmidt
2011-07-22 11:12 ` [PATCH v7 7/8] btrfs scrub: add fixup code for errors on nodatasum files Jan Schmidt
2011-07-22 11:12 ` [PATCH v7 8/8] btrfs: new ioctls to do logical->inode and inode->path resolving Jan Schmidt
2011-07-23 22:38 ` [PATCH v7 0/8] Btrfs scrub: print path to corrupted files and trigger nodatasum fixup Jan Schubert
2011-07-24 11:36   ` Jan Schmidt
     [not found]     ` <4E2C0E2C.4070606@GMX.li>
     [not found]       ` <4E2C1E9D.1090403@jan-o-sch.net>
     [not found]         ` <4E2C8425.9090601@GMX.li>
2011-07-25  8:34           ` Jan Schmidt
     [not found]             ` <4E2D5C36.306@GMX.li>
2011-07-25 13:15               ` Jan Schmidt
     [not found]                 ` <4E2D9290.6020600@GMX.li>
     [not found]                   ` <4E2E912E.7040109@jan-o-sch.net>
     [not found]                     ` <4E2E92FA.4060008@GMX.li>
2011-07-26 17:36                       ` Jan Schmidt

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=4E2FC549.90303@cn.fujitsu.com \
    --to=lizf@cn.fujitsu.com \
    --cc=chris.mason@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=list.btrfs@jan-o-sch.net \
    /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).