linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Mason <chris.mason@fusionio.com>
To: Josef Bacik <jbacik@fusionio.com>
Cc: Zach Brown <zab@zabbo.net>,
	"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH] Btrfs-progs: detect if the disk we are formatting is a ssd
Date: Fri, 20 Jul 2012 14:38:55 -0400	[thread overview]
Message-ID: <20120720183855.GL18878@shiny.int.fusionio.com> (raw)
In-Reply-To: <20120720182056.GE2118@localhost.localdomain>

On Fri, Jul 20, 2012 at 12:20:56PM -0600, Josef Bacik wrote:
> On Fri, Jul 20, 2012 at 12:18:59PM -0600, Zach Brown wrote:
> > > +static int is_ssd(const char *file)
> > > +{
> > > +	char *dev = strrchr(file, '/');
> > 
> >  [ ... ]
> > 
> > > +	snprintf(path, PATH_MAX, "/sys/block/%s/queue/rotational", dev);
> > > +	fd = open(path, O_RDONLY);
> > 
> > Hmm, this doesn't seem right.  The last path component can have nothing
> > to do with the underlying device name.  And /sys/block doesn't have
> > entries for partition devices.
> > 
> > After some poking around (and hints from Eric), it looks like the thing
> > to do is stat the file to find that it's a block device and then use
> > blkid_devno_to_wholedisk().  That parses the link from
> > /sys/dev/block/$maj:$min to find the containing device.
> > 
> > Then it'll work for partitions and nutty udev vanity symlinks.
> > 
> 
> Partitions are for losers.

Winners make a separate /boot, even when using syslinux to boot directly
off btrfs (syslinux is awesome everyone, switch now).

-chris


      parent reply	other threads:[~2012-07-20 18:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-20 15:11 [PATCH] Btrfs-progs: detect if the disk we are formatting is a ssd Josef Bacik
2012-07-20 18:18 ` Zach Brown
2012-07-20 18:20   ` Josef Bacik
2012-07-20 18:38     ` Zach Brown
2012-07-20 18:38     ` Chris Mason [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=20120720183855.GL18878@shiny.int.fusionio.com \
    --to=chris.mason@fusionio.com \
    --cc=jbacik@fusionio.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=zab@zabbo.net \
    /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).