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 <f...@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
pgpGsFDLVkOUQ.pgp
Description: PGP signature