From: viro@www.linux.org.uk OK, here's the first part of long-promised large dev_t stuff - it's mostly the preparation to the switchover + fixes for related bugs I'd come accross. Summary follows, patches will go in separate mail. (1/12) removed unused kdev_t stuff, fixed a typo left from the console->device() conversion. (2/12) tty_paranoia_check() switched from kdev_t to struct inode. (3/12) killed gratitious uses of kdev_t in tpqic02 (4/12) jffs used to put kdev_t values on disk - blind copy of in-core representation. Switched to explicit use of u16 (which is what kdev_t currently is), with appropriate conversion (5/12) removed bogus uses of ->i_sb->s_dev in intermezzo (comparizons can and should simply compare ->i_sb, printks should use ->s_id). (6/12) * hpfs_unlink() should not try to truncate the victim unless it's a regular file; truncate will not help for anything else and it will screw the page cache if victim happens to be a block device. * network filesystems should *not* invalidate page cache of block device node when inode gets invalidated; fixed, added a new helper - invalidate_remote_inode(). * nfs setattr syncs the file before sending SETATTR to server; that makes a lot of sense for regular files, but not for anything else. Fixed. (7/12) removed dead code from sparc64 hugetlbpage.c (8/12) Now that floppy_open() stores bdev in opened_bdevs[drive], we can remove crap from floppy_read_block_0() and have it use that bdev instead of messing with bdget_disk()/setting ->bd_disk by hand/bdput(). (9/12) struct block_device made the private part of bdevfs inodes; bd_count is gone, we use ->i_count of inode now; separate hash is also gone and we are using iget5_locked()/igrab()/iput() instead. (10/12) new helper - iminor(inode); defined as minor(inode->i_rdev); lots and lots of places in drivers had been switched to it. (11/12) new helper - imajor(inode) (12/12) added the exclusion between ADD_PARTITION/DELETE_PARTITION/open() (BLKPG ioctls didn't grab ->bd_sem when they should have). added bdev->bd_part; it is set at open() to point to the hd_struct of partition in question, reset on final close. blk_partition_remap() uses ->bd_part instead of the current mess ->bd_offset is gone, we use ->bd_part->start_sect instead added missing ->release() to hd_struct kobject, moved kfree() into it ->bd_part cotributes to refcount of hd_struct - we bump it when ->bd_part is set and drop when it's reset. The next series will be switch ->i_rdev to dev_t and add proper conversions between dev_t and on-disk representations in filesystems, but I'd prefer to feed it separately. 1/12: removed unused kdev_t stuff, fixed a typo left from the console->device() conversion. arch/mips/sibyte/cfe/console.c | 4 ---- arch/ppc/8260_io/uart.c | 2 +- include/linux/kdev_t.h | 15 --------------- 3 files changed, 1 insertion(+), 20 deletions(-) diff -puN arch/mips/sibyte/cfe/console.c~large-dev_t-01 arch/mips/sibyte/cfe/console.c --- 25/arch/mips/sibyte/cfe/console.c~large-dev_t-01 2003-08-26 20:37:40.000000000 -0700 +++ 25-akpm/arch/mips/sibyte/cfe/console.c 2003-08-26 20:37:40.000000000 -0700 @@ -9,7 +9,6 @@ #include "cfe_error.h" extern int cfe_cons_handle; -static kdev_t cfe_consdev; static void cfe_console_write(struct console *cons, const char *str, unsigned int count) @@ -57,15 +56,12 @@ static int cfe_console_setup(struct cons #ifdef CONFIG_SIBYTE_SB1250_DUART if (!strcmp(consdev, "uart0")) { setleds("u0cn"); -// cfe_consdev = MKDEV(TTY_MAJOR, SB1250_DUART_MINOR_BASE + 0); } else if (!strcmp(consdev, "uart1")) { setleds("u1cn"); -// cfe_consdev = MKDEV(TTY_MAJOR, SB1250_DUART_MINOR_BASE + 1); #endif #ifdef CONFIG_VGA_CONSOLE } else if (!strcmp(consdev, "pcconsole0")) { setleds("pccn"); -// cfe_consdev = MKDEV(TTY_MAJOR, 0); #endif } else return -ENODEV; diff -puN arch/ppc/8260_io/uart.c~large-dev_t-01 arch/ppc/8260_io/uart.c --- 25/arch/ppc/8260_io/uart.c~large-dev_t-01 2003-08-26 20:37:40.000000000 -0700 +++ 25-akpm/arch/ppc/8260_io/uart.c 2003-08-26 20:37:40.000000000 -0700 @@ -2462,7 +2462,7 @@ void kgdb_map_scc(void) } #endif -static kdev_t serial_console_device(struct console *c) +static struct tty_driver *serial_console_device(struct console *c, int *index) { *index = c->index; return serial_driver; diff -puN include/linux/kdev_t.h~large-dev_t-01 include/linux/kdev_t.h --- 25/include/linux/kdev_t.h~large-dev_t-01 2003-08-26 20:37:40.000000000 -0700 +++ 25-akpm/include/linux/kdev_t.h 2003-08-26 21:42:49.000000000 -0700 @@ -90,23 +90,8 @@ static inline unsigned int kdev_val(kdev return dev.value; } -static inline kdev_t val_to_kdev(unsigned int val) -{ - kdev_t dev; - dev.value = val; - return dev; -} - -#define HASHDEV(dev) (kdev_val(dev)) #define NODEV (mk_kdev(0,0)) -static inline int kdev_same(kdev_t dev1, kdev_t dev2) -{ - return dev1.value == dev2.value; -} - -#define kdev_none(d1) (!kdev_val(d1)) - /* Mask off the high bits for now.. */ #define minor(dev) ((dev).value & 0xff) #define major(dev) (((dev).value >> KDEV_MINOR_BITS) & 0xff) _