From: Kevin Wolf <kwolf@redhat.com>
To: Max Reitz <mreitz@redhat.com>
Cc: Fam Zheng <famz@redhat.com>,
qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/2] raw-posix: Fetch max sectors for host block device from sysfs
Date: Thu, 2 Jun 2016 14:54:23 +0200 [thread overview]
Message-ID: <20160602125423.GG6867@noname.redhat.com> (raw)
In-Reply-To: <3290affb-9e0e-3bfe-49d8-56726bf04339@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1434 bytes --]
Am 02.06.2016 um 14:30 hat Max Reitz geschrieben:
> On 26.05.2016 08:15, Fam Zheng wrote:
> > This is sometimes a useful value we should count in.
> >
> > Signed-off-by: Fam Zheng <famz@redhat.com>
> > ---
> > block/raw-posix.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 47 insertions(+)
> >
> > diff --git a/block/raw-posix.c b/block/raw-posix.c
> > index a4f5a1b..d3796ad 100644
> > --- a/block/raw-posix.c
> > +++ b/block/raw-posix.c
> > @@ -729,9 +729,56 @@ static void raw_reopen_abort(BDRVReopenState *state)
> > state->opaque = NULL;
> > }
> >
> > +static int hdev_get_max_transfer_length(dev_t dev)
> > +{
> > + int ret;
> > + int fd;
> > + char *path;
> > + const char *end;
> > + char buf[32];
> > + long len;
> > +
> > + path = g_strdup_printf("/sys/dev/block/%u:%u/queue/max_sectors_kb",
> > + major(dev), minor(dev));
>
> I can't say I like this very much, but well, it won't do any harm on any
> systems that do not offer this path (i.e. any non-Linux system, I
> suppose). So I'm fine with it.
Haven't looked at the patch in detail yet, so I didn't want to send a
comment yet, but I think this should be #ifdef-ed out for non-Linux.
Also a quick search on the internet suggests that the BLKSECTGET ioctl
is what we're looking for, so hopefully using sysfs is unnecessary
anyway.
Kevin
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2016-06-02 12:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-26 6:15 [Qemu-devel] [PATCH 0/2] block: Expose host block dev I/O size limit in scsi-block/scsi-generic Fam Zheng
2016-05-26 6:15 ` [Qemu-devel] [PATCH 1/2] raw-posix: Fetch max sectors for host block device from sysfs Fam Zheng
2016-06-02 6:52 ` Fam Zheng
2016-06-02 12:30 ` Max Reitz
2016-06-02 12:54 ` Kevin Wolf [this message]
2016-06-03 1:46 ` Fam Zheng
2016-05-26 6:15 ` [Qemu-devel] [PATCH 2/2] scsi-generic: Merge block max xfer len in INQUIRY response Fam Zheng
2016-05-26 7:59 ` Paolo Bonzini
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=20160602125423.GG6867@noname.redhat.com \
--to=kwolf@redhat.com \
--cc=famz@redhat.com \
--cc=mreitz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.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 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.