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

[PATCH] (14/15) big struct block_device * push (first series)

 - bdevname() switched to struct block_device *.  Old variant (taking
   kdev_t) renamed to __bdevname() (very few callers remain).  This
   allow to drop ->b_dev conveniently - it's duplicated by ->b_bdev
   and most of remaining users were bdevname(bh->b_dev) in various
   places.
parent 90012e6e
No related merge requests found
......@@ -1499,7 +1499,7 @@ void ll_rw_block(int rw, int nr, struct buffer_head * bhs[])
if (!nr)
return;
major = major(bhs[0]->b_dev);
major = major(to_kdev_t(bhs[0]->b_bdev->bd_dev));
/* Determine correct block size for this device. */
correct_size = bdev_hardsect_size(bhs[0]->b_bdev);
......@@ -1510,15 +1510,15 @@ void ll_rw_block(int rw, int nr, struct buffer_head * bhs[])
if (bh->b_size & (correct_size - 1)) {
printk(KERN_NOTICE "ll_rw_block: device %s: "
"only %d-char blocks implemented (%u)\n",
kdevname(bhs[0]->b_dev),
bdevname(bhs[0]->b_bdev),
correct_size, bh->b_size);
goto sorry;
}
}
if ((rw & WRITE) && is_read_only(bhs[0]->b_dev)) {
if ((rw & WRITE) && is_read_only(to_kdev_t(bhs[0]->b_bdev->bd_dev))) {
printk(KERN_NOTICE "Can't write to read-only device %s\n",
kdevname(bhs[0]->b_dev));
bdevname(bhs[0]->b_bdev));
goto sorry;
}
......
......@@ -165,17 +165,15 @@ static int blkmtd_readpage(mtd_raw_dev_data_t *rawdevice, struct page *page)
int err;
int sectornr, sectors, i;
struct kiobuf *iobuf;
kdev_t dev;
unsigned long *blocks;
if(!rawdevice) {
printk("blkmtd: readpage: PANIC file->private_data == NULL\n");
return -EIO;
}
dev = to_kdev_t(rawdevice->binding->bd_dev);
DEBUG(2, "blkmtd: readpage called, dev = `%s' page = %p index = %ld\n",
bdevname(dev), page, page->index);
bdevname(rawdevice->binding), page, page->index);
if(Page_Uptodate(page)) {
DEBUG(2, "blkmtd: readpage page %ld is already upto date\n", page->index);
......@@ -356,7 +354,6 @@ static int write_queue_task(void *data)
int sectornr = item->pagenr << (PAGE_SHIFT - item->rawdevice->sector_bits);
int sectorcnt = item->pagecnt << (PAGE_SHIFT - item->rawdevice->sector_bits);
int max_sectors = KIO_MAX_SECTORS >> (item->rawdevice->sector_bits - 9);
kdev_t dev = to_kdev_t(item->rawdevice->binding->bd_dev);
/* If we are writing to the last page on the device and it doesnt end
* on a page boundary, subtract the number of sectors that dont exist.
......@@ -546,7 +543,7 @@ static int blkmtd_erase(struct mtd_info *mtd, struct erase_info *instr)
/* check erase region has valid start and length */
DEBUG(2, "blkmtd: erase: dev = `%s' from = 0x%x len = 0x%lx\n",
bdevname(rawdevice->binding->bd_dev), from, len);
bdevname(rawdevice->binding), from, len);
while(numregions) {
DEBUG(3, "blkmtd: checking erase region = 0x%08X size = 0x%X num = 0x%x\n",
einfo->offset, einfo->erasesize, einfo->numblocks);
......@@ -648,7 +645,7 @@ static int blkmtd_read(struct mtd_info *mtd, loff_t from, size_t len,
*retlen = 0;
DEBUG(2, "blkmtd: read: dev = `%s' from = %ld len = %d buf = %p\n",
bdevname(rawdevice->binding->bd_dev), (long int)from, len, buf);
bdevname(rawdevice->binding), (long int)from, len, buf);
pagenr = from >> PAGE_SHIFT;
offset = from - (pagenr << PAGE_SHIFT);
......@@ -718,7 +715,7 @@ static int blkmtd_write(struct mtd_info *mtd, loff_t to, size_t len,
*retlen = 0;
DEBUG(2, "blkmtd: write: dev = `%s' to = %ld len = %d buf = %p\n",
bdevname(rawdevice->binding->bd_dev), (long int)to, len, buf);
bdevname(rawdevice->binding), (long int)to, len, buf);
/* handle readonly and out of range numbers */
......@@ -1131,7 +1128,7 @@ static int __init init_blkmtd(void)
return 1;
}
DEBUG(1, "blkmtd: devname = %s\n", bdevname(rdev));
DEBUG(1, "blkmtd: devname = %s\n", __bdevname(rdev));
blocksize = BLOCK_SIZE;
blocksize = bs ? bs : block_size(rdev);
......
......@@ -117,7 +117,6 @@ static int blkdev_get_block(struct inode * inode, sector_t iblock, struct buffer
if (iblock >= max_block(inode->i_rdev))
return -EIO;
bh->b_dev = inode->i_rdev;
bh->b_bdev = inode->i_bdev;
bh->b_blocknr = iblock;
bh->b_state |= 1UL << BH_Mapped;
......@@ -564,7 +563,7 @@ int check_disk_change(kdev_t dev)
return 0;
printk(KERN_DEBUG "VFS: Disk change detected on device %s\n",
bdevname(dev));
__bdevname(dev));
if (invalidate_device(dev, 0))
printk("VFS: busy inodes on changed media.\n");
......@@ -768,7 +767,7 @@ struct file_operations def_blk_fops = {
ioctl: blkdev_ioctl,
};
const char * bdevname(kdev_t dev)
const char *__bdevname(kdev_t dev)
{
static char buffer[32];
const char * name = blkdevs[major(dev)].name;
......
......@@ -507,7 +507,7 @@ asmlinkage long sys_fdatasync(unsigned int fd)
static inline void __insert_into_hash_list(struct buffer_head *bh)
{
struct buffer_head **head = &hash(bh->b_dev, bh->b_blocknr);
struct buffer_head **head = &hash(to_kdev_t(bh->b_bdev->bd_dev), bh->b_blocknr);
struct buffer_head *next = *head;
*head = bh;
......@@ -1142,7 +1142,6 @@ static void __put_unused_buffer_head(struct buffer_head * bh)
if (nr_unused_buffer_heads >= MAX_UNUSED_BUFFERS) {
kmem_cache_free(bh_cachep, bh);
} else {
bh->b_dev = B_FREE;
bh->b_bdev = NULL;
bh->b_blocknr = -1;
bh->b_this_page = NULL;
......@@ -1246,7 +1245,6 @@ static struct buffer_head * create_buffers(struct page * page, unsigned long siz
if (!bh)
goto no_grow;
bh->b_dev = NODEV;
bh->b_bdev = NULL;
bh->b_this_page = head;
head = bh;
......@@ -2092,7 +2090,6 @@ int generic_direct_IO(int rw, struct inode * inode, struct kiobuf * iobuf, unsig
struct buffer_head bh;
bh.b_state = 0;
bh.b_dev = inode->i_dev;
bh.b_size = blocksize;
retval = get_block(inode, blocknr, &bh, rw & 1);
......@@ -2210,7 +2207,6 @@ int brw_page(int rw, struct page *page, struct block_device *bdev, sector_t b[],
lock_buffer(bh);
bh->b_blocknr = *(b++);
bh->b_bdev = bdev;
bh->b_dev = to_kdev_t(bdev->bd_dev);
set_bit(BH_Mapped, &bh->b_state);
set_buffer_async_io(bh);
bh = bh->b_this_page;
......@@ -2325,7 +2321,6 @@ static void hash_page_buffers(struct page *page, struct block_device *bdev, int
if (!(bh->b_state & (1 << BH_Mapped))) {
init_buffer(bh, NULL, NULL);
bh->b_bdev = bdev;
bh->b_dev = to_kdev_t(bdev->bd_dev);
bh->b_blocknr = block;
bh->b_state = uptodate;
}
......@@ -2462,9 +2457,6 @@ int try_to_free_buffers(struct page * page, unsigned int gfp_mask)
do {
struct buffer_head * p = tmp;
tmp = tmp->b_this_page;
if (kdev_same(p->b_dev, B_FREE)) BUG();
remove_inode_queue(p);
__remove_from_queues(p);
__put_unused_buffer_head(p);
......
......@@ -58,7 +58,7 @@ static void make_rdonly(struct block_device *bdev, int *no_write)
{
if (bdev) {
printk(KERN_WARNING "Turning device %s read-only\n",
bdevname(to_kdev_t(bdev->bd_dev)));
bdevname(bdev));
*no_write = 0xdead0000 + bdev->bd_dev;
}
}
......@@ -351,7 +351,7 @@ static struct block_device *ext3_blkdev_get(kdev_t dev)
fail:
printk(KERN_ERR "EXT3: failed to open journal device %s: %d\n",
bdevname(dev), err);
__bdevname(dev), err);
return NULL;
}
......@@ -764,7 +764,7 @@ static int ext3_setup_super(struct super_block *sb, struct ext3_super_block *es,
sb->s_id);
if (EXT3_SB(sb)->s_journal->j_inode == NULL) {
printk("external journal on %s\n",
bdevname(to_kdev_t(EXT3_SB(sb)->s_journal->j_dev->bd_dev)));
bdevname(EXT3_SB(sb)->s_journal->j_dev));
} else {
printk("internal journal\n");
}
......
......@@ -476,7 +476,6 @@ int journal_write_metadata_buffer(transaction_t *transaction,
new_jh->b_transaction = NULL;
new_bh->b_size = jh2bh(jh_in)->b_size;
new_bh->b_bdev = transaction->t_journal->j_dev;
new_bh->b_dev = to_kdev_t(transaction->t_journal->j_dev->bd_dev);
new_bh->b_blocknr = blocknr;
new_bh->b_state |= (1 << BH_Mapped) | (1 << BH_Dirty);
......@@ -641,7 +640,7 @@ int journal_bmap(journal_t *journal, unsigned long blocknr,
": journal block not found "
"at offset %lu on %s\n",
blocknr,
bdevname(to_kdev_t(journal->j_dev->bd_dev)));
bdevname(journal->j_dev));
err = -EIO;
__journal_abort_soft(journal, err);
}
......@@ -1366,7 +1365,7 @@ const char * journal_dev_name(journal_t *journal)
else
bdev = journal->j_dev;
return bdevname(to_kdev_t(bdev->bd_dev));
return bdevname(bdev);
}
/*
......
......@@ -261,7 +261,7 @@ adfspart_check_ADFS(struct gendisk *hd, struct block_device *bdev,
/*
* Work out start of non-adfs partition.
*/
nr_sects = hd->part[minor(to_kdev_t(bdev->bd_dev))].nr_sects - start_sect;
nr_sects = (bdev->bd_inode->i_size >> 9) - start_sect;
if (start_sect) {
first_sector += start_sect;
......
......@@ -39,7 +39,6 @@ amiga_partition(struct gendisk *hd, struct block_device *bdev,
struct RigidDiskBlock *rdb;
struct PartitionBlock *pb;
int start_sect, nr_sects, blk, part, res = 0;
kdev_t dev = to_kdev_t(bdev->bd_dev);
for (blk = 0; ; blk++, put_dev_sector(sect)) {
if (blk == RDB_ALLOCATION_LIMIT)
......@@ -48,7 +47,7 @@ amiga_partition(struct gendisk *hd, struct block_device *bdev,
if (!data) {
if (warn_no_part)
printk("Dev %s: unable to read RDB block %d\n",
bdevname(dev), blk);
bdevname(bdev), blk);
goto rdb_done;
}
if (*(u32 *)data != cpu_to_be32(IDNAME_RIGIDDISK))
......@@ -69,7 +68,7 @@ amiga_partition(struct gendisk *hd, struct block_device *bdev,
}
printk("Dev %s: RDB in block %d has bad checksum\n",
bdevname(dev),blk);
bdevname(bdev),blk);
}
printk(" RDSK");
......@@ -80,7 +79,7 @@ amiga_partition(struct gendisk *hd, struct block_device *bdev,
if (!data) {
if (warn_no_part)
printk("Dev %s: unable to read partition block %d\n",
bdevname(dev),blk);
bdevname(bdev),blk);
goto rdb_done;
}
pb = (struct PartitionBlock *)data;
......
......@@ -22,7 +22,6 @@ int sgi_partition(struct gendisk *hd, struct block_device *bdev, unsigned long f
int i, csum, magic;
unsigned int *ui, start, blocks, cs;
Sector sect;
kdev_t dev = to_kdev_t(bdev->bd_dev);
struct sgi_disklabel {
int magic_mushroom; /* Big fat spliff... */
short root_part_num; /* Root partition number */
......@@ -51,7 +50,7 @@ int sgi_partition(struct gendisk *hd, struct block_device *bdev, unsigned long f
magic = label->magic_mushroom;
if(be32_to_cpu(magic) != SGI_LABEL_MAGIC) {
/*printk("Dev %s SGI disklabel: bad magic %08x\n",
bdevname(dev), magic);*/
bdevname(bdev), magic);*/
put_dev_sector(sect);
return 0;
}
......@@ -62,7 +61,7 @@ int sgi_partition(struct gendisk *hd, struct block_device *bdev, unsigned long f
}
if(csum) {
printk(KERN_WARNING "Dev %s SGI disklabel: csum bad, label corrupted\n",
bdevname(dev));
bdevname(bdev));
put_dev_sector(sect);
return 0;
}
......
......@@ -24,7 +24,6 @@ int sun_partition(struct gendisk *hd, struct block_device *bdev, unsigned long f
int i, csum;
unsigned short *ush;
Sector sect;
kdev_t dev = to_kdev_t(bdev->bd_dev);
struct sun_disklabel {
unsigned char info[128]; /* Informative text string */
unsigned char spare[292]; /* Boot information etc. */
......@@ -55,7 +54,7 @@ int sun_partition(struct gendisk *hd, struct block_device *bdev, unsigned long f
p = label->partitions;
if (be16_to_cpu(label->magic) != SUN_LABEL_MAGIC) {
/* printk(KERN_INFO "Dev %s Sun disklabel: bad magic %04x\n",
bdevname(dev), be16_to_cpu(label->magic)); */
bdevname(bdev), be16_to_cpu(label->magic)); */
put_dev_sector(sect);
return 0;
}
......@@ -65,7 +64,7 @@ int sun_partition(struct gendisk *hd, struct block_device *bdev, unsigned long f
csum ^= *ush--;
if(csum) {
printk("Dev %s Sun disklabel: Csum bad, label corrupted\n",
bdevname(dev));
bdevname(bdev));
put_dev_sector(sect);
return 0;
}
......
......@@ -893,7 +893,7 @@ static int flush_older_journal_lists(struct super_block *p_s_sb, struct reiserfs
static void reiserfs_end_buffer_io_sync(struct buffer_head *bh, int uptodate) {
if (buffer_journaled(bh)) {
reiserfs_warning("clm-2084: pinned buffer %lu:%s sent to disk\n",
bh->b_blocknr, kdevname(bh->b_dev)) ;
bh->b_blocknr, bdevname(bh->b_bdev)) ;
}
mark_buffer_uptodate(bh, uptodate) ;
unlock_buffer(bh) ;
......@@ -1666,7 +1666,7 @@ static int journal_read(struct super_block *p_s_sb) {
cur_dblock = SB_ONDISK_JOURNAL_1st_BLOCK(p_s_sb) ;
printk("reiserfs: checking transaction log (%s) for (%s)\n",
bdevname(SB_JOURNAL_DEV(p_s_sb)), p_s_sb->s_id) ;
__bdevname(SB_JOURNAL_DEV(p_s_sb)), p_s_sb->s_id) ;
start = CURRENT_TIME ;
/* step 1, read in the journal header block. Check the transaction it says
......
......@@ -139,7 +139,7 @@ static void sprintf_block_head (char * buf, struct buffer_head * bh)
static void sprintf_buffer_head (char * buf, struct buffer_head * bh)
{
sprintf (buf, "dev %s, size %d, blocknr %ld, count %d, list %d, state 0x%lx, page %p, (%s, %s, %s)",
kdevname (bh->b_dev), bh->b_size, bh->b_blocknr, atomic_read (&(bh->b_count)), bh->b_list,
bdevname (bh->b_bdev), bh->b_size, bh->b_blocknr, atomic_read (&(bh->b_count)), bh->b_list,
bh->b_state, bh->b_page,
buffer_uptodate (bh) ? "UPTODATE" : "!UPTODATE",
buffer_dirty (bh) ? "DIRTY" : "CLEAN",
......@@ -508,7 +508,7 @@ static int print_super_block (struct buffer_head * bh)
}
printk ("%s\'s super block in block %ld\n======================\n",
kdevname (bh->b_dev), bh->b_blocknr);
bdevname (bh->b_bdev), bh->b_blocknr);
printk ("Reiserfs version %s\n", version );
printk ("Block count %u\n", sb_block_count(rs));
printk ("Blocksize %d\n", sb_blocksize(rs));
......
......@@ -501,7 +501,7 @@ int reiserfs_journal_in_proc( char *buffer, char **start, off_t offset,
"prepare_retry: \t%12lu\n",
DJP( jp_journal_1st_block ),
DJP( jp_journal_dev ) == 0 ? "none" : bdevname(to_kdev_t(DJP( jp_journal_dev ))),
DJP( jp_journal_dev ) == 0 ? "none" : __bdevname(to_kdev_t(DJP( jp_journal_dev ))),
DJP( jp_journal_dev ),
DJP( jp_journal_size ),
DJP( jp_journal_trans_max ),
......
......@@ -395,7 +395,7 @@ static inline int key_in_buffer (
p_s_chk_path->path_length > MAX_HEIGHT,
"PAP-5050: pointer to the key(%p) is NULL or illegal path length(%d)",
p_s_key, p_s_chk_path->path_length);
RFALSE( kdev_same(PATH_PLAST_BUFFER(p_s_chk_path)->b_dev, NODEV),
RFALSE( !PATH_PLAST_BUFFER(p_s_chk_path)->b_bdev,
"PAP-5060: device must not be NODEV");
if ( COMP_KEYS(get_lkey(p_s_chk_path, p_s_sb), p_s_key) == 1 )
......
......@@ -515,7 +515,7 @@ struct super_block *get_sb_bdev(struct file_system_type *fs_type,
blkdev_put(bdev, BDEV_FS);
} else {
s->s_flags = flags;
strncpy(s->s_id, bdevname(dev), sizeof(s->s_id));
strncpy(s->s_id, bdevname(bdev), sizeof(s->s_id));
s->s_old_blocksize = block_size(dev);
sb_set_blocksize(s, s->s_old_blocksize);
error = fill_super(s, data, flags & MS_VERBOSE ? 1 : 0);
......
......@@ -244,7 +244,6 @@ struct buffer_head {
sector_t b_blocknr; /* block number */
unsigned short b_size; /* block size */
unsigned short b_list; /* List that this buffer appears */
kdev_t b_dev; /* device (B_FREE = free) */
struct block_device *b_bdev;
atomic_t b_count; /* users using this block */
......@@ -1192,7 +1191,11 @@ extern const struct block_device_operations *get_blkfops(unsigned int);
extern int register_chrdev(unsigned int, const char *, struct file_operations *);
extern int unregister_chrdev(unsigned int, const char *);
extern int chrdev_open(struct inode *, struct file *);
extern const char * bdevname(kdev_t);
extern const char *__bdevname(kdev_t);
extern inline const char *bdevname(struct block_device *bdev)
{
return __bdevname(to_kdev_t(bdev->bd_dev));
}
extern const char * cdevname(kdev_t);
extern const char * kdevname(kdev_t);
extern void init_special_inode(struct inode *, umode_t, int);
......@@ -1462,7 +1465,7 @@ static inline struct buffer_head * get_hash_table(kdev_t dev, sector_t block, in
struct buffer_head *bh;
bdev = bdget(kdev_t_to_nr(dev));
if (!bdev) {
printk("No block device for %s\n", bdevname(dev));
printk("No block device for %s\n", __bdevname(dev));
BUG();
}
bh = __get_hash_table(bdev, block, size);
......@@ -1476,7 +1479,7 @@ static inline struct buffer_head * getblk(kdev_t dev, sector_t block, int size)
struct buffer_head *bh;
bdev = bdget(kdev_t_to_nr(dev));
if (!bdev) {
printk("No block device for %s\n", bdevname(dev));
printk("No block device for %s\n", __bdevname(dev));
BUG();
}
bh = __getblk(bdev, block, size);
......@@ -1510,7 +1513,7 @@ static inline struct buffer_head * bread(kdev_t dev, int block, int size)
struct buffer_head *bh;
bdev = bdget(kdev_t_to_nr(dev));
if (!bdev) {
printk("No block device for %s\n", bdevname(dev));
printk("No block device for %s\n", __bdevname(dev));
BUG();
}
bh = __bread(bdev, block, size);
......@@ -1533,7 +1536,6 @@ static inline void map_bh(struct buffer_head *bh, struct super_block *sb, int bl
{
bh->b_state |= 1 << BH_Mapped;
bh->b_bdev = sb->s_bdev;
bh->b_dev = sb->s_dev;
bh->b_blocknr = block;
}
extern void wakeup_bdflush(void);
......
......@@ -498,7 +498,7 @@ EXPORT_SYMBOL(vsprintf);
EXPORT_SYMBOL(vsnprintf);
EXPORT_SYMBOL(vsscanf);
EXPORT_SYMBOL(kdevname);
EXPORT_SYMBOL(bdevname);
EXPORT_SYMBOL(__bdevname);
EXPORT_SYMBOL(cdevname);
EXPORT_SYMBOL(simple_strtoul);
EXPORT_SYMBOL(system_utsname); /* UTS data */
......
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