All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Yan, Zheng " <yanzheng@21cn.com>
To: Liuwenyi <qingshenlwy@gmail.com>
Cc: chris.mason@oracle.com, jbacik@redhat.com, jens.axboe@oracle.com,
	linux-btrfs <linux-btrfs@vger.kernel.org>,
	linux-kernel@vger.kernel.org, strongzgy@gmail.com
Subject: Re: [PATCH]btrfs: avoid comparing with NULL pointer
Date: Wed, 27 Jan 2010 16:00:20 +0800	[thread overview]
Message-ID: <3d0408631001270000w49fc9100yb1e3b59df2e032e9@mail.gmail.com> (raw)
In-Reply-To: <4B5FDCD1.8060806@gmail.com>

2010/1/27 Liuwenyi <qingshenlwy@gmail.com>:
> In this patch, I adjust the seqence of if-conditions.
> It will assess the page->private situation.
> First, we make sure the page->private is not null.
> And then, we can do some with this page->private.
>
> ---
> Signed-off-by: Liuwenyi <qingshenlwy@gmail.com>
> Cc: Chris Mason <chris.mason@oracle.com>
> Cc: Yan Zheng <zheng.yan@oracle.com>
> Cc: Josef Bacik <jbacik@redhat.com>
> Cc: Jens Axboe <jens.axboe@oracle.com>
> Cc: linux-btrfs@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
>
> ---
> fs/btrfs/disk-io.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> index 009e3bd..a300dca 100644
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -1407,11 +1407,11 @@ static int bio_ready_for_csum(struct bio *bio)
>
> bio_for_each_segment(bvec, bio, i) {
> page = bvec->bv_page;
> - if (page->private == EXTENT_PAGE_PRIVATE) {
> + if (!page->private) {
> length += bvec->bv_len;
> continue;
> }
> - if (!page->private) {
> + if (page->private == EXTENT_PAGE_PRIVATE) {
> length += bvec->bv_len;
> continue;
> }
> --

Why do you want to do this? The code is perfect safe even
page->private is NULL. Furthermore, your patch is malformed.

Yan, Zheng

  reply	other threads:[~2010-01-27  8:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-27  6:27 [PATCH]btrfs: avoid comparing with NULL pointer Liuwenyi
2010-01-27  8:00 ` Yan, Zheng  [this message]
2010-01-27 14:19   ` Liuwenyi
2010-01-27 14:19     ` Liuwenyi

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=3d0408631001270000w49fc9100yb1e3b59df2e032e9@mail.gmail.com \
    --to=yanzheng@21cn.com \
    --cc=chris.mason@oracle.com \
    --cc=jbacik@redhat.com \
    --cc=jens.axboe@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=qingshenlwy@gmail.com \
    --cc=strongzgy@gmail.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.