Commit 56b26add02b4bdea81d5e0ebda60db1fe3311ad4
Committed by
Al Viro
1 parent
6af3a56e1d
Exists in
master
and in
4 other branches
[PATCH] kill the rest of struct file propagation in block ioctls
Now we can switch blkdev_ioctl() block_device/mode Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Showing 5 changed files with 14 additions and 17 deletions Side-by-side Diff
block/compat_ioctl.c
... | ... | @@ -177,7 +177,7 @@ |
177 | 177 | compat_caddr_t data; |
178 | 178 | }; |
179 | 179 | |
180 | -static int compat_blkpg_ioctl(struct inode *inode, struct file *file, | |
180 | +static int compat_blkpg_ioctl(struct block_device *bdev, fmode_t mode, | |
181 | 181 | unsigned int cmd, struct compat_blkpg_ioctl_arg __user *ua32) |
182 | 182 | { |
183 | 183 | struct blkpg_ioctl_arg __user *a = compat_alloc_user_space(sizeof(*a)); |
... | ... | @@ -196,7 +196,7 @@ |
196 | 196 | if (err) |
197 | 197 | return err; |
198 | 198 | |
199 | - return blkdev_ioctl(inode, file, cmd, (unsigned long)a); | |
199 | + return blkdev_ioctl(bdev, mode, cmd, (unsigned long)a); | |
200 | 200 | } |
201 | 201 | |
202 | 202 | #define BLKBSZGET_32 _IOR(0x12, 112, int) |
203 | 203 | |
204 | 204 | |
... | ... | @@ -715,13 +715,13 @@ |
715 | 715 | * but we call blkdev_ioctl, which gets the lock for us |
716 | 716 | */ |
717 | 717 | case BLKRRPART: |
718 | - return blkdev_ioctl(inode, file, cmd, | |
718 | + return blkdev_ioctl(bdev, mode, cmd, | |
719 | 719 | (unsigned long)compat_ptr(arg)); |
720 | 720 | case BLKBSZSET_32: |
721 | - return blkdev_ioctl(inode, file, BLKBSZSET, | |
721 | + return blkdev_ioctl(bdev, mode, BLKBSZSET, | |
722 | 722 | (unsigned long)compat_ptr(arg)); |
723 | 723 | case BLKPG: |
724 | - return compat_blkpg_ioctl(inode, file, cmd, compat_ptr(arg)); | |
724 | + return compat_blkpg_ioctl(bdev, mode, cmd, compat_ptr(arg)); | |
725 | 725 | case BLKRAGET: |
726 | 726 | case BLKFRAGET: |
727 | 727 | if (!arg) |
block/ioctl.c
... | ... | @@ -230,20 +230,13 @@ |
230 | 230 | * always keep this in sync with compat_blkdev_ioctl() and |
231 | 231 | * compat_blkdev_locked_ioctl() |
232 | 232 | */ |
233 | -int blkdev_ioctl(struct inode *inode, struct file *file, unsigned cmd, | |
233 | +int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd, | |
234 | 234 | unsigned long arg) |
235 | 235 | { |
236 | - struct block_device *bdev = inode->i_bdev; | |
237 | 236 | struct gendisk *disk = bdev->bd_disk; |
238 | 237 | struct backing_dev_info *bdi; |
239 | 238 | loff_t size; |
240 | 239 | int ret, n; |
241 | - fmode_t mode = 0; | |
242 | - if (file) { | |
243 | - mode = file->f_mode; | |
244 | - if (file->f_flags & O_NDELAY) | |
245 | - mode |= FMODE_NDELAY_NOW; | |
246 | - } | |
247 | 240 | |
248 | 241 | switch(cmd) { |
249 | 242 | case BLKFLSBUF: |
drivers/char/raw.c
fs/block_dev.c
... | ... | @@ -1202,7 +1202,11 @@ |
1202 | 1202 | |
1203 | 1203 | static long block_ioctl(struct file *file, unsigned cmd, unsigned long arg) |
1204 | 1204 | { |
1205 | - return blkdev_ioctl(file->f_mapping->host, file, cmd, arg); | |
1205 | + struct block_device *bdev = I_BDEV(file->f_mapping->host); | |
1206 | + fmode_t mode = file->f_mode; | |
1207 | + if (file->f_flags & O_NDELAY) | |
1208 | + mode |= FMODE_NDELAY_NOW; | |
1209 | + return blkdev_ioctl(bdev, mode, cmd, arg); | |
1206 | 1210 | } |
1207 | 1211 | |
1208 | 1212 | static const struct address_space_operations def_blk_aops = { |
... | ... | @@ -1238,7 +1242,7 @@ |
1238 | 1242 | int res; |
1239 | 1243 | mm_segment_t old_fs = get_fs(); |
1240 | 1244 | set_fs(KERNEL_DS); |
1241 | - res = blkdev_ioctl(bdev->bd_inode, NULL, cmd, arg); | |
1245 | + res = blkdev_ioctl(bdev, 0, cmd, arg); | |
1242 | 1246 | set_fs(old_fs); |
1243 | 1247 | return res; |
1244 | 1248 | } |
include/linux/fs.h
... | ... | @@ -1717,7 +1717,7 @@ |
1717 | 1717 | extern const struct file_operations def_fifo_fops; |
1718 | 1718 | #ifdef CONFIG_BLOCK |
1719 | 1719 | extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long); |
1720 | -extern int blkdev_ioctl(struct inode *, struct file *, unsigned, unsigned long); | |
1720 | +extern int blkdev_ioctl(struct block_device *, fmode_t, unsigned, unsigned long); | |
1721 | 1721 | extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long); |
1722 | 1722 | extern int blkdev_get(struct block_device *, fmode_t); |
1723 | 1723 | extern int blkdev_put(struct block_device *, fmode_t); |