From: Christoph Hellwig <hch@lst.de>
To: linux-kernel@vger.kernel.org
Subject: [RFC] how to fix is_local_disk()?
Date: Sun, 4 May 2003 09:00:03 +0200 [thread overview]
Message-ID: <20030504090003.A7285@lst.de> (raw)
In drivers/char/sysrq.c we have this nice piece of code:
/* do_emergency_sync helper function */
/* Guesses if the device is a local hard drive */
static int is_local_disk(struct block_device *bdev)
{
switch (MAJOR(bdev->bd_dev)) {
case IDE0_MAJOR:
<...>
case SCSI_DISK0_MAJOR:
<...>
case XT_DISK_MAJOR:
return 1;
default:
return 0;
}
now this has a bunch of problems:
(1) it's horribly out of data. e.g. it only lists half of the scsi
majors and nothing but ide and xt in addition to it. Second it tries
to guess local disks by majors which obviously doesn't work with
dynamic device number allocation or sub-major ranges. The easiest fix
would be to add a GENHD_FL_LOCAL flags for struct gendisk so
is_local_disk just becomes:
static int is_local_disk(struct block_device *bdev)
{
return (bdev->bd_disk->flags & GENHD_FL_LOCAL);
}
but do we actually want to keep this code? And it yes shouldn't
we have a reverse flag for don't emergency sync instead as the
number of block drivers needing this is probably much much smaller..
next reply other threads:[~2003-05-04 6:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-04 7:00 Christoph Hellwig [this message]
2003-05-04 7:30 ` [RFC] how to fix is_local_disk()? Andrew Morton
2003-05-04 7:53 ` Christoph Hellwig
2003-05-04 8:00 ` Andrew Morton
2003-05-04 17:10 ` Christoph Hellwig
2003-05-04 21:05 ` Andrew Morton
2003-05-05 7:41 ` viro
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=20030504090003.A7285@lst.de \
--to=hch@lst.de \
--cc=linux-kernel@vger.kernel.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