Commit 59dffd62 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] prepare for 32-bit dev_t: XFS

	sanitized dev_t use in debugging printks in XFS, switched their
bhash to use of struct block_device, added old_encode_dev() in XFS statfs()
(it had stored dev_t in ->fs_id[0])
parent 2c655bdf
......@@ -174,7 +174,7 @@ xfs_revalidate_inode(
inode->i_rdev = 0;
} else {
xfs_dev_t dev = ip->i_df.if_u2.if_rdev;
inode->i_rdev = XFS_DEV_TO_KDEVT(dev);
inode->i_rdev = XFS_DEV_TO_DEVT(dev);
}
inode->i_blksize = PAGE_CACHE_SIZE;
inode->i_generation = ip->i_d.di_gen;
......@@ -315,8 +315,8 @@ xfs_setsize_buftarg(
if (set_blocksize(btp->pbr_bdev, sectorsize)) {
printk(KERN_WARNING
"XFS: Cannot set_blocksize to %u on device 0x%lx\n",
sectorsize, (unsigned long)btp->pbr_dev);
"XFS: Cannot set_blocksize to %u on device %u:%u\n",
sectorsize, MAJOR(btp->pbr_dev), MINOR(btp->pbr_dev));
}
}
......
......@@ -174,16 +174,13 @@ STATIC pb_hash_t pbhash[NHASH];
STATIC int
_bhash(
dev_t dev,
struct block_device *bdev,
loff_t base)
{
int bit, hval;
base >>= 9;
/*
* dev_t is 16 bits, loff_t is always 64 bits
*/
base ^= dev;
base ^= (unsigned long)bdev / L1_CACHE_BYTES;
for (bit = hval = 0; base && bit < sizeof(base) * 8; bit += NBITS) {
hval ^= (int)base & (NHASH-1);
base >>= NBITS;
......@@ -619,7 +616,7 @@ _pagebuf_find( /* find buffer for block */
/* Ensure we never do IOs that are not sector aligned */
BUG_ON(range_base & (loff_t)target->pbr_smask);
hval = _bhash(target->pbr_bdev->bd_dev, range_base);
hval = _bhash(target->pbr_bdev, range_base);
h = &pbhash[hval];
spin_lock(&h->pb_hash_lock);
......
......@@ -33,7 +33,7 @@
#define __XFS_ERROR_H__
#define prdev(fmt,dev,args...) \
printk("XFS: device 0x%x- " fmt "\n", (unsigned)dev, ## args)
printk("XFS: device %u:%u- " fmt "\n", MAJOR(dev), MINOR(dev), ## args)
#define XFS_ERECOVER 1 /* Failure to recover log */
#define XFS_ELOGSTAT 2 /* Failure to stat log in user space */
......
......@@ -497,7 +497,8 @@ xfs_log_mount(xfs_mount_t *mp,
#if defined(DEBUG) || defined(XLOG_NOLOG)
if (! xlog_debug) {
cmn_err(CE_NOTE, "log dev: 0x%x", log_dev);
cmn_err(CE_NOTE, "log dev: %u:%u",
MAJOR(log_dev), MINOR(log_dev));
return 0;
}
#endif
......
......@@ -2179,8 +2179,8 @@ xlog_recover_do_buffer_trans(
break;
default:
xfs_fs_cmn_err(CE_ALERT, log->l_mp,
"xfs_log_recover: unknown buffer type 0x%x, dev 0x%x",
buf_f->blf_type, log->l_dev);
"xfs_log_recover: unknown buffer type 0x%x, dev %u:%u",
buf_f->blf_type, MAJOR(log->l_dev), MINOR(log->l_dev));
XFS_ERROR_REPORT("xlog_recover_do_buffer_trans",
XFS_ERRLEVEL_LOW, log->l_mp);
return XFS_ERROR(EFSCORRUPTED);
......
......@@ -260,10 +260,11 @@ xfs_ioerror_alert(
xfs_daddr_t blkno)
{
cmn_err(CE_ALERT,
"I/O error in filesystem (\"%s\") meta-data dev 0x%x block 0x%llx"
"I/O error in filesystem (\"%s\") meta-data dev %u:%u block 0x%llx"
" (\"%s\") error %d buf count %u",
(!mp || !mp->m_fsname) ? "(fs name not set)" : mp->m_fsname,
XFS_BUF_TARGET_DEV(bp),
MAJOR(XFS_BUF_TARGET_DEV(bp)),
MINOR(XFS_BUF_TARGET_DEV(bp)),
(__uint64_t)blkno,
func,
XFS_BUF_GETERROR(bp),
......
......@@ -211,6 +211,6 @@ typedef enum {
#define XFS_MKDEV(major,minor) ((xfs_dev_t)(((major)<<XFS_DEV_BITSMINOR) \
| (minor&XFS_DEV_MAXMIN)))
#define XFS_DEV_TO_KDEVT(dev) MKDEV(XFS_DEV_MAJOR(dev),XFS_DEV_MINOR(dev))
#define XFS_DEV_TO_DEVT(dev) MKDEV(XFS_DEV_MAJOR(dev),XFS_DEV_MINOR(dev))
#endif /* !__XFS_TYPES_H */
......@@ -781,7 +781,7 @@ xfs_statvfs(
statp->f_ffree = statp->f_files - (sbp->sb_icount - sbp->sb_ifree);
XFS_SB_UNLOCK(mp, s);
statp->f_fsid.val[0] = mp->m_dev;
statp->f_fsid.val[0] = old_encode_dev(mp->m_dev);
statp->f_fsid.val[1] = 0;
statp->f_namelen = MAXNAMELEN - 1;
......
......@@ -1684,9 +1684,11 @@ static void printinode(struct inode *ip)
ip->i_size);
kdb_printf(
" i_mode = 0x%x i_nlink = %d i_rdev = 0x%x i_state = 0x%lx\n",
" i_mode = 0x%x i_nlink = %d i_rdev = %u:%u i_state = 0x%lx\n",
ip->i_mode, ip->i_nlink,
ip->i_rdev, ip->i_state);
MAJOR(ip->i_rdev),
MINOR(ip->i_rdev),
ip->i_state);
kdb_printf(" i_hash.nxt = 0x%p i_hash.prv = 0x%p\n",
ip->i_hash.next, ip->i_hash.prev);
......@@ -3737,8 +3739,9 @@ xfsidbg_xdabuf(xfs_dabuf_t *dabuf)
kdb_printf(" %d:0x%p", i, dabuf->bps[i]);
kdb_printf("\n");
#ifdef XFS_DABUF_DEBUG
kdb_printf(" ra 0x%x prev 0x%x next 0x%x dev 0x%x blkno 0x%x\n",
dabuf->ra, dabuf->prev, dabuf->next, dabuf->dev, dabuf->blkno);
kdb_printf(" ra 0x%x prev 0x%x next 0x%x dev %u:%u blkno 0x%x\n",
dabuf->ra, dabuf->prev, dabuf->next,
MAJOR(dabuf->dev), MINOR(dabuf->dev), dabuf->blkno);
#endif
}
......@@ -4266,8 +4269,9 @@ xfsidbg_xlog(xlog_t *log)
xfsidbg_get_cstate(log->l_covered_state));
kdb_printf("flags: ");
printflags(log->l_flags, t_flags,"log");
kdb_printf(" dev: 0x%x logBBstart: %lld logsize: %d logBBsize: %d\n",
log->l_dev, (long long) log->l_logBBstart,
kdb_printf(" dev: %u:%u logBBstart: %lld logsize: %d logBBsize: %d\n",
MAJOR(log->l_dev), MINOR(log->l_dev),
(long long) log->l_logBBstart,
log->l_logsize,log->l_logBBsize);
kdb_printf("curr_cycle: %d prev_cycle: %d curr_block: %d prev_block: %d\n",
log->l_curr_cycle, log->l_prev_cycle, log->l_curr_block,
......@@ -4642,11 +4646,14 @@ xfsidbg_xmount(xfs_mount_t *mp)
XFS_MTOVFS(mp), mp->m_tid, &mp->m_ail_lock, &mp->m_ail);
kdb_printf("ail_gen 0x%x &sb 0x%p\n",
mp->m_ail_gen, &mp->m_sb);
kdb_printf("sb_lock 0x%p sb_bp 0x%p dev 0x%x logdev 0x%x rtdev 0x%x\n",
kdb_printf("sb_lock 0x%p sb_bp 0x%p dev %u:%u logdev %u:%u rtdev %u:%u\n",
&mp->m_sb_lock, mp->m_sb_bp,
mp->m_ddev_targp ? mp->m_ddev_targp->pbr_dev : 0,
mp->m_logdev_targp ? mp->m_logdev_targp->pbr_dev : 0,
mp->m_rtdev_targp ? mp->m_rtdev_targp->pbr_dev : 0);
mp->m_ddev_targp ? MAJOR(mp->m_ddev_targp->pbr_dev) : 0,
mp->m_ddev_targp ? MINOR(mp->m_ddev_targp->pbr_dev) : 0,
mp->m_logdev_targp ? MAJOR(mp->m_logdev_targp->pbr_dev) : 0,
mp->m_logdev_targp ? MINOR(mp->m_logdev_targp->pbr_dev) : 0,
mp->m_rtdev_targp ? MAJOR(mp->m_rtdev_targp->pbr_dev) : 0,
mp->m_rtdev_targp ? MINOR(mp->m_rtdev_targp->pbr_dev) : 0);
kdb_printf("bsize %d agfrotor %d agirotor %d ihash 0x%p ihsize %d\n",
mp->m_bsize, mp->m_agfrotor, mp->m_agirotor,
mp->m_ihash, mp->m_ihsize);
......@@ -4817,8 +4824,9 @@ xfsidbg_xnode(xfs_inode_t *ip)
ip->i_mnext,
ip->i_mprev,
XFS_ITOV_NULL(ip));
kdb_printf("dev %x ino %s\n",
ip->i_mount->m_dev,
kdb_printf("dev %u:%u ino %s\n",
MAJOR(ip->i_mount->m_dev),
MINOR(ip->i_mount->m_dev),
xfs_fmtino(ip->i_ino, ip->i_mount));
kdb_printf("blkno 0x%llx len 0x%x boffset 0x%x\n",
(long long) ip->i_blkno,
......
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