From: bvanassche@acm.org (Bart Van Assche)
Subject: [PATCHv2] nvmet: Fix discover log page when offsets are used
Date: Tue, 09 Apr 2019 08:19:30 -0700 [thread overview]
Message-ID: <1554823170.161891.8.camel@acm.org> (raw)
In-Reply-To: <20190409145517.GB1005@localhost.localdomain>
On Tue, 2019-04-09@08:55 -0600, Keith Busch wrote:
> On Tue, Apr 09, 2019@02:54:01AM -0700, Christoph Hellwig wrote:
> > > +u64 nvmet_get_log_page_offset(struct nvme_command *cmd)
> > > +{
> > > + u64 offset = le32_to_cpu(cmd->get_log_page.lpou);
> > > +
> > > + offset <<= 32;
> > > + offset += le32_to_cpu(cmd->get_log_page.lpol);
> > > +
> > > + return offset;
> >
> > Maybe just a pet peeve of fine, but can we avoid the pointless local
> > variable? Why not:
> >
> > return le32_to_cpu(cmd->get_log_page.lpol) |
> > (((u64)le32_to_cpu(cmd->get_log_page.lpou)) << 32);
>
> Sure thing.
>
> > That being said I don't get why we don't simply replace lpol and lpou
> > with a single __le64 to start with to simplify things further.
>
> It is on a natrual 8 byte alignment, so I guess we could make it an
> __le64. The split just aligns to the spec.
How about introducing a union such that the names from the spec can be
retained and at the same time nvmet_get_log_page_offset() can read a
single __le64 variable?
Bart.
prev parent reply other threads:[~2019-04-09 15:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-08 19:46 [PATCHv2] nvmet: Fix discover log page when offsets are used Keith Busch
2019-04-09 0:30 ` James Smart
2019-04-09 2:33 ` Chaitanya Kulkarni
2019-04-09 9:50 ` Christoph Hellwig
2019-04-09 9:54 ` Christoph Hellwig
2019-04-09 14:55 ` Keith Busch
2019-04-09 15:19 ` Bart Van Assche [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=1554823170.161891.8.camel@acm.org \
--to=bvanassche@acm.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