lkml.org 
[lkml]   [2003]   [May]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subject[RFC] how to fix is_local_disk()?
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..
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:35    [from the cache]
©2003-2011 Jasper Spaans