From: dinghao.liu@zju.edu.cn
To: "Dave Jiang" <dave.jiang@intel.com>
Cc: "Vishal Verma" <vishal.l.verma@intel.com>,
"Dan Williams" <dan.j.williams@intel.com>,
"Ira Weiny" <ira.weiny@intel.com>,
nvdimm@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] nvdimm-btt: simplify code with the scope based resource management
Date: Thu, 14 Dec 2023 15:33:30 +0800 (GMT+08:00) [thread overview]
Message-ID: <5c62b668.34d1b.18c673eaeb5.Coremail.dinghao.liu@zju.edu.cn> (raw)
In-Reply-To: <0473a930-9b80-4b81-81a1-c9adb0dc3919@intel.com>
> > It's a little strange that we do not check super immediately after allocation.
> > How about this:
> >
> > static int discover_arenas(struct btt *btt)
> > {
> > int ret = 0;
> > struct arena_info *arena;
> > - struct btt_sb *super;
> > size_t remaining = btt->rawsize;
> > u64 cur_nlba = 0;
> > size_t cur_off = 0;
> > int num_arenas = 0;
> >
> > - super = kzalloc(sizeof(*super), GFP_KERNEL);
> > + struct btt_sb *super __free(kfree) =
> > + kzalloc(sizeof(*super), GFP_KERNEL);
> > if (!super)
> > return -ENOMEM;
> >
> > while (remaining) {
> >
>
> That's fine by me
I will resend a new patch soon, thanks!
Regards,
Dinghao
prev parent reply other threads:[~2023-12-14 7:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-10 10:27 [PATCH] nvdimm-btt: simplify code with the scope based resource management Dinghao Liu
2023-12-11 18:26 ` Dave Jiang
2023-12-13 3:12 ` dinghao.liu
2023-12-13 16:47 ` Dave Jiang
2023-12-14 7:33 ` dinghao.liu [this message]
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=5c62b668.34d1b.18c673eaeb5.Coremail.dinghao.liu@zju.edu.cn \
--to=dinghao.liu@zju.edu.cn \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=ira.weiny@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nvdimm@lists.linux.dev \
--cc=vishal.l.verma@intel.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 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 read-only IMAP folder(s) and NNTP newsgroup(s).