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

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

 - switch block_size() to struct block_device *.
parent aacb4fe3
...@@ -304,7 +304,7 @@ int blk_ioctl(struct block_device *bdev, unsigned int cmd, unsigned long arg) ...@@ -304,7 +304,7 @@ int blk_ioctl(struct block_device *bdev, unsigned int cmd, unsigned long arg)
case BLKBSZGET: case BLKBSZGET:
/* get the logical block size (cf. BLKSSZGET) */ /* get the logical block size (cf. BLKSSZGET) */
intval = block_size(dev); intval = block_size(bdev);
return put_user(intval, (int *) arg); return put_user(intval, (int *) arg);
case BLKBSZSET: case BLKBSZSET:
......
...@@ -284,7 +284,7 @@ static int lo_receive(struct loop_device *lo, struct bio *bio, int bsize, loff_t ...@@ -284,7 +284,7 @@ static int lo_receive(struct loop_device *lo, struct bio *bio, int bsize, loff_t
static inline int loop_get_bs(struct loop_device *lo) static inline int loop_get_bs(struct loop_device *lo)
{ {
return block_size(to_kdev_t(lo->lo_device->bd_dev)); return block_size(lo->lo_device);
} }
static inline unsigned long loop_get_iv(struct loop_device *lo, static inline unsigned long loop_get_iv(struct loop_device *lo,
...@@ -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(bdev, block_size(to_kdev_t(lo_device->bd_dev))); set_blocksize(bdev, block_size(lo_device));
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);
......
...@@ -1137,7 +1137,7 @@ static int __init init_blkmtd(void) ...@@ -1137,7 +1137,7 @@ static int __init init_blkmtd(void)
DEBUG(1, "blkmtd: devname = %s\n", bdevname(bdev)); DEBUG(1, "blkmtd: devname = %s\n", bdevname(bdev));
blocksize = BLOCK_SIZE; blocksize = BLOCK_SIZE;
blocksize = bs ? bs : block_size(rdev); blocksize = bs ? bs : block_size(bdev);
i = blocksize; i = blocksize;
blocksize_bits = 0; blocksize_bits = 0;
while(i != 1) { while(i != 1) {
......
...@@ -1344,11 +1344,13 @@ ccw_req_t * tape34xx_bread (struct request *req,tape_info_t* ti,int tapeblock_ma ...@@ -1344,11 +1344,13 @@ ccw_req_t * tape34xx_bread (struct request *req,tape_info_t* ti,int tapeblock_ma
ccw1_t *ccw; ccw1_t *ccw;
__u8 *data; __u8 *data;
kdev_t dev = mk_kdev(tapeblock_major, ti->blk_minor); kdev_t dev = mk_kdev(tapeblock_major, ti->blk_minor);
unsigned bsize = block_size(dev); struct block_device *bdev = bdget(kdev_t_to_nr(dev));
unsigned bsize = block_size(bdev);
int s2b = bsize/queue_hardsect_size(&ti->request_queue); int s2b = bsize/queue_hardsect_size(&ti->request_queue);
int realcount; int realcount;
int size,bhct = 0; int size,bhct = 0;
struct buffer_head* bh; struct buffer_head* bh;
bdput(bdev);
for (bh = req->bh; bh; bh = bh->b_reqnext) { for (bh = req->bh; bh; bh = bh->b_reqnext) {
if (bh->b_size > bsize) if (bh->b_size > bsize)
for (size = 0; size < bh->b_size; size += bsize) for (size = 0; size < bh->b_size; size += bsize)
......
...@@ -41,7 +41,7 @@ unsigned char *scsi_bios_ptable(kdev_t dev) ...@@ -41,7 +41,7 @@ unsigned char *scsi_bios_ptable(kdev_t dev)
err = blkdev_get(bdev, FMODE_READ, 0, BDEV_FILE); err = blkdev_get(bdev, FMODE_READ, 0, BDEV_FILE);
if (err) if (err)
goto fail; goto fail;
bh = __bread(bdev, 0, block_size(rdev)); bh = __bread(bdev, 0, block_size(bdev));
if (!bh) if (!bh)
goto fail2; goto fail2;
memcpy(res, bh->b_data + 0x1be, 66); memcpy(res, bh->b_data + 0x1be, 66);
......
...@@ -25,13 +25,13 @@ ...@@ -25,13 +25,13 @@
#define MAX_BUF_PER_PAGE (PAGE_CACHE_SIZE / 512) #define MAX_BUF_PER_PAGE (PAGE_CACHE_SIZE / 512)
static unsigned long max_block(kdev_t dev) static unsigned long max_block(struct block_device *bdev)
{ {
unsigned int retval = ~0U; unsigned int retval = ~0U;
loff_t sz = blkdev_size_in_bytes(dev); loff_t sz = bdev->bd_inode->i_size;
if (sz) { if (sz) {
unsigned int size = block_size(dev); unsigned int size = block_size(bdev);
unsigned int sizebits = blksize_bits(size); unsigned int sizebits = blksize_bits(size);
retval = (sz >> sizebits); retval = (sz >> sizebits);
} }
...@@ -112,7 +112,7 @@ int sb_min_blocksize(struct super_block *sb, int size) ...@@ -112,7 +112,7 @@ int sb_min_blocksize(struct super_block *sb, int size)
static int blkdev_get_block(struct inode * inode, sector_t iblock, struct buffer_head * bh, int create) static int blkdev_get_block(struct inode * inode, sector_t iblock, struct buffer_head * bh, int create)
{ {
if (iblock >= max_block(inode->i_rdev)) if (iblock >= max_block(inode->i_bdev))
return -EIO; return -EIO;
bh->b_bdev = inode->i_bdev; bh->b_bdev = inode->i_bdev;
...@@ -617,7 +617,7 @@ static int do_open(struct block_device *bdev, struct inode *inode, struct file * ...@@ -617,7 +617,7 @@ static int do_open(struct block_device *bdev, struct inode *inode, struct file *
} }
bdev->bd_openers++; bdev->bd_openers++;
bdev->bd_inode->i_size = blkdev_size(dev); bdev->bd_inode->i_size = blkdev_size(dev);
bdev->bd_inode->i_blkbits = blksize_bits(block_size(dev)); bdev->bd_inode->i_blkbits = blksize_bits(block_size(bdev));
unlock_kernel(); unlock_kernel();
up(&bdev->bd_sem); up(&bdev->bd_sem);
return 0; return 0;
......
...@@ -253,7 +253,7 @@ static void check_partition(struct gendisk *hd, kdev_t dev, int first_part_minor ...@@ -253,7 +253,7 @@ static void check_partition(struct gendisk *hd, kdev_t dev, int first_part_minor
bdev = bdget(kdev_t_to_nr(dev)); bdev = bdget(kdev_t_to_nr(dev));
bdev->bd_contains = bdev; bdev->bd_contains = bdev;
bdev->bd_inode->i_size = (loff_t)hd->part[minor(dev)].nr_sects << 9; bdev->bd_inode->i_size = (loff_t)hd->part[minor(dev)].nr_sects << 9;
bdev->bd_inode->i_blkbits = blksize_bits(block_size(dev)); bdev->bd_inode->i_blkbits = blksize_bits(block_size(bdev));
for (i = 0; check_part[i]; i++) { for (i = 0; check_part[i]; i++) {
int res; int res;
res = check_part[i](hd, bdev, first_sector, first_part_minor); res = check_part[i](hd, bdev, first_sector, first_part_minor);
......
...@@ -713,9 +713,8 @@ efi_partition(struct gendisk *hd, struct block_device *bdev, ...@@ -713,9 +713,8 @@ efi_partition(struct gendisk *hd, struct block_device *bdev,
unsigned long first_sector, int first_part_minor) unsigned long first_sector, int first_part_minor)
{ {
kdev_t dev = to_kdev_t(bdev->bd_dev);
int hardblocksize = bdev_hardsect_size(bdev); int hardblocksize = bdev_hardsect_size(bdev);
int orig_blksize_size = block_size(dev); int orig_blksize_size = block_size(bdev);
int rc = 0; int rc = 0;
/* Need to change the block size that the block layer uses */ /* Need to change the block size that the block layer uses */
......
...@@ -516,7 +516,7 @@ struct super_block *get_sb_bdev(struct file_system_type *fs_type, ...@@ -516,7 +516,7 @@ struct super_block *get_sb_bdev(struct file_system_type *fs_type,
} else { } else {
s->s_flags = flags; s->s_flags = flags;
strncpy(s->s_id, bdevname(bdev), sizeof(s->s_id)); strncpy(s->s_id, bdevname(bdev), sizeof(s->s_id));
s->s_old_blocksize = block_size(dev); s->s_old_blocksize = block_size(bdev);
sb_set_blocksize(s, s->s_old_blocksize); sb_set_blocksize(s, s->s_old_blocksize);
error = fill_super(s, data, flags & MS_VERBOSE ? 1 : 0); error = fill_super(s, data, flags & MS_VERBOSE ? 1 : 0);
if (error) { if (error) {
......
...@@ -372,9 +372,10 @@ extern inline unsigned int blksize_bits(unsigned int size) ...@@ -372,9 +372,10 @@ extern inline unsigned int blksize_bits(unsigned int size)
return bits; return bits;
} }
extern inline unsigned int block_size(kdev_t dev) extern inline unsigned int block_size(struct block_device *bdev)
{ {
int retval = BLOCK_SIZE; int retval = BLOCK_SIZE;
kdev_t dev = to_kdev_t(bdev->bd_dev);
int major = major(dev); int major = major(dev);
if (blksize_size[major]) { if (blksize_size[major]) {
......
...@@ -920,7 +920,7 @@ asmlinkage long sys_swapon(const char * specialfile, int swap_flags) ...@@ -920,7 +920,7 @@ asmlinkage long sys_swapon(const char * specialfile, int swap_flags)
bdev = NULL; bdev = NULL;
goto bad_swap; goto bad_swap;
} }
p->old_block_size = block_size(to_kdev_t(bdev->bd_dev)); 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->i_bdev,
PAGE_SIZE); PAGE_SIZE);
if (error < 0) if (error < 0)
......
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