struct inode size reduction.
Subsystems (16)
Third retry, perhaps it'll make it through to the list now that vger is sending mail again...
I've been running with this patch, with no untoward consequences, seems to pass basic testing here, any objections before I push this Linuswards ? Al ? Christoph ?
Dave
include/linux/fs.h +5 -5
@@ -382,12 +382,12 @@ struct inode {struct address_space *i_mapping;struct address_space i_data;struct dquot *i_dquot[MAXQUOTAS ]; -/* These three should probably be a union */ struct list_head i_devices; -struct pipe_inode_info *i_pipe; -struct block_device *i_bdev; -struct char_device *i_cdev; - +union { +struct pipe_inode_info *i_pipe; +struct block_device *i_bdev; +struct char_device *i_cdev; + } type;unsigned long i_dnotify_mask;/* Directory notify events */ struct dnotify_struct *i_dnotify;/* for directory notifications */
arch/um/drivers/ubd_kern.c +5 -5
@@ -737,7 +737,7 @@ device_initcall(ubd_driver_init);static int ubd_open (struct inode *inode,struct file *filp) { -struct gendisk *disk = inode->i_bdev->bd_disk; +struct gendisk *disk = inode->type.i_bdev->bd_disk;struct ubd *dev = disk->private_data;int err = -EISDIR ;
@@ -766,7 +766,7 @@ static int ubd_open(struct inode *inode,static int ubd_release (struct inode * inode,struct file * file) { -struct gendisk *disk = inode->i_bdev->bd_disk; +struct gendisk *disk = inode->type.i_bdev->bd_disk;struct ubd *dev = disk->private_data;if (--dev->count ==0 )
@@ -894,7 +894,7 @@ static int ubd_ioctl(struct inode * inod unsigned int cmd, unsigned long arg) {struct hd_geometry *loc = (struct hd_geometry *) arg; -struct ubd *dev = inode->i_bdev->bd_disk->private_data; +struct ubd *dev = inode->type.i_bdev->bd_disk->private_data;int err;struct hd_driveid ubd_id = { .cyls =0 ,
@@ -915,7 +915,7 @@ static int ubd_ioctl(struct inode * inodcase HDIO_SET_UNMASKINTR :if (!capable (CAP_SYS_ADMIN ))return (-EACCES ); -if ((arg >1 ) || (inode->i_bdev->bd_contains != inode->i_bdev)) +if ((arg >1 ) || (inode->type.i_bdev->bd_contains != inode->type.i_bdev))return (-EINVAL );return (0 );
@@ -935,7 +935,7 @@ static int ubd_ioctl(struct inode * inodcase HDIO_SET_MULTCOUNT :if (!capable (CAP_SYS_ADMIN ))return (-EACCES ); -if (inode->i_bdev->bd_contains != inode->i_bdev) +if (inode->type.i_bdev->bd_contains != inode->type.i_bdev)return (-EINVAL );return (0 );
drivers/acorn/block/fd1772.c +2 -2
@@ -1314,7 +1314,7 @@ static int invalidate_drive(struct blockstatic int fd_ioctl (struct inode *inode,struct file *filp,unsigned int cmd,unsigned long param) { -struct block_device *bdev = inode->i_bdev; +struct block_device *bdev = inode->type.i_bdev;switch (cmd) {case FDFMTEND :
@@ -1481,7 +1481,7 @@ static int floppy_open(struct inode *inoreturn 0 ;if (filp->f_mode &3 ) { -check_disk_change (inode->i_bdev); +check_disk_change (inode->type.i_bdev);if (filp->f_mode &2 ) {if (unit[drive].wpstat) {floppy_release (inode, filp);
drivers/acorn/block/mfmhd.c +2 -2
@@ -1156,7 +1156,7 @@ static int mfm_initdrives(void)static int mfm_ioctl (struct inode *inode,struct file *file,u_int cmd,u_long arg) { -struct mfm_info *p = inode->i_bdev->bd_disk->private_data; +struct mfm_info *p = inode->type.i_bdev->bd_disk->private_data;struct hd_geometry *geo = (struct hd_geometry *) arg;if (cmd !=HDIO_GETGEO )return -EINVAL ;
@@ -1168,7 +1168,7 @@ static int mfm_ioctl(struct inode *inodereturn -EFAULT ;if (put_user (p->cylinders, &geo->cylinders))return -EFAULT ; -if (put_user (get_start_sect (inode->i_bdev), &geo->start)) +if (put_user (get_start_sect (inode->type.i_bdev), &geo->start))return -EFAULT ;return 0 ; }
drivers/block/DAC960.c +2 -2
@@ -5613,7 +5613,7 @@ static int DAC960_Open(Inode_T *Inode, F Controller->LogicalDriveInitiallyAccessible[LogicalDriveNumber] = true; size =disk_size (Controller, LogicalDriveNumber);set_capacity (Controller->disks[LogicalDriveNumber], size); - Inode->i_bdev->bd_invalidated =1 ; + Inode->type.i_bdev->bd_invalidated =1 ; }if (!get_capacity (Controller->disks[LogicalDriveNumber]))return -ENXIO ;
@@ -5709,7 +5709,7 @@ static int DAC960_IOCTL(Inode_T *Inode, LogicalDeviceInfo->ConfigurableDeviceSize / (Geometry.heads * Geometry.sectors); } - Geometry.start =get_start_sect (Inode->i_bdev); + Geometry.start =get_start_sect (Inode->type.i_bdev);return (copy_to_user (UserGeometry, &Geometry,sizeof (DiskGeometry_T)) ? -EFAULT :0 ); }
drivers/block/acsi.c +6 -6
@@ -1083,7 +1083,7 @@ static void redo_acsi_request( void )static int acsi_ioctl (struct inode *inode,struct file *file,unsigned int cmd,unsigned long arg ) { -struct gendisk *disk = inode->i_bdev->bd_disk; +struct gendisk *disk = inode->type.i_bdev->bd_disk;struct acsi_info_struct *aip = disk->private_data;switch (cmd) {case HDIO_GETGEO :
@@ -1095,7 +1095,7 @@ static int acsi_ioctl( struct inode *inoput_user (64 , &geo->heads );put_user (32 , &geo->sectors );put_user ( aip->size >>11 , &geo->cylinders ); -put_user (get_start_sect (inode->i_bdev), &geo->start); +put_user (get_start_sect (inode->type.i_bdev), &geo->start);return 0 ; }case SCSI_IOCTL_GET_IDLUN :
@@ -1127,14 +1127,14 @@ static int acsi_ioctl( struct inode *inostatic int acsi_open (struct inode * inode,struct file * filp ) { -struct gendisk *disk = inode->i_bdev->bd_disk; +struct gendisk *disk = inode->type.i_bdev->bd_disk;struct acsi_info_struct *aip = disk->private_data;if (aip->access_count ==0 && aip->removable) {#if 0 aip->changed =1 ;/* safety first */ #endif -check_disk_change ( inode->i_bdev ); +check_disk_change ( inode->type.i_bdev );if (aip->changed)/* revalidate was not successful (no medium) */ return -ENXIO ;acsi_prevent_removal (aip,1 );
@@ -1142,7 +1142,7 @@ static int acsi_open( struct inode * ino aip->access_count++;if (filp && filp->f_mode) { -check_disk_change ( inode->i_bdev ); +check_disk_change ( inode->type.i_bdev );if (filp->f_mode &2 ) {if (aip->read_only) {acsi_release ( inode, filp );
@@ -1161,7 +1161,7 @@ static int acsi_open( struct inode * inostatic int acsi_release (struct inode * inode,struct file * file ) { -struct gendisk *disk = inode->i_bdev->bd_disk; +struct gendisk *disk = inode->type.i_bdev->bd_disk;struct acsi_info_struct *aip = disk->private_data;if (--aip->access_count ==0 && aip->removable)acsi_prevent_removal (aip,0 );
drivers/block/amiflop.c +2 -2
@@ -1474,7 +1474,7 @@ static int fd_ioctl(struct inode *inode,rel_fdc ();return -EBUSY ; } -fsync_bdev (inode->i_bdev); +fsync_bdev (inode->type.i_bdev);if (fd_motor_on (drive) ==0 ) {rel_fdc ();return -ENODEV ;
@@ -1587,7 +1587,7 @@ static int floppy_open(struct inode *inoreturn -EBUSY ;if (filp && filp->f_mode &3 ) { -check_disk_change (inode->i_bdev); +check_disk_change (inode->type.i_bdev);if (filp->f_mode &2 ) {int wrprot;
drivers/block/ataflop.c +3 -3
@@ -1526,7 +1526,7 @@ static int fd_ioctl(struct inode *inode, {int drive, type;kdev_t device; -struct gendisk *disk = inode->i_bdev->bd_disk; +struct gendisk *disk = inode->type.i_bdev->bd_disk;struct atari_format_descr fmt_desc;struct atari_disk_type *dtp;struct floppy_struct getprm;
@@ -1701,7 +1701,7 @@ static int fd_ioctl(struct inode *inode,/* invalidate the buffer track to force a reread */ BufferDrive =-1 ;set_bit (drive, &fake_change); -check_disk_change (inode->i_bdev); +check_disk_change (inode->type.i_bdev);return 0 ;default :return -EINVAL ;
@@ -1871,7 +1871,7 @@ static int floppy_open( struct inode *inreturn 0 ;if (filp->f_mode &3 ) { -check_disk_change (inode->i_bdev); +check_disk_change (inode->type.i_bdev);if (filp->f_mode &2 ) {if (UD .wpstat) {floppy_release (inode, filp);
drivers/block/cciss.c +1 -1
@@ -415,7 +415,7 @@ static int cciss_ioctl(struct inode *ino driver_geo.sectors =0x3f ; driver_geo.cylinders = (int )hba[ctlr]->drv[dsk].nr_blocks / (0xff *0x3f ); } - driver_geo.start=get_start_sect (inode->i_bdev); + driver_geo.start=get_start_sect (inode->type.i_bdev);if (copy_to_user ((void *) arg, &driver_geo,sizeof (struct hd_geometry )))return -EFAULT ;
drivers/block/cpqarray.c +1 -1
@@ -1039,7 +1039,7 @@ static int ida_ioctl(struct inode *inodeput_user (diskinfo[0 ], &geo->heads);put_user (diskinfo[1 ], &geo->sectors);put_user (diskinfo[2 ], &geo->cylinders); -put_user (get_start_sect (inode->i_bdev), &geo->start); +put_user (get_start_sect (inode->type.i_bdev), &geo->start);return 0 ;case IDAGETDRVINFO : if (copy_to_user(&io->c.drv, &hba[ctlr]->drv[dsk],
drivers/block/floppy.c +4 -4
@@ -3525,11 +3525,11 @@ static int fd_ioctl(struct inode *inode, current_type[drive] =NULL ; floppy_sizes[drive] =MAX_DISK_SIZE <<1 ;UDRS ->keep_data =0 ; -return invalidate_drive (inode->i_bdev); +return invalidate_drive (inode->type.i_bdev);case FDSETPRM :case FDDEFPRM :return set_geometry (cmd, & inparam.g, - drive, type, inode->i_bdev); + drive, type, inode->type.i_bdev);case FDGETPRM : ECALL(get_floppy_geometry(drive, type, (struct floppy_struct**)
@@ -3560,7 +3560,7 @@ static int fd_ioctl(struct inode *inode,case FDFMTEND :case FDFLUSH :LOCK_FDC (drive,1 ); -return invalidate_drive (inode->i_bdev); +return invalidate_drive (inode->type.i_bdev);case FDSETEMSGTRESH : UDP->max_errors.reporting =
@@ -3782,7 +3782,7 @@ static int floppy_open(struct inode * inreturn 0 ;if (filp->f_mode &3 ) {UDRS ->last_checked =0 ; -check_disk_change (inode->i_bdev); +check_disk_change (inode->type.i_bdev);if (UTESTF (FD_DISK_CHANGED ))RETERR (ENXIO ); }
drivers/block/ioctl.c +1 -1
@@ -121,7 +121,7 @@ static int put_u64(unsigned long arg, u6int blkdev_ioctl (struct inode *inode,struct file *file,unsigned cmd,unsigned long arg) { -struct block_device *bdev = inode->i_bdev; +struct block_device *bdev = inode->type.i_bdev;struct gendisk *disk = bdev->bd_disk;struct backing_dev_info *bdi;int holder;
drivers/block/loop.c +6 -6
@@ -664,7 +664,7 @@ static int loop_set_fd(struct loop_devic lo_flags |=LO_FLAGS_READ_ONLY ;if (S_ISBLK (inode->i_mode)) { - lo_device = inode->i_bdev; + lo_device = inode->type.i_bdev;if (lo_device == bdev) { error = -EBUSY ; goto out;
@@ -910,16 +910,16 @@ static int loop_get_status(struct loop_dstatic int lo_ioctl (struct inode * inode,struct file * file,unsigned int cmd,unsigned long arg) { -struct loop_device *lo = inode->i_bdev->bd_disk->private_data; +struct loop_device *lo = inode->type.i_bdev->bd_disk->private_data;int err;down (&lo->lo_ctl_mutex);switch (cmd) {case LOOP_SET_FD : - err =loop_set_fd (lo, file, inode->i_bdev, arg); + err =loop_set_fd (lo, file, inode->type.i_bdev, arg);break ;case LOOP_CLR_FD : - err =loop_clr_fd (lo, inode->i_bdev); + err =loop_clr_fd (lo, inode->type.i_bdev);break ;case LOOP_SET_STATUS : err =loop_set_status (lo, (struct loop_info *) arg);
@@ -936,7 +936,7 @@ static int lo_ioctl(struct inode * inodestatic int lo_open (struct inode *inode,struct file *file) { -struct loop_device *lo = inode->i_bdev->bd_disk->private_data; +struct loop_device *lo = inode->type.i_bdev->bd_disk->private_data;int type;down (&lo->lo_ctl_mutex);
@@ -951,7 +951,7 @@ static int lo_open(struct inode *inode,static int lo_release (struct inode *inode,struct file *file) { -struct loop_device *lo = inode->i_bdev->bd_disk->private_data; +struct loop_device *lo = inode->type.i_bdev->bd_disk->private_data;int type;down (&lo->lo_ctl_mutex);
drivers/block/nbd.c +4 -4
@@ -97,7 +97,7 @@ static void nbd_end_request(struct requestatic int nbd_open (struct inode *inode,struct file *file) { -struct nbd_device *lo = inode->i_bdev->bd_disk->private_data; +struct nbd_device *lo = inode->type.i_bdev->bd_disk->private_data; lo->refcnt++;return 0 ; }
@@ -410,7 +410,7 @@ static void do_nbd_request(request_queuestatic int nbd_ioctl (struct inode *inode,struct file *file,unsigned int cmd,unsigned long arg) { -struct nbd_device *lo = inode->i_bdev->bd_disk->private_data; +struct nbd_device *lo = inode->type.i_bdev->bd_disk->private_data;int error, temp;struct request sreq ;
@@ -514,7 +514,7 @@ static int nbd_ioctl(struct inode *inode#ifdef PARANOIA case NBD_PRINT_DEBUG :printk (KERN_INFO "%s: next = %p, prev = %p. Global: in %d, out %d\n" , - inode->i_bdev->bd_disk->disk_name, lo->queue_head.next, + inode->type.i_bdev->bd_disk->disk_name, lo->queue_head.next, lo->queue_head.prev, requests_in, requests_out);return 0 ;#endif
@@ -524,7 +524,7 @@ static int nbd_ioctl(struct inode *inodestatic int nbd_release (struct inode *inode,struct file *file) { -struct nbd_device *lo = inode->i_bdev->bd_disk->private_data; +struct nbd_device *lo = inode->type.i_bdev->bd_disk->private_data;if (lo->refcnt <=0 )printk (KERN_ALERT "nbd_release: refcount(%d) <= 0\n" , lo->refcnt); lo->refcnt--;
drivers/block/paride/pcd.c +3 -3
@@ -245,20 +245,20 @@ static int pcd_warned; /* Have we loggestatic int pcd_block_open (struct inode *inode,struct file *file) { -struct pcd_unit *cd = inode->i_bdev->bd_disk->private_data; +struct pcd_unit *cd = inode->type.i_bdev->bd_disk->private_data;return cdrom_open (&cd->info, inode, file); }static int pcd_block_release (struct inode *inode,struct file *file) { -struct pcd_unit *cd = inode->i_bdev->bd_disk->private_data; +struct pcd_unit *cd = inode->type.i_bdev->bd_disk->private_data;return cdrom_release (&cd->info, file); }static int pcd_block_ioctl (struct inode *inode,struct file *file,unsigned cmd,unsigned long arg) { -struct pcd_unit *cd = inode->i_bdev->bd_disk->private_data; +struct pcd_unit *cd = inode->type.i_bdev->bd_disk->private_data;return cdrom_ioctl (&cd->info, inode, cmd, arg); }
drivers/block/paride/pd.c +4 -4
@@ -339,7 +339,7 @@ static void pd_init_units(void)static int pd_open (struct inode *inode,struct file *file) { -struct pd_unit *disk = inode->i_bdev->bd_disk->private_data; +struct pd_unit *disk = inode->type.i_bdev->bd_disk->private_data; disk->access++;
@@ -353,7 +353,7 @@ static int pd_open(struct inode *inode,static int pd_ioctl (struct inode *inode,struct file *file,unsigned int cmd,unsigned long arg) { -struct pd_unit *disk = inode->i_bdev->bd_disk->private_data; +struct pd_unit *disk = inode->type.i_bdev->bd_disk->private_data;struct hd_geometry *geo = (struct hd_geometry *) arg;struct hd_geometry g;
@@ -372,7 +372,7 @@ static int pd_ioctl(struct inode *inode, g.sectors = disk->sectors; g.cylinders = disk->cylinders; } - g.start =get_start_sect (inode->i_bdev); + g.start =get_start_sect (inode->type.i_bdev);if (copy_to_user (geo, &g,sizeof (struct hd_geometry )))return -EFAULT ;return 0 ;
@@ -383,7 +383,7 @@ static int pd_ioctl(struct inode *inode,static int pd_release (struct inode *inode,struct file *file) { -struct pd_unit *disk = inode->i_bdev->bd_disk->private_data; +struct pd_unit *disk = inode->type.i_bdev->bd_disk->private_data;if (!--disk->access && disk->removable)pd_doorlock (disk,IDE_DOORUNLOCK );
drivers/block/paride/pf.c +3 -3
@@ -320,7 +320,7 @@ void pf_init_units(void)static int pf_open (struct inode *inode,struct file *file) { -struct pf_unit *pf = inode->i_bdev->bd_disk->private_data; +struct pf_unit *pf = inode->type.i_bdev->bd_disk->private_data;pf_identify (pf);
@@ -339,7 +339,7 @@ static int pf_open(struct inode *inode,static int pf_ioctl (struct inode *inode,struct file *file,unsigned int cmd,unsigned long arg) { -struct pf_unit *pf = inode->i_bdev->bd_disk->private_data; +struct pf_unit *pf = inode->type.i_bdev->bd_disk->private_data;struct hd_geometry *geo = (struct hd_geometry *) arg;struct hd_geometry g;sector_t capacity;
@@ -370,7 +370,7 @@ static int pf_ioctl(struct inode *inode,static int pf_release (struct inode *inode,struct file *file) { -struct pf_unit *pf = inode->i_bdev->bd_disk->private_data; +struct pf_unit *pf = inode->type.i_bdev->bd_disk->private_data;if (pf->access <=0 )return -EINVAL ;
drivers/block/ps2esdi.c +2 -2
@@ -1058,7 +1058,7 @@ static void dump_cmd_complete_status(u_istatic int ps2esdi_ioctl (struct inode *inode,struct file *file,u_int cmd,u_long arg) { -struct ps2esdi_i_struct *p = inode->i_bdev->bd_disk->private_data; +struct ps2esdi_i_struct *p = inode->type.i_bdev->bd_disk->private_data;struct ps2esdi_geometry *geometry = (struct ps2esdi_geometry *) arg;int err;
@@ -1069,7 +1069,7 @@ static int ps2esdi_ioctl(struct inode *iput_user (p->head, (char *) &geometry->heads);put_user (p->sect, (char *) &geometry->sectors);put_user (p->cyl, (short *) &geometry->cylinders); -put_user (get_start_sect (inode->i_bdev), (long *) &geometry->start); +put_user (get_start_sect (inode->type.i_bdev), (long *) &geometry->start);return 0 ; }
drivers/block/rd.c +5 -5
@@ -256,12 +256,12 @@ static int rd_ioctl(struct inode *inode,it's not like with the other blockdevices where this ioctl only flushes away the buffer cache. */ error = -EBUSY ; -down (&inode->i_bdev->bd_sem); -if (inode->i_bdev->bd_openers <=2 ) { +down (&inode->type.i_bdev->bd_sem); +if (inode->type.i_bdev->bd_openers <=2 ) {truncate_inode_pages (inode->i_mapping,0 ); error =0 ; } -up (&inode->i_bdev->bd_sem); +up (&inode->type.i_bdev->bd_sem);return error; }
@@ -290,7 +290,7 @@ static int initrd_release(struct inode * {extern void free_initrd_mem (unsigned long ,unsigned long ); -blkdev_put (inode->i_bdev,BDEV_FILE ); +blkdev_put (inode->type.i_bdev,BDEV_FILE );spin_lock (&initrd_users_lock);if (!--initrd_users) {
@@ -337,7 +337,7 @@ static int rd_open(struct inode * inode,* Immunize device against invalidate_buffers() and prune_icache(). */ if (rd_bdev[unit] ==NULL ) { -struct block_device *bdev = inode->i_bdev; +struct block_device *bdev = inode->type.i_bdev;atomic_inc (&bdev->bd_count); rd_bdev[unit] = bdev; bdev->bd_openers++;
drivers/block/swim3.c +4 -4
@@ -815,7 +815,7 @@ static struct floppy_struct floppy_typestatic int floppy_ioctl (struct inode *inode,struct file *filp,unsigned int cmd,unsigned long param) { -struct floppy_state *fs = inode->i_bdev->bd_disk->private_data; +struct floppy_state *fs = inode->type.i_bdev->bd_disk->private_data;int err;if ((cmd &0x80 ) && !capable (CAP_SYS_ADMIN ))
@@ -841,7 +841,7 @@ static int floppy_ioctl(struct inode *instatic int floppy_open (struct inode *inode,struct file *filp) { -struct floppy_state *fs = inode->i_bdev->bd_disk->private_data; +struct floppy_state *fs = inode->type.i_bdev->bd_disk->private_data;volatile struct swim3 *sw = fs->swim3;int n, err =0 ;
@@ -877,7 +877,7 @@ static int floppy_open(struct inode *inoif (err ==0 && (filp->f_flags &O_NDELAY ) ==0 && (filp->f_mode &3 )) { -check_disk_change (inode->i_bdev); +check_disk_change (inode->type.i_bdev);if (fs->ejected) err = -ENXIO ; }
@@ -907,7 +907,7 @@ static int floppy_open(struct inode *inostatic int floppy_release (struct inode *inode,struct file *filp) { -struct floppy_state *fs = inode->i_bdev->bd_disk->private_data; +struct floppy_state *fs = inode->type.i_bdev->bd_disk->private_data;volatile struct swim3 *sw = fs->swim3;if (fs->ref_count >0 && --fs->ref_count ==0 ) {swim3_action (fs,MOTOR_OFF );
drivers/block/swim_iop.c +4 -4
@@ -345,7 +345,7 @@ static struct floppy_struct floppy_typestatic int floppy_ioctl (struct inode *inode,struct file *filp,unsigned int cmd,unsigned long param) { -struct floppy_state *fs = inode->i_bdev->bd_disk->private_data; +struct floppy_state *fs = inode->type.i_bdev->bd_disk->private_data;int err;if ((cmd &0x80 ) && !capable (CAP_SYS_ADMIN ))
@@ -368,13 +368,13 @@ static int floppy_ioctl(struct inode *instatic int floppy_open (struct inode *inode,struct file *filp) { -struct floppy_state *fs = inode->i_bdev->bd_disk->private_data; +struct floppy_state *fs = inode->type.i_bdev->bd_disk->private_data;if (fs->ref_count ==-1 || filp->f_flags &O_EXCL )return -EBUSY ;if ((filp->f_flags &O_NDELAY ) ==0 && (filp->f_mode &3 )) { -check_disk_change (inode->i_bdev); +check_disk_change (inode->type.i_bdev);if (fs->ejected)return -ENXIO ; }
@@ -392,7 +392,7 @@ static int floppy_open(struct inode *inostatic int floppy_release (struct inode *inode,struct file *filp) { -struct floppy_state *fs = inode->i_bdev->bd_disk->private_data; +struct floppy_state *fs = inode->type.i_bdev->bd_disk->private_data;if (fs->ref_count >0 ) fs->ref_count--;return 0 ;
drivers/block/umem.c +2 -2
@@ -815,7 +815,7 @@ static int mm_revalidate(struct gendiskstatic int mm_ioctl (struct inode *i,struct file *f,unsigned int cmd,unsigned long arg) {if (cmd ==HDIO_GETGEO ) { -struct cardinfo *card = i->i_bdev->bd_disk->private_data; +struct cardinfo *card = i->type.i_bdev->bd_disk->private_data;int size = card->mm_size * (1024 /MM_HARDSECT );struct hd_geometry geo;/*
@@ -825,7 +825,7 @@ static int mm_ioctl(struct inode *i, str*/ geo.heads =64 ; geo.sectors =32 ; - geo.start =get_start_sect (i->i_bdev); + geo.start =get_start_sect (i->type.i_bdev); geo.cylinders = size / (geo.heads * geo.sectors);if (copy_to_user ((void *) arg, &geo,sizeof (geo)))
drivers/block/xd.c +2 -2
@@ -317,7 +317,7 @@ static void do_xd_request (request_queue/* xd_ioctl: handle device ioctl's */ static int xd_ioctl (struct inode *inode,struct file *file,u_int cmd,u_long arg) { -XD_INFO *p = inode->i_bdev->bd_disk->private_data; +XD_INFO *p = inode->type.i_bdev->bd_disk->private_data;switch (cmd) {case HDIO_GETGEO :
@@ -327,7 +327,7 @@ static int xd_ioctl (struct inode *inode g.heads = p->heads; g.sectors = p->sectors; g.cylinders = p->cylinders; - g.start =get_start_sect (inode->i_bdev); + g.start =get_start_sect (inode->type.i_bdev);return copy_to_user (geometry, &g,sizeof g) ? -EFAULT :0 ; }case HDIO_SET_DMA :
drivers/cdrom/aztcd.c +1 -1
@@ -1679,7 +1679,7 @@ static int aztcd_release(struct inode *i#ifdef AZT_DEBUG printk ("aztcd: executing aztcd_release\n" );printk ("inode: %p, device: %s file: %p\n" , inode, - inode->i_bdev->bd_disk->disk_name, file); + inode->type.i_bdev->bd_disk->disk_name, file);#endif if (!--azt_open_count) {azt_invalidate_buffers ();
drivers/cdrom/cdrom.c +3 -3
@@ -436,7 +436,7 @@ int cdrom_open(struct cdrom_device_infocdinfo (CD_OPEN ,"Use count for \"/dev/%s\" now %d\n" , cdi->name, cdi->use_count);/* Do this on open. Don't wait for mount, because they might not be mounting, but opening with O_NONBLOCK */ -check_disk_change (ip->i_bdev); +check_disk_change (ip->type.i_bdev);return ret; }
@@ -1439,7 +1439,7 @@ int cdrom_ioctl(struct cdrom_device_infoint ret;/* Try the generic SCSI command ioctl's first.. */ - ret =scsi_cmd_ioctl (ip->i_bdev, cmd, arg); + ret =scsi_cmd_ioctl (ip->type.i_bdev, cmd, arg);if (ret != -ENOTTY )return ret;
@@ -1592,7 +1592,7 @@ int cdrom_ioctl(struct cdrom_device_infocdinfo (CD_DO_IOCTL ,"entering CDROM_RESET\n" );if (!CDROM_CAN (CDC_RESET ))return -ENOSYS ; -invalidate_bdev (ip->i_bdev,0 ); +invalidate_bdev (ip->type.i_bdev,0 );return cdo->reset (cdi); }
drivers/cdrom/mcdx.c +3 -3
@@ -223,20 +223,20 @@ void do_mcdx_request(request_queue_t * qstatic int mcdx_block_open (struct inode *inode,struct file *file) { -struct s_drive_stuff *p = inode->i_bdev->bd_disk->private_data; +struct s_drive_stuff *p = inode->type.i_bdev->bd_disk->private_data;return cdrom_open (&p->info, inode, file); }static int mcdx_block_release (struct inode *inode,struct file *file) { -struct s_drive_stuff *p = inode->i_bdev->bd_disk->private_data; +struct s_drive_stuff *p = inode->type.i_bdev->bd_disk->private_data;return cdrom_release (&p->info, file); }static int mcdx_block_ioctl (struct inode *inode,struct file *file,unsigned cmd,unsigned long arg) { -struct s_drive_stuff *p = inode->i_bdev->bd_disk->private_data; +struct s_drive_stuff *p = inode->type.i_bdev->bd_disk->private_data;return cdrom_ioctl (&p->info, inode, cmd, arg); }
drivers/cdrom/optcd.c +1 -1
@@ -1897,7 +1897,7 @@ static int opt_release(struct inode *ip,DEBUG ((DEBUG_VFS ,"executing opt_release" ));DEBUG ((DEBUG_VFS ,"inode: %p, device: %s, file: %p\n" , - ip, ip->i_bdev->bd_disk->disk_name, fp)); + ip, ip->type.i_bdev->bd_disk->disk_name, fp));if (!--open_count) { toc_uptodate =0 ;
drivers/cdrom/sbpcd.c +3 -3
@@ -5358,20 +5358,20 @@ static int sbp_data(struct request *req)static int sbpcd_block_open (struct inode *inode,struct file *file) { -struct sbpcd_drive *p = inode->i_bdev->bd_disk->private_data; +struct sbpcd_drive *p = inode->type.i_bdev->bd_disk->private_data;return cdrom_open (p->sbpcd_infop, inode, file); }static int sbpcd_block_release (struct inode *inode,struct file *file) { -struct sbpcd_drive *p = inode->i_bdev->bd_disk->private_data; +struct sbpcd_drive *p = inode->type.i_bdev->bd_disk->private_data;return cdrom_release (p->sbpcd_infop, file); }static int sbpcd_block_ioctl (struct inode *inode,struct file *file,unsigned cmd,unsigned long arg) { -struct sbpcd_drive *p = inode->i_bdev->bd_disk->private_data; +struct sbpcd_drive *p = inode->type.i_bdev->bd_disk->private_data;return cdrom_ioctl (p->sbpcd_infop, inode, cmd, arg); }
drivers/cdrom/sonycd535.c +1 -1
@@ -1377,7 +1377,7 @@ cdu_open(struct inode *inode, sony_inuse =0 ;return -EIO ; } -check_disk_change (inode->i_bdev); +check_disk_change (inode->type.i_bdev); sony_usage++;#ifdef LOCK_DOORS
drivers/ide/ide-cd.c +3 -3
@@ -3272,7 +3272,7 @@ static ide_driver_t ide_cdrom_driver = {static int idecd_open (struct inode * inode,struct file * file) { -ide_drive_t *drive = inode->i_bdev->bd_disk->private_data; +ide_drive_t *drive = inode->type.i_bdev->bd_disk->private_data;struct cdrom_info *info = drive->driver_data;int rc = -ENOMEM ; drive->usage++;
@@ -3286,7 +3286,7 @@ static int idecd_open(struct inode * inostatic int idecd_release (struct inode * inode,struct file * file) { -ide_drive_t *drive = inode->i_bdev->bd_disk->private_data; +ide_drive_t *drive = inode->type.i_bdev->bd_disk->private_data;struct cdrom_info *info = drive->driver_data;cdrom_release (&info->devinfo, file);
@@ -3297,7 +3297,7 @@ static int idecd_release(struct inode *static int idecd_ioctl (struct inode *inode,struct file *file,unsigned int cmd,unsigned long arg) { -struct block_device *bdev = inode->i_bdev; +struct block_device *bdev = inode->type.i_bdev;ide_drive_t *drive = bdev->bd_disk->private_data;int err =generic_ide_ioctl (bdev, cmd, arg);if (err == -EINVAL ) {
drivers/ide/ide-disk.c +5 -5
@@ -1680,7 +1680,7 @@ static ide_driver_t idedisk_driver = {static int idedisk_open (struct inode *inode,struct file *filp) { -ide_drive_t *drive = inode->i_bdev->bd_disk->private_data; +ide_drive_t *drive = inode->type.i_bdev->bd_disk->private_data; drive->usage++;if (drive->removable && drive->usage ==1 ) {ide_task_t args;
@@ -1688,7 +1688,7 @@ static int idedisk_open(struct inode *inmemset (&args,0 ,sizeof (ide_task_t)); args.tfRegister[IDE_COMMAND_OFFSET ] =WIN_DOORLOCK ; args.command_type =ide_cmd_type_parser (&args); -check_disk_change (inode->i_bdev); +check_disk_change (inode->type.i_bdev);/* * Ignore the return code from door_lock, * since the open() has already succeeded,
@@ -1728,13 +1728,13 @@ static int ide_cacheflush_p(ide_drive_tstatic int idedisk_release (struct inode *inode,struct file *filp) { -ide_drive_t *drive = inode->i_bdev->bd_disk->private_data; +ide_drive_t *drive = inode->type.i_bdev->bd_disk->private_data;if (drive->removable && drive->usage ==1 ) {ide_task_t args;memset (&args,0 ,sizeof (ide_task_t)); args.tfRegister[IDE_COMMAND_OFFSET ] =WIN_DOORUNLOCK ; args.command_type =ide_cmd_type_parser (&args); -invalidate_bdev (inode->i_bdev,0 ); +invalidate_bdev (inode->type.i_bdev,0 );if (drive->doorlocking &&ide_raw_taskfile (drive, &args,NULL )) drive->doorlocking =0 ; }
@@ -1746,7 +1746,7 @@ static int idedisk_release(struct inodestatic int idedisk_ioctl (struct inode *inode,struct file *file,unsigned int cmd,unsigned long arg) { -struct block_device *bdev = inode->i_bdev; +struct block_device *bdev = inode->type.i_bdev;return generic_ide_ioctl (bdev, cmd, arg); }
drivers/ide/ide-floppy.c +4 -4
@@ -1867,7 +1867,7 @@ static ide_driver_t idefloppy_driver = {static int idefloppy_open (struct inode *inode,struct file *filp) { -ide_drive_t *drive = inode->i_bdev->bd_disk->private_data; +ide_drive_t *drive = inode->type.i_bdev->bd_disk->private_data;idefloppy_floppy_t *floppy = drive->driver_data;idefloppy_pc_t pc;
@@ -1907,7 +1907,7 @@ static int idefloppy_open(struct inode *idefloppy_create_prevent_cmd (&pc,1 ); (void )idefloppy_queue_pc_tail (drive, &pc); } -check_disk_change (inode->i_bdev); +check_disk_change (inode->type.i_bdev); }else if (test_bit (IDEFLOPPY_FORMAT_IN_PROGRESS , &floppy->flags)) { drive->usage--;return -EBUSY ;
@@ -1917,7 +1917,7 @@ static int idefloppy_open(struct inode *static int idefloppy_release (struct inode *inode,struct file *filp) { -ide_drive_t *drive = inode->i_bdev->bd_disk->private_data; +ide_drive_t *drive = inode->type.i_bdev->bd_disk->private_data;idefloppy_pc_t pc;debug_log (KERN_INFO "Reached idefloppy_release\n" );
@@ -1940,7 +1940,7 @@ static int idefloppy_release(struct inodstatic int idefloppy_ioctl (struct inode *inode,struct file *file,unsigned int cmd,unsigned long arg) { -struct block_device *bdev = inode->i_bdev; +struct block_device *bdev = inode->type.i_bdev;ide_drive_t *drive = bdev->bd_disk->private_data;idefloppy_floppy_t *floppy = drive->driver_data;int err =generic_ide_ioctl (bdev, cmd, arg);
drivers/ide/ide-tape.c +3 -3
@@ -6246,14 +6246,14 @@ static struct file_operations idetape_fostatic int idetape_open (struct inode *inode,struct file *filp) { -ide_drive_t *drive = inode->i_bdev->bd_disk->private_data; +ide_drive_t *drive = inode->type.i_bdev->bd_disk->private_data; drive->usage++;return 0 ; }static int idetape_release (struct inode *inode,struct file *filp) { -ide_drive_t *drive = inode->i_bdev->bd_disk->private_data; +ide_drive_t *drive = inode->type.i_bdev->bd_disk->private_data; drive->usage--;return 0 ; }
@@ -6261,7 +6261,7 @@ static int idetape_release(struct inodestatic int idetape_ioctl (struct inode *inode,struct file *file,unsigned int cmd,unsigned long arg) { -struct block_device *bdev = inode->i_bdev; +struct block_device *bdev = inode->type.i_bdev;ide_drive_t *drive = bdev->bd_disk->private_data;int err =generic_ide_ioctl (bdev, cmd, arg);if (err == -EINVAL )
drivers/ide/legacy/hd.c +2 -2
@@ -659,7 +659,7 @@ static void do_hd_request (request_queuestatic int hd_ioctl (struct inode * inode,struct file * file,unsigned int cmd,unsigned long arg) { -struct hd_i_struct *disk = inode->i_bdev->bd_disk->private_data; +struct hd_i_struct *disk = inode->type.i_bdev->bd_disk->private_data;struct hd_geometry *loc = (struct hd_geometry *) arg;struct hd_geometry g;
@@ -670,7 +670,7 @@ static int hd_ioctl(struct inode * inode g.heads = disk->head; g.sectors = disk->sect; g.cylinders = disk->cyl; - g.start =get_start_sect (inode->i_bdev); + g.start =get_start_sect (inode->type.i_bdev);return copy_to_user (loc, &g,sizeof g) ? -EFAULT :0 ; }
drivers/md/dm.c +2 -2
@@ -159,7 +159,7 @@ static int dm_blk_open(struct inode *ino {struct mapped_device *md; - md = inode->i_bdev->bd_disk->private_data; + md = inode->type.i_bdev->bd_disk->private_data;dm_get (md);return 0 ; }
@@ -168,7 +168,7 @@ static int dm_blk_close(struct inode *in {struct mapped_device *md; - md = inode->i_bdev->bd_disk->private_data; + md = inode->type.i_bdev->bd_disk->private_data;dm_put (md);return 0 ; }
drivers/md/md.c +4 -4
@@ -2238,7 +2238,7 @@ static int md_ioctl(struct inode *inode,* Commands creating/starting a new array: */ - mddev = inode->i_bdev->bd_inode->u.generic_ip; + mddev = inode->type.i_bdev->bd_inode->u.generic_ip;if (!mddev) {BUG ();
@@ -2354,7 +2354,7 @@ static int md_ioctl(struct inode *inode, (short *) &loc->cylinders);if (err) goto abort_unlock; - err =put_user (get_start_sect (inode->i_bdev), + err =put_user (get_start_sect (inode->type.i_bdev), (long *) &loc->start); goto done_unlock; }
@@ -2447,7 +2447,7 @@ static int md_open(struct inode *inode, err =0 ;mddev_unlock (mddev); - inode->i_bdev->bd_inode->u.generic_ip =mddev_get (mddev); + inode->type.i_bdev->bd_inode->u.generic_ip =mddev_get (mddev); put:mddev_put (mddev); out:
@@ -2456,7 +2456,7 @@ static int md_open(struct inode *inode,static int md_release (struct inode *inode,struct file * file) { -mddev_t *mddev = inode->i_bdev->bd_inode->u.generic_ip; +mddev_t *mddev = inode->type.i_bdev->bd_inode->u.generic_ip;if (!mddev)BUG ();
drivers/message/i2o/i2o_block.c +4 -4
@@ -892,7 +892,7 @@ static void i2o_block_biosparam(static int i2ob_ioctl (struct inode *inode,struct file *file,unsigned int cmd,unsigned long arg) { -struct gendisk *disk = inode->i_bdev->bd_disk; +struct gendisk *disk = inode->type.i_bdev->bd_disk;struct i2ob_device *dev = disk->private_data;/* Anyone capable of this syscall can do *real bad* things */
@@ -905,7 +905,7 @@ static int i2ob_ioctl(struct inode *inodstruct hd_geometry g;i2o_block_biosparam (get_capacity (disk), &g.cylinders, &g.heads, &g.sectors); - g.start =get_start_sect (inode->i_bdev); + g.start =get_start_sect (inode->type.i_bdev);return copy_to_user ((void *)arg,&g,sizeof (g))?-EFAULT :0 ; }
@@ -933,7 +933,7 @@ static int i2ob_ioctl(struct inode *inodstatic int i2ob_release (struct inode *inode,struct file *file) { -struct gendisk *disk = inode->i_bdev->bd_disk; +struct gendisk *disk = inode->type.i_bdev->bd_disk;struct i2ob_device *dev = disk->private_data;/*
@@ -1005,7 +1005,7 @@ static int i2ob_release(struct inode *instatic int i2ob_open (struct inode *inode,struct file *file) { -struct gendisk *disk = inode->i_bdev->bd_disk; +struct gendisk *disk = inode->type.i_bdev->bd_disk;struct i2ob_device *dev = disk->private_data;if (!dev->i2odev)
drivers/mtd/devices/blkmtd.c +1 -1
@@ -1103,7 +1103,7 @@ static int __init init_blkmtd(void)filp_close (file,NULL ); return 1; } - rdev = inode->i_bdev->bd_dev; + rdev = inode->type.i_bdev->bd_dev;filp_close (file,NULL );#else rdev =name_to_dev_t (device);
drivers/mtd/ftl.c +6 -6
@@ -823,7 +823,7 @@ static u_int32_t find_free(partition_t *static int ftl_open (struct inode *inode,struct file *file) { -partition_t *partition = inode->i_bdev->bd_disk->private_data; +partition_t *partition = inode->type.i_bdev->bd_disk->private_data;if (!partition)return -ENODEV ;
@@ -841,7 +841,7 @@ static int ftl_open(struct inode *inode,return -EROFS ; } -DEBUG (0 ,"ftl_cs: ftl_open(%s)\n" , inode->i_bdev->bd_disk->disk_name); +DEBUG (0 ,"ftl_cs: ftl_open(%s)\n" , inode->type.i_bdev->bd_disk->disk_name);atomic_inc (&partition->open);
@@ -852,10 +852,10 @@ static int ftl_open(struct inode *inode,static release_t ftl_close (struct inode *inode,struct file *file) { -partition_t *part = inode->i_bdev->bd_disk->private_data; +partition_t *part = inode->type.i_bdev->bd_disk->private_data;int i; -DEBUG (0 ,"ftl_cs: ftl_close(%s)\n" , inode->i_bdev->bd_disk->disk_name); +DEBUG (0 ,"ftl_cs: ftl_close(%s)\n" , inode->type.i_bdev->bd_disk->disk_name);/* Wait for any pending erase operations to complete */ if (part->mtd->sync)
@@ -1083,7 +1083,7 @@ static int ftl_write(partition_t *part,static int ftl_ioctl (struct inode *inode,struct file *file,u_int cmd,u_long arg) { -partition_t *part = inode->i_bdev->bd_disk->private_data; +partition_t *part = inode->type.i_bdev->bd_disk->private_data;struct hd_geometry *geo = (struct hd_geometry *)arg;int ret =0 ;u_long sect;
@@ -1101,7 +1101,7 @@ static int ftl_ioctl(struct inode *inodeput_user (1 , (char *)&geo->heads);put_user (8 , (char *)&geo->sectors);put_user ((sect>>3 ), (short *)&geo->cylinders); -put_user (get_start_sect (inode->i_bdev), (u_long *)&geo->start); +put_user (get_start_sect (inode->type.i_bdev), (u_long *)&geo->start);return 0 ; }/* ftl_ioctl */
drivers/mtd/mtdblock.c +3 -3
@@ -325,7 +325,7 @@ static int mtdblock_open(struct inode *i } mtdblks[dev] = mtdblk; -set_device_ro (inode->i_bdev, !(mtdblk->mtd->flags &MTD_WRITEABLE )); +set_device_ro (inode->type.i_bdev, !(mtdblk->mtd->flags &MTD_WRITEABLE ));spin_unlock (&mtdblks_lock);
@@ -495,8 +495,8 @@ static int mtdblock_ioctl(struct inode *switch (cmd) {case BLKFLSBUF : -fsync_bdev (inode->i_bdev); -invalidate_bdev (inode->i_bdev,0 ); +fsync_bdev (inode->type.i_bdev); +invalidate_bdev (inode->type.i_bdev,0 );down (&mtdblk->cache_sem);write_cached_data (mtdblk);up (&mtdblk->cache_sem);
drivers/mtd/mtdblock_ro.c +6 -6
@@ -42,7 +42,7 @@ static spinlock_t mtdro_lock = SPIN_LOCKstatic int mtdblock_open (struct inode *inode,struct file *file) { -struct mtdro_dev *mdev = inode->i_bdev->bd_disk->private_data; +struct mtdro_dev *mdev = inode->type.i_bdev->bd_disk->private_data;int ret =0 ;DEBUG (1 ,"mtdblock_open\n" );
@@ -58,7 +58,7 @@ static int mtdblock_open(struct inode *i }if (ret ==0 ) { -set_device_ro (inode->i_bdev, !(mdev->mtd->flags &MTD_CAP_RAM )); +set_device_ro (inode->type.i_bdev, !(mdev->mtd->flags &MTD_CAP_RAM )); mdev->open++; }up (&mtd_sem);
@@ -70,7 +70,7 @@ static int mtdblock_open(struct inode *istatic release_t mtdblock_release (struct inode *inode,struct file *file) { -struct mtdro_dev *mdev = inode->i_bdev->bd_disk->private_data; +struct mtdro_dev *mdev = inode->type.i_bdev->bd_disk->private_data;DEBUG (1 ,"mtdblock_release\n" );
@@ -170,13 +170,13 @@ static void mtdblock_request(request_questatic int mtdblock_ioctl (struct inode * inode,struct file * file,unsigned int cmd,unsigned long arg) { -struct mtdro_dev *mdev = inode->i_bdev->bd_disk->private_data; +struct mtdro_dev *mdev = inode->type.i_bdev->bd_disk->private_data;if (cmd !=BLKFLSBUF )return -EINVAL ; -fsync_bdev (inode->i_bdev); -invalidate_bdev (inode->i_bdev,0 ); +fsync_bdev (inode->type.i_bdev); +invalidate_bdev (inode->type.i_bdev,0 );if (mdev->mtd->sync) mdev->mtd->sync (mdev->mtd);
drivers/mtd/nftlcore.c +6 -6
@@ -756,7 +756,7 @@ static int NFTL_readblock(struct NFTLrecstatic int nftl_ioctl (struct inode * inode,struct file * file,unsigned int cmd,unsigned long arg) { -struct NFTLrecord *nftl = inode->i_bdev->bd_disk->private_data; +struct NFTLrecord *nftl = inode->type.i_bdev->bd_disk->private_data;switch (cmd) {case HDIO_GETGEO : {struct hd_geometry g;
@@ -764,12 +764,12 @@ static int nftl_ioctl(struct inode * ino g.heads = nftl->heads; g.sectors = nftl->sectors; g.cylinders = nftl->cylinders; - g.start =get_start_sect (inode->i_bdev); + g.start =get_start_sect (inode->type.i_bdev);return copy_to_user ((void *)arg, &g,sizeof g) ? -EFAULT :0 ; }case BLKFLSBUF : -fsync_bdev (inode->i_bdev); -invalidate_bdev (inode->i_bdev,0 ); +fsync_bdev (inode->type.i_bdev); +invalidate_bdev (inode->type.i_bdev,0 );if (nftl->mtd->sync) nftl->mtd->sync (nftl->mtd);return 0 ;
@@ -869,7 +869,7 @@ static struct gendisk *nftl_probe(dev_tstatic int nftl_open (struct inode *ip,struct file *fp) { -struct NFTLrecord *thisNFTL = ip->i_bdev->bd_disk->private_data; +struct NFTLrecord *thisNFTL = ip->type.i_bdev->bd_disk->private_data;DEBUG (MTD_DEBUG_LEVEL2 ,"NFTL_open\n" );if (!thisNFTL)
@@ -888,7 +888,7 @@ static int nftl_open(struct inode *ip, sstatic int nftl_release (struct inode *inode,struct file *fp) { -struct NFTLrecord *thisNFTL = inode->i_bdev->bd_disk->private_data; +struct NFTLrecord *thisNFTL = inode->type.i_bdev->bd_disk->private_data;DEBUG (MTD_DEBUG_LEVEL2 ,"NFTL_release\n" );
drivers/s390/block/dasd.c +2 -2
@@ -1728,7 +1728,7 @@ dasd_open(struct inode *inp, struct filereturn -EPERM ; } - device = inp->i_bdev->bd_disk->private_data; + device = inp->type.i_bdev->bd_disk->private_data;if (device->state <DASD_STATE_BASIC ) {DBF_DEV_EVENT (DBF_ERR , device," %s" ," Cannot open unrecognized device" );
@@ -1751,7 +1751,7 @@ dasd_release(struct inode *inp, struct f {dasd_device_t *device; - device = inp->i_bdev->bd_disk->private_data; + device = inp->type.i_bdev->bd_disk->private_data;if (device->state <DASD_STATE_ACCEPT ) { DBF_DEV_EVENT(DBF_ERR, device, " %s",
drivers/s390/block/dasd_ioctl.c +1 -1
@@ -88,7 +88,7 @@ int dasd_ioctl(struct inode *inp, struct file *filp, unsigned int no, unsigned long data) { - struct block_device *bdev = inp->i_bdev; + struct block_device *bdev = inp->type.i_bdev;dasd_device_t *device = bdev->bd_disk->private_data;dasd_ioctl_list_t *ioctl;struct list_head *l;
drivers/scsi/ide-scsi.c +3 -3
@@ -634,14 +634,14 @@ static ide_driver_t idescsi_driver = {static int idescsi_ide_open (struct inode *inode,struct file *filp) { -ide_drive_t *drive = inode->i_bdev->bd_disk->private_data; +ide_drive_t *drive = inode->type.i_bdev->bd_disk->private_data; drive->usage++;return 0 ; }static int idescsi_ide_release (struct inode *inode,struct file *filp) { -ide_drive_t *drive = inode->i_bdev->bd_disk->private_data; +ide_drive_t *drive = inode->type.i_bdev->bd_disk->private_data; drive->usage--;return 0 ; }
@@ -649,7 +649,7 @@ static int idescsi_ide_release(struct instatic int idescsi_ide_ioctl (struct inode *inode,struct file *file,unsigned int cmd,unsigned long arg) { -struct block_device *bdev = inode->i_bdev; +struct block_device *bdev = inode->type.i_bdev;return generic_ide_ioctl (bdev, cmd, arg); }
drivers/scsi/sd.c +4 -4
@@ -377,7 +377,7 @@ queue:**/ static int sd_open (struct inode *inode,struct file *filp) { -struct gendisk *disk = inode->i_bdev->bd_disk; +struct gendisk *disk = inode->type.i_bdev->bd_disk;struct scsi_disk *sdkp =scsi_disk (disk);struct scsi_device *sdev = sdkp->device;int retval;
@@ -397,7 +397,7 @@ static int sd_open(struct inode *inode, goto error_out;if (sdev->removable) { -check_disk_change (inode->i_bdev); +check_disk_change (inode->type.i_bdev);/* * If the drive is empty, just let the open fail.
@@ -450,7 +450,7 @@ error_out:**/ static int sd_release (struct inode *inode,struct file *filp) { -struct gendisk *disk = inode->i_bdev->bd_disk; +struct gendisk *disk = inode->type.i_bdev->bd_disk;struct scsi_device *sdev =scsi_disk (disk)->device;SCSI_LOG_HLQUEUE (3 ,printk ("sd_release: disk=%s\n" , disk->disk_name));
@@ -514,7 +514,7 @@ static int sd_hdio_getgeo(struct block_dstatic int sd_ioctl (struct inode * inode,struct file * filp,unsigned int cmd,unsigned long arg) { -struct block_device *bdev = inode->i_bdev; +struct block_device *bdev = inode->type.i_bdev;struct gendisk *disk = bdev->bd_disk;struct scsi_device *sdp =scsi_disk (disk)->device;int error;
drivers/scsi/sr.c +3 -3
@@ -420,20 +420,20 @@ queue:static int sr_block_open (struct inode *inode,struct file *file) { -struct scsi_cd *cd =scsi_cd (inode->i_bdev->bd_disk); +struct scsi_cd *cd =scsi_cd (inode->type.i_bdev->bd_disk);return cdrom_open (&cd->cdi, inode, file); }static int sr_block_release (struct inode *inode,struct file *file) { -struct scsi_cd *cd =scsi_cd (inode->i_bdev->bd_disk); +struct scsi_cd *cd =scsi_cd (inode->type.i_bdev->bd_disk);return cdrom_release (&cd->cdi, file); }static int sr_block_ioctl (struct inode *inode,struct file *file,unsigned cmd,unsigned long arg) { -struct scsi_cd *cd =scsi_cd (inode->i_bdev->bd_disk); +struct scsi_cd *cd =scsi_cd (inode->type.i_bdev->bd_disk);struct scsi_device *sdev = cd->device;/*
fs/block_dev.c +19 -19
@@ -94,10 +94,10 @@ static int blkdev_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh, int create) { - if (iblock >= max_block(inode->i_bdev)) + if (iblock >= max_block(inode->type.i_bdev)) return -EIO; - bh->b_bdev = inode->i_bdev; + bh->b_bdev = inode->type.i_bdev; bh->b_blocknr = iblock;set_buffer_mapped (bh);return 0 ;
@@ -107,10 +107,10 @@ static int blkdev_get_blocks(struct inode *inode, sector_t iblock, unsigned long max_blocks, struct buffer_head *bh, int create) { - if ((iblock + max_blocks) > max_block(inode->i_bdev)) + if ((iblock + max_blocks) > max_block(inode->type.i_bdev)) return -EIO; - bh->b_bdev = inode->i_bdev; + bh->b_bdev = inode->type.i_bdev; bh->b_blocknr = iblock; bh->b_size = max_blocks << inode->i_blkbits;set_buffer_mapped (bh);
@@ -124,7 +124,7 @@ blkdev_direct_IO(int rw, struct kiocb *istruct file *file = iocb->ki_filp;struct inode *inode = file->f_dentry->d_inode->i_mapping->host; -return blockdev_direct_IO (rw, iocb, inode, inode->i_bdev, iov, offset, +return blockdev_direct_IO (rw, iocb, inode, inode->type.i_bdev, iov, offset, nr_segs, blkdev_get_blocks); }
@@ -156,7 +156,7 @@ static int blkdev_commit_write(struct fistatic loff_t block_llseek (struct file *file,loff_t offset,int origin) {/* ewww */ -loff_t size = file->f_dentry->d_inode->i_bdev->bd_inode->i_size; +loff_t size = file->f_dentry->d_inode->type.i_bdev->bd_inode->i_size;loff_t retval;lock_kernel ();
@@ -188,7 +188,7 @@ static int block_fsync(struct file *filp {struct inode * inode = dentry->d_inode; -return sync_blockdev (inode->i_bdev); +return sync_blockdev (inode->type.i_bdev); }/*
@@ -316,7 +316,7 @@ struct block_device *bdget(dev_t dev) new_bdev->bd_invalidated =0 ; inode->i_mode =S_IFBLK ; inode->i_rdev = kdev; - inode->i_bdev = new_bdev; + inode->type.i_bdev = new_bdev; inode->i_data.a_ops = &def_blk_aops; inode->i_data.gfp_mask =GFP_USER ; inode->i_data.backing_dev_info = &default_backing_dev_info;
@@ -361,7 +361,7 @@ long nr_blockdev_pages(void)static inline void __bd_forget (struct inode *inode) {list_del_init (&inode->i_devices); - inode->i_bdev =NULL ; + inode->type.i_bdev =NULL ; inode->i_mapping = &inode->i_data; }
@@ -385,8 +385,8 @@ int bd_acquire(struct inode *inode) {struct block_device *bdev;spin_lock (&bdev_lock); -if (inode->i_bdev) { -atomic_inc (&inode->i_bdev->bd_count); +if (inode->type.i_bdev) { +atomic_inc (&inode->type.i_bdev->bd_count);spin_unlock (&bdev_lock);return 0 ; }
@@ -395,11 +395,11 @@ int bd_acquire(struct inode *inode)if (!bdev)return -ENOMEM ;spin_lock (&bdev_lock); -if (!inode->i_bdev) { - inode->i_bdev = bdev; +if (!inode->type.i_bdev) { + inode->type.i_bdev = bdev; inode->i_mapping = bdev->bd_inode->i_mapping;list_add (&inode->i_devices, &bdev->bd_inodes); - }else if (inode->i_bdev != bdev) + }else if (inode->type.i_bdev != bdev)BUG ();spin_unlock (&bdev_lock);return 0 ;
@@ -410,7 +410,7 @@ int bd_acquire(struct inode *inode)void bd_forget (struct inode *inode) {spin_lock (&bdev_lock); -if (inode->i_bdev) +if (inode->type.i_bdev)__bd_forget (inode);spin_unlock (&bdev_lock); }
@@ -691,7 +691,7 @@ int blkdev_open(struct inode * inode, st filp->f_flags |=O_LARGEFILE ;bd_acquire (inode); - bdev = inode->i_bdev; + bdev = inode->type.i_bdev;return do_open (bdev, inode, filp); }
@@ -706,7 +706,7 @@ int blkdev_put(struct block_device *bdevswitch (kind) {case BDEV_FILE :case BDEV_FS : -sync_blockdev (bd_inode->i_bdev); +sync_blockdev (bd_inode->type.i_bdev);break ; }lock_kernel ();
@@ -741,7 +741,7 @@ int blkdev_put(struct block_device *bdevint blkdev_close (struct inode * inode,struct file * filp) { -return blkdev_put (inode->i_bdev,BDEV_FILE ); +return blkdev_put (inode->type.i_bdev,BDEV_FILE ); } static ssize_t blkdev_file_write(struct file *file, const char *buf,
@@ -831,7 +831,7 @@ struct block_device *lookup_bdev(const c error =bd_acquire (inode);if (error) goto fail; - bdev = inode->i_bdev; + bdev = inode->type.i_bdev; out:path_release (&nd);
fs/ext2/xattr.c +2 -2
@@ -974,7 +974,7 @@ ext2_xattr_cache_find(struct inode *inodif (!header->h_hash)return NULL ;/* never share */ ea_idebug (inode,"looking for cached blocks [%x]" , (int )hash); - ce =mb_cache_entry_find_first (ext2_xattr_cache,0 , inode->i_bdev, hash); + ce =mb_cache_entry_find_first (ext2_xattr_cache,0 , inode->type.i_bdev, hash);while (ce) {struct buffer_head *bh =sb_bread (inode->i_sb, ce->e_block);
@@ -994,7 +994,7 @@ ext2_xattr_cache_find(struct inode *inodreturn bh; }brelse (bh); - ce =mb_cache_entry_find_next (ce,0 , inode->i_bdev, hash); + ce =mb_cache_entry_find_next (ce,0 , inode->type.i_bdev, hash); }return NULL ; }
fs/ext3/xattr.c +2 -2
@@ -1013,7 +1013,7 @@ ext3_xattr_cache_find(struct inode *inodif (!header->h_hash)return NULL ;/* never share */ ea_idebug (inode,"looking for cached blocks [%x]" , (int )hash); - ce =mb_cache_entry_find_first (ext3_xattr_cache,0 , inode->i_bdev, hash); + ce =mb_cache_entry_find_first (ext3_xattr_cache,0 , inode->type.i_bdev, hash);while (ce) {struct buffer_head *bh =sb_bread (inode->i_sb, ce->e_block);
@@ -1033,7 +1033,7 @@ ext3_xattr_cache_find(struct inode *inodreturn bh; }brelse (bh); - ce =mb_cache_entry_find_next (ce,0 , inode->i_bdev, hash); + ce =mb_cache_entry_find_next (ce,0 , inode->type.i_bdev, hash); }return NULL ; }
fs/fifo.c +3 -3
@@ -38,7 +38,7 @@ static int fifo_open(struct inode *inodeif (down_interruptible (PIPE_SEM (*inode))) goto err_nolock_nocleanup; -if (!inode->i_pipe) { +if (!inode->type.i_pipe) { ret = -ENOMEM ;if (!pipe_new (inode)) goto err_nocleanup;
@@ -133,8 +133,8 @@ err_wr: err:if (!PIPE_READERS (*inode) && !PIPE_WRITERS (*inode)) { -struct pipe_inode_info *info = inode->i_pipe; - inode->i_pipe =NULL ; +struct pipe_inode_info *info = inode->type.i_pipe; + inode->type.i_pipe =NULL ;free_page ((unsigned long )info->base);kfree (info); }
fs/inode.c +8 -8
@@ -126,9 +126,9 @@ static struct inode *alloc_inode(struct inode->i_bytes =0 ; inode->i_generation =0 ;memset (&inode->i_dquot,0 ,sizeof (inode->i_dquot)); - inode->i_pipe =NULL ; - inode->i_bdev =NULL ; - inode->i_cdev =NULL ; + inode->type.i_pipe =NULL ; + inode->type.i_bdev =NULL ; + inode->type.i_cdev =NULL ; inode->i_security =NULL ;if (security_inode_alloc (inode)) {if (inode->i_sb->s_op->destroy_inode)
@@ -239,11 +239,11 @@ void clear_inode(struct inode *inode)DQUOT_DROP (inode);if (inode->i_sb && inode->i_sb->s_op->clear_inode) inode->i_sb->s_op->clear_inode (inode); -if (inode->i_bdev) +if (inode->type.i_bdev)bd_forget (inode); -else if (inode->i_cdev) { -cdput (inode->i_cdev); - inode->i_cdev =NULL ; +else if (inode->type.i_cdev) { +cdput (inode->type.i_cdev); + inode->type.i_cdev =NULL ; } inode->i_state =I_CLEAR ; }
@@ -1292,7 +1292,7 @@ void init_special_inode(struct inode *inif (S_ISCHR (mode)) { inode->i_fop = &def_chr_fops; inode->i_rdev =to_kdev_t (rdev); - inode->i_cdev =cdget (rdev); + inode->type.i_cdev =cdget (rdev); }else if (S_ISBLK (mode)) { inode->i_fop = &def_blk_fops; inode->i_rdev =to_kdev_t (rdev);
fs/pipe.c +6 -6
@@ -270,8 +270,8 @@ pipe_release(struct inode *inode, int dePIPE_READERS (*inode) -= decr;PIPE_WRITERS (*inode) -= decw;if (!PIPE_READERS (*inode) && !PIPE_WRITERS (*inode)) { -struct pipe_inode_info *info = inode->i_pipe; - inode->i_pipe =NULL ; +struct pipe_inode_info *info = inode->type.i_pipe; + inode->type.i_pipe =NULL ;free_page ((unsigned long ) info->base);kfree (info); }else {
@@ -478,8 +478,8 @@ struct inode* pipe_new(struct inode* inoif (!page)return NULL ; - inode->i_pipe =kmalloc (sizeof (struct pipe_inode_info ),GFP_KERNEL ); -if (!inode->i_pipe) + inode->type.i_pipe =kmalloc (sizeof (struct pipe_inode_info ),GFP_KERNEL ); +if (!inode->type.i_pipe) goto fail_page;init_waitqueue_head (PIPE_WAIT (*inode));
@@ -608,8 +608,8 @@ close_f12_inode_i:put_unused_fd (i); close_f12_inode:free_page ((unsigned long )PIPE_BASE (*inode)); -kfree (inode->i_pipe); - inode->i_pipe =NULL ; +kfree (inode->type.i_pipe); + inode->type.i_pipe =NULL ;iput (inode); close_f12:put_filp (f2);
fs/reiserfs/journal.c +3 -3
@@ -1926,16 +1926,16 @@ static int journal_init_dev( struct supestruct inode *jdev_inode; jdev_inode = journal -> j_dev_file -> f_dentry -> d_inode; - journal -> j_dev_bd = jdev_inode -> i_bdev; + journal -> j_dev_bd = jdev_inode -> type.i_bdev;if ( !S_ISBLK ( jdev_inode -> i_mode ) ) {printk ("journal_init_dev: '%s' is not a block device" , jdev_name ); result = -ENOTBLK ; - }else if ( jdev_inode -> i_bdev ==NULL ) { + }else if ( jdev_inode -> type.i_bdev ==NULL ) {printk ("journal_init_dev: bdev uninitialized for '%s'" , jdev_name ); result = -ENOMEM ; }else {/* ok */ - jdev = jdev_inode -> i_bdev -> bd_dev; + jdev = jdev_inode -> type.i_bdev -> bd_dev;set_blocksize (journal->j_dev_bd, super->s_blocksize); } }else {
include/linux/pipe_fs_i.h +11 -11
@@ -21,17 +21,17 @@ struct pipe_inode_info {#define PIPE_SIZE PAGE_SIZE#define PIPE_SEM (inode) (&(inode).i_sem) -#define PIPE_WAIT (inode) (&(inode).i_pipe->wait) -#define PIPE_BASE (inode) ((inode).i_pipe->base) -#define PIPE_START (inode) ((inode).i_pipe->start) -#define PIPE_LEN (inode) ((inode).i_pipe->len) -#define PIPE_READERS (inode) ((inode).i_pipe->readers) -#define PIPE_WRITERS (inode) ((inode).i_pipe->writers) -#define PIPE_WAITING_WRITERS (inode) ((inode).i_pipe->waiting_writers) -#define PIPE_RCOUNTER (inode) ((inode).i_pipe->r_counter) -#define PIPE_WCOUNTER (inode) ((inode).i_pipe->w_counter) -#define PIPE_FASYNC_READERS (inode) (&((inode).i_pipe->fasync_readers)) -#define PIPE_FASYNC_WRITERS (inode) (&((inode).i_pipe->fasync_writers)) +#define PIPE_WAIT (inode) (&(inode).type.i_pipe->wait) +#define PIPE_BASE (inode) ((inode).type.i_pipe->base) +#define PIPE_START (inode) ((inode).type.i_pipe->start) +#define PIPE_LEN (inode) ((inode).type.i_pipe->len) +#define PIPE_READERS (inode) ((inode).type.i_pipe->readers) +#define PIPE_WRITERS (inode) ((inode).type.i_pipe->writers) +#define PIPE_WAITING_WRITERS (inode) ((inode).type.i_pipe->waiting_writers) +#define PIPE_RCOUNTER (inode) ((inode).type.i_pipe->r_counter) +#define PIPE_WCOUNTER (inode) ((inode).type.i_pipe->w_counter) +#define PIPE_FASYNC_READERS (inode) (&((inode).type.i_pipe->fasync_readers)) +#define PIPE_FASYNC_WRITERS (inode) (&((inode).type.i_pipe->fasync_writers))#define PIPE_EMPTY (inode) (PIPE_LEN(inode) == 0)#define PIPE_FULL (inode) (PIPE_LEN(inode) == PIPE_SIZE)
mm/filemap.c +1 -1
@@ -1545,7 +1545,7 @@ inline int generic_write_checks(struct iif (unlikely (*pos + *count > inode->i_sb->s_maxbytes)) *count = inode->i_sb->s_maxbytes - *pos; }else { -if (bdev_read_only (inode->i_bdev)) +if (bdev_read_only (inode->type.i_bdev))return -EPERM ;if (*pos >= inode->i_size) {if (*count || *pos > inode->i_size)
mm/swapfile.c +3 -3
@@ -1055,7 +1055,7 @@ asmlinkage long sys_swapoff(const char *vfree (swap_map);if (S_ISBLK (swap_file->f_dentry->d_inode->i_mode)) {struct block_device *bdev; - bdev = swap_file->f_dentry->d_inode->i_bdev; + bdev = swap_file->f_dentry->d_inode->type.i_bdev;set_blocksize (bdev, p->old_block_size);bd_release (bdev); }
@@ -1240,14 +1240,14 @@ asmlinkage long sys_swapon(const char * error = -EINVAL ;if (S_ISBLK (swap_file->f_dentry->d_inode->i_mode)) { - bdev = swap_file->f_dentry->d_inode->i_bdev; + bdev = swap_file->f_dentry->d_inode->type.i_bdev; error =bd_claim (bdev, sys_swapon);if (error <0 ) { bdev =NULL ; goto bad_swap; } p->old_block_size =block_size (bdev); - error =set_blocksize (swap_file->f_dentry->d_inode->i_bdev, + error =set_blocksize (swap_file->f_dentry->d_inode->type.i_bdev,PAGE_SIZE );if (error <0 ) goto bad_swap;
Quoted 14 lines · Dave Jones
Third retry, perhaps it'll make it through to the list now that vger is sending mail again...
I've been running with this patch, with no untoward consequences, seems to pass basic testing here, any objections before I push this Linuswards ? Al ? Christoph ?
include/linux/fs.h +0
-1@@ -382,12 +382,12 @@ struct inode {struct address_space *i_mapping;struct address_space i_data;struct dquot *i_dquot[MAXQUOTAS ]; -/* These three should probably be a union */
include/linux/fs.h struct inode { · line 390
Quoted 10 lines
include/linux/fs.h +5
-4struct list_head i_devices; -struct pipe_inode_info *i_pipe; -struct block_device *i_bdev; -struct char_device *i_cdev; - +union { +struct pipe_inode_info *i_pipe; +struct block_device *i_bdev; +struct char_device *i_cdev; + } type;
Not really any objection, but this is half work where more can be done. The comment is right: also i_devices can go into the union.
(And i_cdev can be deleted altogether, but that is an independent matter.)
Andries
Quoted 7 lines · Andries Brouwer
Quoted 7 lines
include/linux/fs.h +1
-5-/* These three should probably be a union */ struct list_head i_devices; -struct pipe_inode_info *i_pipe; -struct block_device *i_bdev; -struct char_device *i_cdev; - +union {
Quoted 8 lines
include/linux/fs.h struct inode { · line 390
Quoted 4 lines
include/linux/fs.h +4
-0+struct pipe_inode_info *i_pipe; +struct block_device *i_bdev; +struct char_device *i_cdev; + } type;Not really any objection, but this is half work where more can be done. The comment is right: also
i_devicescan go into the union.
The different size types threw me, and I figured it was a misplaced comment. It certainly made more sense that way when it mentioned 'these three' rather than 'these four'. looking at bd_acquire I'm not so sure it's as simple a job as the other three were.
Quoted 2 lines
(And
i_cdevcan be deleted altogether, but that is an independent matter.)
There still seems to be some users of that, so I'll leave that to a follow up patch, (or someone else who really knows whats going on there).
Dave
Quoted 3 lines · Dave Jones
There still seems to be some users of that, so I'll leave that to a follow up patch, (or someone else who really knows whats going on there).
No, there are no users yet. But as people seem to be eager to make dev_t bigger we'll need when we tackle the "CIDR" thing for character devices, too.
Quoted 8 lines · Christoph Hellwig
Quoted 3 lines · Dave Jones
There still seems to be some users of that, so I'll leave that to a follow up patch, (or someone else who really knows whats going on there).
No, there are no users yet. But as people seem to be eager to make
dev_tbigger we'll need when we tackle the "CIDR" thing for character devices, too.
No, I already wrote "CIDR" for character devices. (Will submit it when 2.5.65 appears.)
There is no use for i_cdev or struct char_device today, and I will not use it for character device registration. So unless you or someone else decides to start using it, it can just be thrown out.
Andries
[I already submitted the patch throwing it out, but someone, maybe it was Roman Zippel, complained that that was going in the wrong direction. In the very long run that may be true (or not), but for 2.6 I do not see the point of this dead code.]
Hi,
Quoted 4 lines · Andries Brouwer
[I already submitted the patch throwing it out, but someone, maybe it was Roman Zippel, complained that that was going in the wrong direction. In the very long run that may be true (or not), but for 2.6 I do not see the point of this dead code.]
My main question here is whether that code hurts in any way? Does it prevent other cleanups? Sure this code needs more work to be really useful, but as long as it only wastes a bit of space, I'd prefer to keep it.
bye, Roman
Quoted 11 lines · Roman Zippel
Quoted 4 lines · Andries Brouwer
[I already submitted the patch throwing it out, but someone, maybe it was Roman Zippel, complained that that was going in the wrong direction. In the very long run that may be true (or not), but for 2.6 I do not see the point of this dead code.]
My main question here is whether that code hurts in any way? Does it prevent other cleanups? Sure this code needs more work to be really useful, but as long as it only wastes a bit of space, I'd prefer to keep it.
Yes, dead code always hurts.
In a global change - should this dead code also be updated? To do what?
Andries
=====
if (driver->flags & TTY_DRIVER_INSTALLED)
return 0;- error = register_chrdev(driver->major, driver->name, &tty_fops);
+ error = register_chrdev_region(driver->major, driver->minor_start,
+ driver->num, driver->name, &tty_fops);
if (error < 0)
return error;
else if(driver->major == 0)=====
+int register_chrdev(unsigned int major, const char *name,
+ struct file_operations *fops)
+{
+ return register_chrdev_region(major, 0, 256, name, fops);
+}
=====
Review
Quoted 6 lines · Andries Brouwer
=====
(quoted diff) +5
-0+int register_chrdev(unsigned int major, const char *name, + struct file_operations *fops) +{ + return register_chrdev_region(major, 0, 256, name, fops); +}
That's Wrong API(tm). Why do you need to keep separation between major and first minor? Just pass dev_t start and unsigned len.
BTW, I'd like to take a look at your CIDR for chrdev - I've got one to resurrect and it might make sense to compare-and-merge. And yes, I'm finally back - hopefully for good.
Hi,
Quoted 6 lines · Andries Brouwer
Quoted 4 lines
My main question here is whether that code hurts in any way? Does it prevent other cleanups? Sure this code needs more work to be really useful, but as long as it only wastes a bit of space, I'd prefer to keep it.
Yes, dead code always hurts.
It's not really dead code, it's not yet used code and if it stays there as a reminder to actually do something about it, it's good that it hurts.
Review
Quoted 4 lines
(quoted diff) +2
-1- error = register_chrdev(driver->major, driver->name, &tty_fops); + error = register_chrdev_region(driver->major, driver->minor_start, + driver->num, driver->name, &tty_fops);
Are that much parameters really needed?
When I look through the character device list, I basically see two usages.
1. A character device is mapped to n device numbers (where n is <= 8). In this case it should be enough to register a really available character device with a single device number. More can be configured e.g. through a sysfs interface. Currently we have here misc devices users, which is running out of number space and the other users which are often wasting a complete major number for a few devices.
2. A large number of dynamic virtual devices (e.g. terminals), these want a complete major anyway and currently they have to register multiple of them.
These are the two cases a new character device core should be able to handle. On top of this we can still think about a small compatibility layer.
bye, Roman
Quoted 5 lines · Roman Zippel
Review
Quoted 3 lines
(quoted diff) +2
-1- error = register_chrdev(driver->major, driver->name, &tty_fops); + error = register_chrdev_region(driver->major, driver->minor_start, + driver->num, driver->name, &tty_fops);Are that much parameters really needed?
Yes.
If you want to follow Al you would write
MKDEV(driver->major, driver->minor_start) instead of this driver->major, driver->minor_start
and you would have one parameter less.
Andries
[I wrote Al and wanted to cc l-k but typoed. Let me copy this letter for information purposes and to show that we do not want to write MKDEV.]
-------------------------------------------------------------------------
Some more comments on types and their structure.
As you know very well, I had a setup in the ancient times with a kdev_t that was a pointer, and
#define MINOR(dev) (dev)->minor
That was nice and well - you thought that a refcount was needed, I thought that with the given rules for use it was possible to prove that no refcount was needed, and the discussion was never settled.
If we ever meet FTF we can fight that fight.
In the below I will use kdev_t again, but now with an entirely different meaning, not a pointer but an arithmetic type.
User space (programs, file systems) has many dev_t instances that must remain valid. So, when dev_t changes size the 16-bit values must keep their old major and minor. This means that for a dev_t the operations MINOR, MAJOR, MKDEV are not completely trivial. They involve tests on whether the value fits into 16 bits. E.g.
#define MKDEV(ma,mi) ((dev_t)(((((ma) & ~0xff) == 0) && (((mi) & ~0xff) == 0
)) ? (((ma) << 8) | (mi)) : (((ma) << DEV_MINOR_BITS) | (mi))))
This is fine for communication with user space, but inside the kernel itself we like something that is smaller and faster, like
#define __mkdev(major, minor) (((major) << KDEV_MINOR_BITS) + (minor))
So inside the kernel we must use kdev_t where user space uses dev_t. Now both are arithmetic, but the bits are packed differently.
Now you understand why I would like to remove the MKDEV that you have in every call of blk_register_region.
Andries
Hi,
Quoted 7 lines · Andries Brouwer
Quoted 5 lines
Review
Quoted 3 lines
(quoted diff) +2
-1- error = register_chrdev(driver->major, driver->name, &tty_fops); + error = register_chrdev_region(driver->major, driver->minor_start, + driver->num, driver->name, &tty_fops);Are that much parameters really needed?
Yes.
Why? Problems are hardly solved by adding more parameters. If going to a larger number space means, that we have to add crappy interfaces, we should rather keep it as it is.
Why do you need to partition the number space like this? I looked at the users in the last mail for a reason. If we're going to change the interface, it should reflect what we will need in the future.
bye, Roman
Quoted 8 lines · Roman Zippel
Quoted 6 lines · Andries Brouwer
Quoted 5 lines
Review
Quoted 3 lines
(quoted diff) +2
-1- error = register_chrdev(driver->major, driver->name, &tty_fops); + error = register_chrdev_region(driver->major, driver->minor_start, + driver->num, driver->name, &tty_fops);Are that much parameters really needed?
Quoted 8 lines
Quoted 1 line
Yes.
Why? Problems are hardly solved by adding more parameters. If going to a larger number space means, that we have to add crappy interfaces, we should rather keep it as it is.
Why do you need to partition the number space like this? I looked at the users in the last mail for a reason. If we're going to change the interface, it should reflect what we will need in the future.
Maybe I should not react, but let me answer once more. You do not understand the part about "small steps".
You see a future and ask why I don't jump to the future you see. The answer is that I take small steps.
Look at the current junk in char_dev.c and cry:
if (ret && isa_tty_dev(major)) {
lock_kernel();
if (need_serial(major,minor)) {
/* Force request_module anyway, but what for? */
fops_put(ret);
ret = NULL;
}
unlock_kernel();
}Then be happy that it is gone.
You want a different interface? My changes make it easier for you to get there. Please go ahead.
Andries
Hi,
Quoted 2 lines · Andries Brouwer
You see a future and ask why I don't jump to the future you see. The answer is that I take small steps.
Oh, I agree with small steps, but you should be damned careful with temporary interfaces, they have the bad habit of spreading and the more we have to cleanup later.
First we need a clean core, than we can start removing the current crap properly.
bye, Roman
Quoted 3 lines · Dave Jones
Third retry, perhaps it'll make it through to the list now that vger is sending mail again...
If you do not need gcc-2.95 support, you can use anonymous unions:
+ union {
+ struct pipe_inode_info *i_pipe;
+ struct block_device *i_bdev;
+ struct char_device *i_cdev;
+ };
so you don't even have to change the accesses. Zero cost optimization patch.
I have tested on gcc-3.0, 3.2.2, RH gcc-2.96-98, and 2.95.2. Only 2.95.2 fails.
I do not know the compiler requirements for 2.5, or if there is any agreement in kernel developement for not doing this. If this is the case, sorry for the noise.
Signature · 4 lines
J.A. Magallon <[email protected]> \ Software is like sex: werewolf.able.es \ It's better when it's free Mandrake Linux release 9.1 (Cooker) for i586 Linux 2.4.21-pre5-jam0 (gcc 3.2.2 (Mandrake Linux 9.1 3.2.2-3mdk))
Quoted 3 lines · J.A. Magallon
If you do not need gcc-2.95 support, you can use anonymous unions:
I have tested on gcc-3.0, 3.2.2, RH gcc-2.96-98, and 2.95.2. Only 2.95.2 fails.
What about the magick ancient version that sparc uses ?
Dave
Quoted 7 lines · Dave Jones
Quoted 3 lines · J.A. Magallon
If you do not need gcc-2.95 support, you can use anonymous unions:
I have tested on gcc-3.0, 3.2.2, RH gcc-2.96-98, and 2.95.2. Only 2.95.2 fails.What about the magick ancient version that sparc uses
That was my point, I do not know if some arch still requires 2.95 in 2.6. For 2.4, it states 2.95.3 as minimun.
There is not anything newer for sparc ? Curious...
Signature · 4 lines
J.A. Magallon <[email protected]> \ Software is like sex: werewolf.able.es \ It's better when it's free Mandrake Linux release 9.1 (Cooker) for i586 Linux 2.4.21-pre5-jam0 (gcc 3.2.2 (Mandrake Linux 9.1 3.2.2-3mdk))
Quoted 2 lines · J.A. Magallon
That was my point, I do not know if some arch still requires 2.95 in 2.6. For 2.4, it states 2.95.3 as minimun.
Even if no arch `requires' gcc 2.95 (I don't really know, though until recently my arch didn't even _have_ a [working] gcc 3.x port!), there are certainly a buttload of people _using_ it to build the kernel, so requiring gcc 3.2, would be kind of obnoxious.
-Miles
Signature · 2 lines
Come now, if we were really planning to harm you, would we be waiting here, beside the path, in the very darkest part of the forest?