Commit aacb4fe3 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] (2/6) blksize_size[] removal

 - switch set_blocksize() to struct block_device *.
parent afe7e3a9
...@@ -320,7 +320,7 @@ int blk_ioctl(struct block_device *bdev, unsigned int cmd, unsigned long arg) ...@@ -320,7 +320,7 @@ int blk_ioctl(struct block_device *bdev, unsigned int cmd, unsigned long arg)
return -EINVAL; return -EINVAL;
if (bd_claim(bdev, &holder) < 0) if (bd_claim(bdev, &holder) < 0)
return -EBUSY; return -EBUSY;
set_blocksize(dev, intval); set_blocksize(bdev, intval);
bd_release(bdev); bd_release(bdev);
return 0; return 0;
......
...@@ -649,7 +649,7 @@ static int loop_set_fd(struct loop_device *lo, struct file *lo_file, ...@@ -649,7 +649,7 @@ static int loop_set_fd(struct loop_device *lo, struct file *lo_file,
lo->old_gfp_mask = inode->i_mapping->gfp_mask; lo->old_gfp_mask = inode->i_mapping->gfp_mask;
inode->i_mapping->gfp_mask = GFP_NOIO; inode->i_mapping->gfp_mask = GFP_NOIO;
set_blocksize(dev, block_size(to_kdev_t(lo_device->bd_dev))); set_blocksize(bdev, block_size(to_kdev_t(lo_device->bd_dev)));
lo->lo_bio = lo->lo_biotail = NULL; lo->lo_bio = lo->lo_biotail = NULL;
kernel_thread(loop_thread, lo, CLONE_FS | CLONE_FILES | CLONE_SIGHAND); kernel_thread(loop_thread, lo, CLONE_FS | CLONE_FILES | CLONE_SIGHAND);
......
...@@ -2677,7 +2677,6 @@ int ide_cdrom_setup(ide_drive_t *drive) ...@@ -2677,7 +2677,6 @@ int ide_cdrom_setup(ide_drive_t *drive)
* default to read-only always and fix latter at the bottom * default to read-only always and fix latter at the bottom
*/ */
set_device_ro(mk_kdev(drive->channel->major, minor), 1); set_device_ro(mk_kdev(drive->channel->major, minor), 1);
set_blocksize(mk_kdev(drive->channel->major, minor), CD_FRAMESIZE);
blk_queue_hardsect_size(&drive->queue, CD_FRAMESIZE); blk_queue_hardsect_size(&drive->queue, CD_FRAMESIZE);
blk_queue_prep_rq(&drive->queue, ll_10byte_cmd_build); blk_queue_prep_rq(&drive->queue, ll_10byte_cmd_build);
...@@ -2861,13 +2860,7 @@ void ide_cdrom_revalidate (ide_drive_t *drive) ...@@ -2861,13 +2860,7 @@ void ide_cdrom_revalidate (ide_drive_t *drive)
/* for general /dev/cdrom like mounting, one big disc */ /* for general /dev/cdrom like mounting, one big disc */
drive->part[0].nr_sects = toc->capacity * SECTORS_PER_FRAME; drive->part[0].nr_sects = toc->capacity * SECTORS_PER_FRAME;
drive->channel->gd->sizes[minor] = toc->capacity * BLOCKS_PER_FRAME; drive->channel->gd->sizes[minor] = toc->capacity * BLOCKS_PER_FRAME;
/*
* reset block size, ide_revalidate_disk incorrectly sets it to
* 1024 even for CDROM's
*/
blk_size[drive->channel->major] = drive->channel->gd->sizes; blk_size[drive->channel->major] = drive->channel->gd->sizes;
set_blocksize(mk_kdev(drive->channel->major, minor), CD_FRAMESIZE);
} }
static sector_t ide_cdrom_capacity(struct ata_device *drive) static sector_t ide_cdrom_capacity(struct ata_device *drive)
......
...@@ -53,10 +53,10 @@ static void kill_bdev(struct block_device *bdev) ...@@ -53,10 +53,10 @@ static void kill_bdev(struct block_device *bdev)
truncate_inode_pages(bdev->bd_inode->i_mapping, 0); truncate_inode_pages(bdev->bd_inode->i_mapping, 0);
} }
int set_blocksize(kdev_t dev, int size) int set_blocksize(struct block_device *bdev, int size)
{ {
int oldsize; int oldsize;
struct block_device *bdev; kdev_t dev = to_kdev_t(bdev->bd_dev);
/* Size must be a power of two, and between 512 and PAGE_SIZE */ /* Size must be a power of two, and between 512 and PAGE_SIZE */
if (size > PAGE_SIZE || size < 512 || (size & (size-1))) if (size > PAGE_SIZE || size < 512 || (size & (size-1)))
...@@ -83,19 +83,17 @@ int set_blocksize(kdev_t dev, int size) ...@@ -83,19 +83,17 @@ int set_blocksize(kdev_t dev, int size)
} }
/* Ok, we're actually changing the blocksize.. */ /* Ok, we're actually changing the blocksize.. */
bdev = bdget(kdev_t_to_nr(dev));
sync_blockdev(bdev); sync_blockdev(bdev);
blksize_size[major(dev)][minor(dev)] = size; blksize_size[major(dev)][minor(dev)] = size;
bdev->bd_inode->i_blkbits = blksize_bits(size); bdev->bd_inode->i_blkbits = blksize_bits(size);
kill_bdev(bdev); kill_bdev(bdev);
bdput(bdev);
return 0; return 0;
} }
int sb_set_blocksize(struct super_block *sb, int size) int sb_set_blocksize(struct super_block *sb, int size)
{ {
int bits; int bits;
if (set_blocksize(sb->s_dev, size) < 0) if (set_blocksize(sb->s_bdev, size) < 0)
return 0; return 0;
sb->s_blocksize = size; sb->s_blocksize = size;
for (bits = 9, size >>= 9; size >>= 1; bits++) for (bits = 9, size >>= 9; size >>= 1; bits++)
......
...@@ -1330,7 +1330,7 @@ static journal_t *ext3_get_dev_journal(struct super_block *sb, ...@@ -1330,7 +1330,7 @@ static journal_t *ext3_get_dev_journal(struct super_block *sb,
sb_block = EXT3_MIN_BLOCK_SIZE / blocksize; sb_block = EXT3_MIN_BLOCK_SIZE / blocksize;
offset = EXT3_MIN_BLOCK_SIZE % blocksize; offset = EXT3_MIN_BLOCK_SIZE % blocksize;
set_blocksize(j_dev, blocksize); set_blocksize(bdev, blocksize);
if (!(bh = __bread(bdev, sb_block, blocksize))) { if (!(bh = __bread(bdev, sb_block, blocksize))) {
printk(KERN_ERR "EXT3-fs: couldn't read superblock of " printk(KERN_ERR "EXT3-fs: couldn't read superblock of "
"external journal\n"); "external journal\n");
......
...@@ -721,13 +721,13 @@ efi_partition(struct gendisk *hd, struct block_device *bdev, ...@@ -721,13 +721,13 @@ efi_partition(struct gendisk *hd, struct block_device *bdev,
/* Need to change the block size that the block layer uses */ /* Need to change the block size that the block layer uses */
if (orig_blksize_size != hardblocksize) if (orig_blksize_size != hardblocksize)
set_blocksize(dev, hardblocksize); set_blocksize(bdev, hardblocksize);
rc = add_gpt_partitions(hd, bdev, first_part_minor); rc = add_gpt_partitions(hd, bdev, first_part_minor);
/* change back */ /* change back */
if (orig_blksize_size != hardblocksize) if (orig_blksize_size != hardblocksize)
set_blocksize(dev, orig_blksize_size); set_blocksize(bdev, orig_blksize_size);
return rc; return rc;
} }
......
...@@ -540,7 +540,7 @@ void kill_block_super(struct super_block *sb) ...@@ -540,7 +540,7 @@ void kill_block_super(struct super_block *sb)
{ {
struct block_device *bdev = sb->s_bdev; struct block_device *bdev = sb->s_bdev;
generic_shutdown_super(sb); generic_shutdown_super(sb);
set_blocksize(to_kdev_t(bdev->bd_dev), sb->s_old_blocksize); set_blocksize(bdev, sb->s_old_blocksize);
bd_release(bdev); bd_release(bdev);
blkdev_put(bdev, BDEV_FS); blkdev_put(bdev, BDEV_FS);
} }
......
...@@ -1259,7 +1259,7 @@ extern int submit_bh(int, struct buffer_head *); ...@@ -1259,7 +1259,7 @@ extern int submit_bh(int, struct buffer_head *);
struct bio; struct bio;
extern int submit_bio(int, struct bio *); extern int submit_bio(int, struct bio *);
extern int is_read_only(kdev_t); extern int is_read_only(kdev_t);
extern int set_blocksize(kdev_t, int); extern int set_blocksize(struct block_device *, int);
extern int sb_set_blocksize(struct super_block *, int); extern int sb_set_blocksize(struct super_block *, int);
extern int sb_min_blocksize(struct super_block *, int); extern int sb_min_blocksize(struct super_block *, int);
......
...@@ -791,7 +791,7 @@ asmlinkage long sys_swapoff(const char * specialfile) ...@@ -791,7 +791,7 @@ asmlinkage long sys_swapoff(const char * specialfile)
if (S_ISBLK(swap_file->f_dentry->d_inode->i_mode)) { if (S_ISBLK(swap_file->f_dentry->d_inode->i_mode)) {
struct block_device *bdev; struct block_device *bdev;
bdev = swap_file->f_dentry->d_inode->i_bdev; bdev = swap_file->f_dentry->d_inode->i_bdev;
set_blocksize(to_kdev_t(bdev->bd_dev), p->old_block_size); set_blocksize(bdev, p->old_block_size);
bd_release(bdev); bd_release(bdev);
} }
filp_close(swap_file, NULL); filp_close(swap_file, NULL);
...@@ -921,7 +921,7 @@ asmlinkage long sys_swapon(const char * specialfile, int swap_flags) ...@@ -921,7 +921,7 @@ asmlinkage long sys_swapon(const char * specialfile, int swap_flags)
goto bad_swap; goto bad_swap;
} }
p->old_block_size = block_size(to_kdev_t(bdev->bd_dev)); p->old_block_size = block_size(to_kdev_t(bdev->bd_dev));
error = set_blocksize(swap_file->f_dentry->d_inode->i_rdev, error = set_blocksize(swap_file->f_dentry->d_inode->i_bdev,
PAGE_SIZE); PAGE_SIZE);
if (error < 0) if (error < 0)
goto bad_swap; goto bad_swap;
...@@ -1074,7 +1074,7 @@ asmlinkage long sys_swapon(const char * specialfile, int swap_flags) ...@@ -1074,7 +1074,7 @@ asmlinkage long sys_swapon(const char * specialfile, int swap_flags)
goto out; goto out;
bad_swap: bad_swap:
if (bdev) { if (bdev) {
set_blocksize(to_kdev_t(bdev->bd_dev), p->old_block_size); set_blocksize(bdev, p->old_block_size);
bd_release(bdev); bd_release(bdev);
} }
bad_swap_2: bad_swap_2:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment