From: Greg KH <gregkh@suse.de>
To: Tejun Heo <htejun@gmail.com>
Cc: Mark Lord <lkml@rtr.ca>, "H. Peter Anvin" <hpa@zytor.com>,
Jens Axboe <axboe@kernel.dk>, Jeff Garzik <jgarzik@pobox.com>,
Linus Torvalds <torvalds@osdl.org>,
Andrew Morton <akpm@linux-foundation.org>,
Linux Kernel <linux-kernel@vger.kernel.org>,
IDE/ATA development list <linux-ide@vger.kernel.org>,
linux-scsi <linux-scsi@vger.kernel.org>
Subject: Re: What to do about the 2TB limit on HDIO_GETGEO ?
Date: Tue, 25 Mar 2008 20:38:04 -0700 [thread overview]
Message-ID: <20080326033804.GA27925@suse.de> (raw)
In-Reply-To: <47E99EBE.7010708@gmail.com>
On Wed, Mar 26, 2008 at 09:54:22AM +0900, Tejun Heo wrote:
> Hello,
>
> Mark Lord wrote:
> > So have we. sysfs is a total nightmare to extract information from
> > under program / script control. The idea presented in this thread,
> > is to have it cross-index the contents with a method that actually
> > makes it easy to access in many common scenarios, without requiring
> > huge gobs of code in user space. Or in kernel space.
> >
> > And it's not just a few 10s of lines of code currently,
> > but rather about 80-100 lines just to find the correct device subdir,
> > and *then* a few more 10s of lines of code to retrieve the value.
I think you are using either the wrong programming language, or your
sysfs walking logic is quite convulted. Look at the udev and HAL code
if you want to steal some compact, working sysfs code :)
> > In a bulletproof fashion, that is. Sure it can be slightly smaller
> > if niceties such as error checking/handling are omitted.
> >
> > There's no guarantee that udev is present, and even if it were present,
> > there's no guarantee that the names in /dev/ will match /sysfs/ pathnames,
> > since udev is very configurable to do otherwise.
> >
> > So lookups are by dev_t, which sysfs has no simple or even easy way
> > of accomplishing. O(n) at a minimum.
And again, is this a performance requiring operation?
> > If we make it easier to access, then more programs will use it
> > rather than us having to expand our tricky binary ioctl interfaces.
> >
> > Isn't that part of the idea of sysfs -- to limit the need for new ioctls ?
>
> The questions are...
>
> 1. Are we gonna push sysfs as the primary interface and not provide an
> alternative interface (ioctl here) which can provide equivalent
> information? There are people running their systems w/o sysfs but I
> think we're getting closer to this everyday.
Exactly, originally you suggested a new ioctl, which would be trivial to
add, and trivial to switch any program that was currently using an ioctl
to get the disk size, to use it instead.
Since when is the major:minor view of devices the "standard" one that
userspace uses? Last I looked, userspace uses symlinks and lots of
other ways of directly accessing block devices in /dev/, and does not
rely on major:minor.
And finally, I haven't seen a patch that implements this "shadow" tree,
it would be interesting to see if it could even be done.
> 2. Is udev an essential part of all systems? I'm not sure about this
> one. Lots of small machines run w/o udev and I think udev is a bit too
> high level to depend on for every system.
My tiny little phone runs udev, I don't see why anyone wouldn't run it
these days, except in very limited embedded applications with no dynamic
devices. But if you are in that situation, you aren't querying the size
of any random block device either :)
And heck, this phone is a very limited embedded application, with razor
thin margins, if it can use udev, I'd be interested in hearing the
justifications for anyone who says it is too large for their systems to
use it.
> If both #1 and #2 are true, I agree with Mark that we need an easy to
> map from device number to matching sysfs nodes. Tools which are used
> early during boot and emergency sessions need this mapping and many of
> them are minimal C program w/o much dependency for a good reason.
> Requiring each of them to implement their own way to map device node to
> sysfs node is too awkward.
>
> Probably something like /sys/class/block/MAJ:MIN or
> /sys/class/devnums/bMAJ:MIN?
Why the preopcupation with major:minor? Just because you are able to
grab it from an open file handle? Heck, why not just an ioctl to get
the path within sysfs for the device currently open? :)
thanks,
greg k-h
next prev parent reply other threads:[~2008-03-26 3:38 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <47E875AD.1000901@rtr.ca>
2008-03-25 4:02 ` What to do about the 2TB limit on HDIO_GETGEO ? Mark Lord
2008-03-25 4:19 ` Andrew Morton
2008-03-25 5:13 ` H. Peter Anvin
2008-03-25 13:37 ` Mark Lord
2008-03-25 13:55 ` H. Peter Anvin
2008-03-25 17:37 ` Mark Lord
2008-03-25 19:25 ` Greg KH
2008-03-25 19:34 ` Randy Dunlap
2008-03-25 20:36 ` H. Peter Anvin
2008-03-25 21:20 ` Greg KH
2008-03-25 21:26 ` H. Peter Anvin
2008-03-25 23:00 ` Greg KH
2008-03-25 23:05 ` H. Peter Anvin
2008-03-25 23:22 ` Greg KH
2008-03-27 19:05 ` Matthew Wilcox
2008-03-26 0:34 ` Mark Lord
2008-03-26 0:54 ` Tejun Heo
2008-03-26 3:38 ` Greg KH [this message]
2008-03-26 4:24 ` Tejun Heo
2008-03-26 6:04 ` H. Peter Anvin
2008-03-27 19:29 ` Kay Sievers
2008-03-27 19:38 ` H. Peter Anvin
2008-04-11 23:25 ` Dan Williams
2008-04-15 7:18 ` Andrew Morton
2008-04-15 13:47 ` Mark Lord
2008-04-15 14:20 ` James Bottomley
2008-04-15 18:16 ` H. Peter Anvin
2008-04-15 23:43 ` Dan Williams
2008-04-16 20:55 ` patch sysfs-add-sys-dev-char-block-to-lookup-sysfs-path-by-major-minor.patch added to gregkh-2.6 tree gregkh
2008-03-27 18:51 ` What to do about the 2TB limit on HDIO_GETGEO ? Kay Sievers
2008-03-27 18:55 ` H. Peter Anvin
2008-03-27 19:03 ` Kay Sievers
2008-03-25 15:17 ` James Bottomley
2008-03-25 17:31 ` Mark Lord
2008-03-25 19:32 ` James Bottomley
2008-03-25 17:45 ` Greg Freemyer
2008-03-25 17:52 ` Randy Dunlap
2008-03-25 18:09 ` Matthew Wilcox
2008-03-26 9:58 ` Boaz Harrosh
2008-03-30 4:28 ` Matt Domsch
[not found] ` <alpine.LFD.1.00.0803242254020.2775@woody.linux-foundation.org>
2008-03-25 13:34 ` Mark Lord
2008-03-25 13:51 ` Greg Freemyer
2008-03-25 14:31 ` Ric Wheeler
2008-03-25 15:25 ` Andrew Paprocki
2008-03-25 15:34 ` Matthew Wilcox
2008-03-25 15:48 ` Ric Wheeler
2008-03-25 16:47 ` Theodore Tso
2008-03-25 20:51 ` Theodore Tso
[not found] <abhxL-xC-7@gated-at.bofh.it>
[not found] ` <abhRd-1bf-15@gated-at.bofh.it>
[not found] ` <ablib-2zv-65@gated-at.bofh.it>
[not found] ` <abn0B-735-35@gated-at.bofh.it>
[not found] ` <abna7-7jK-3@gated-at.bofh.it>
[not found] ` <abo6b-11J-9@gated-at.bofh.it>
[not found] ` <aboSP-2Wf-29@gated-at.bofh.it>
[not found] ` <aboSP-2Wf-27@gated-at.bofh.it>
[not found] ` <abqrq-6eX-29@gated-at.bofh.it>
[not found] ` <abqrq-6eX-27@gated-at.bofh.it>
[not found] ` <abqKM-6Ka-13@gated-at.bofh.it>
2008-03-26 11:30 ` Bodo Eggert
[not found] ` <E1JeTq5-00018y-MO@be1.7eggert.dyndns.org>
2008-03-27 3:52 ` Greg KH
2008-03-27 4:57 ` H. Peter Anvin
2008-03-27 14:45 ` Mark Lord
2008-03-27 15:15 ` Greg KH
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=20080326033804.GA27925@suse.de \
--to=gregkh@suse.de \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=hpa@zytor.com \
--cc=htejun@gmail.com \
--cc=jgarzik@pobox.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=lkml@rtr.ca \
--cc=torvalds@osdl.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;
as well as URLs for NNTP newsgroup(s).