linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] how to fix is_local_disk()?
@ 2003-05-04  7:00 Christoph Hellwig
  2003-05-04  7:30 ` Andrew Morton
  0 siblings, 1 reply; 7+ messages in thread
From: Christoph Hellwig @ 2003-05-04  7:00 UTC (permalink / raw)
  To: linux-kernel

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..

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2003-05-05  7:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-04  7:00 [RFC] how to fix is_local_disk()? Christoph Hellwig
2003-05-04  7:30 ` 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

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).