From: "Jesper Juhl" <jesper.juhl@gmail.com>
To: "Jens Axboe" <axboe@kernel.dk>, "Andrew Morton" <akpm@osdl.org>,
lkml <linux-kernel@vger.kernel.org>,
drbd-user@linbit.com
Subject: Re: [DRIVER SUBMISSION] DRBD wants to go mainline
Date: Mon, 23 Jul 2007 22:59:25 +0200 [thread overview]
Message-ID: <9a8748490707231359x2e5b4e61p614dcdc9ff3b1a42@mail.gmail.com> (raw)
In-Reply-To: <20070721203819.GA10706@mail.linbit.com>
On 21/07/07, Lars Ellenberg <lars@linbit.com> wrote:
>
> DRBD wants to go mainline.
> please have a look at the "for-linus" branch of
> git://git.drbd.org/home/git/linux-drbd.git.
>
A few more comments.
In drbd_main.c::after_state_ch() there's this code :
...
if ( mdev->p_uuid ) {
kfree(mdev->p_uuid);
mdev->p_uuid = NULL;
}
...
Since kfree(NULL) if a noop, that should just become :
...
kfree(mdev->p_uuid);
mdev->p_uuid = NULL;
...
Same for these bits in drbd_main.c::drbd_cleanup()
...
if(mdev->app_reads_hash) {
kfree(mdev->app_reads_hash);
mdev->app_reads_hash = NULL;
}
if ( mdev->p_uuid ) {
kfree(mdev->p_uuid);
mdev->p_uuid = NULL;
}
...
They should just become
...
kfree(mdev->app_reads_hash);
mdev->app_reads_hash = NULL;
kfree(mdev->p_uuid);
mdev->p_uuid = NULL;
...
And then there's drbd_main.c::drbd_new_device() :
...
if(mdev->app_reads_hash) kfree(mdev->app_reads_hash);
...
That should just be
...
kfree(mdev->app_reads_hash);
...
Btw; You shouldn't put multiple statements on the same line. That is
seen all over the place - like
mdev = kzalloc(sizeof(drbd_dev),GFP_KERNEL);
if(!mdev) goto Enomem;
That should be
mdev = kzalloc(sizeof(drbd_dev),GFP_KERNEL);
if(!mdev)
goto Enomem;
There are lots of other examples.
Here are a few more pointless NULL checks before kfree() :
drbd_nl.c::drbd_nl_net_conf() :
...
if(new_tl_hash) {
if (mdev->tl_hash) kfree(mdev->tl_hash);
mdev->tl_hash_s = mdev->net_conf->max_epoch_size/8;
mdev->tl_hash = new_tl_hash;
}
if(new_ee_hash) {
if (mdev->ee_hash) kfree(mdev->ee_hash);
mdev->ee_hash_s = mdev->net_conf->max_buffers/8;
mdev->ee_hash = new_ee_hash;
}
if ( mdev->cram_hmac_tfm ) {
crypto_free_hash(mdev->cram_hmac_tfm);
}
mdev->cram_hmac_tfm = tfm;
...
should become :
...
if(new_tl_hash) {
kfree(mdev->tl_hash);
mdev->tl_hash_s = mdev->net_conf->max_epoch_size/8;
mdev->tl_hash = new_tl_hash;
}
if(new_ee_hash) {
kfree(mdev->ee_hash);
mdev->ee_hash_s = mdev->net_conf->max_buffers/8;
mdev->ee_hash = new_ee_hash;
}
crypto_free_hash(mdev->cram_hmac_tfm);
mdev->cram_hmac_tfm = tfm;
...
still in drbd_nl.c::drbd_nl_net_conf() :
...
fail:
if (tfm) crypto_free_hash(tfm);
if (new_tl_hash) kfree(new_tl_hash);
if (new_ee_hash) kfree(new_ee_hash);
if (new_conf) kfree(new_conf);
...
should become
...
fail:
crypto_free_hash(tfm);
kfree(new_tl_hash);
kfree(new_ee_hash);
kfree(new_conf);
...
drbd_nl.c::ensure_mdev() :
...
if(mdev->app_reads_hash) kfree(mdev->app_reads_hash);
..
becomes
...
kfree(mdev->app_reads_hash);
...
In drbd_receiver.c::receive_uuids() we find this :
...
if ( mdev->p_uuid ) kfree(mdev->p_uuid);
...
which should be just
...
kfree(mdev->p_uuid);
...
There is also drbd_receiver.c::drbd_disconnect() - where
...
if ( mdev->p_uuid ) {
kfree(mdev->p_uuid);
mdev->p_uuid = NULL;
}
...
needs to become just
...
kfree(mdev->p_uuid);
mdev->p_uuid = NULL;
...
And in drbd_receiver.c::drbd_do_auth()
...
fail:
if(peers_ch) kfree(peers_ch);
if(response) kfree(response);
if(right_response) kfree(right_response);
...
needs to be turned into
...
fail:
kfree(peers_ch);
kfree(response);
kfree(right_response);
...
drbd_req.c::drbd_make_request_common() also needs to get rid of
...
if (b) kfree(b); /* if someone else has beaten us to it... */
...
fail_and_free_req:
if (b) kfree(b);
...
and just turn it into
...
kfree(b); /* if someone else has beaten us to it... */
...
fail_and_free_req:
kfree(b);
...
--
Jesper Juhl <jesper.juhl@gmail.com>
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please http://www.expita.com/nomime.html
next prev parent reply other threads:[~2007-07-23 21:00 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-21 20:38 Lars Ellenberg
2007-07-21 21:17 ` Jan Engelhardt
2007-07-21 22:43 ` Lars Ellenberg
2007-07-22 9:06 ` Jan Engelhardt
2007-07-22 14:03 ` Lars Ellenberg
2007-07-27 18:46 ` Pavel Machek
2007-07-30 19:35 ` Lars Ellenberg
2007-07-30 19:41 ` Jan Engelhardt
2007-07-21 21:34 ` Jesper Juhl
2007-07-21 23:50 ` Andi Kleen
2007-07-22 5:52 ` Jens Axboe
2007-07-22 13:58 ` Lars Ellenberg
2007-07-22 14:49 ` Sam Ravnborg
2007-07-22 14:56 ` Andi Kleen
2007-07-22 15:31 ` Satyam Sharma
2007-07-22 15:50 ` Satyam Sharma
2007-07-22 16:13 ` Stefan Richter
2007-07-22 6:09 ` Lars Ellenberg
2007-07-22 8:52 ` Sam Ravnborg
2007-07-22 9:05 ` Pekka Enberg
2007-07-22 9:00 ` Pekka Enberg
2007-07-23 1:32 ` Kyle Moffett
2007-07-23 8:49 ` Christoph Hellwig
2007-07-23 9:00 ` Sam Ravnborg
2007-07-23 9:01 ` Christoph Hellwig
2007-07-23 9:19 ` Sam Ravnborg
2007-07-23 11:08 ` Lars Ellenberg
2007-07-23 13:32 ` Lars Ellenberg
2007-07-23 13:37 ` Jens Axboe
2007-07-23 21:13 ` Lars Ellenberg
2007-07-23 13:40 ` Satyam Sharma
2007-07-23 21:19 ` Lars Ellenberg
2007-07-24 7:36 ` Jens Axboe
2007-07-24 23:11 ` Satyam Sharma
2007-07-25 9:46 ` Lars Ellenberg
2007-07-25 12:12 ` Satyam Sharma
2007-07-26 2:03 ` david
2007-07-26 3:43 ` Kyle Moffett
2007-07-26 9:17 ` Evgeniy Polyakov
2007-07-24 0:48 ` Kyle Moffett
2007-07-23 20:59 ` Jesper Juhl [this message]
2007-07-22 9:54 Tomasz Chmielewski
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=9a8748490707231359x2e5b4e61p614dcdc9ff3b1a42@mail.gmail.com \
--to=jesper.juhl@gmail.com \
--cc=akpm@osdl.org \
--cc=axboe@kernel.dk \
--cc=drbd-user@linbit.com \
--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
all inboxes | Powered by JetHome®