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

[PATCH] large dev_t - second series (11/15)

	Fix for JFS handling of device nodes; it has 32bit on-disk device
numbers, shoves them into 16bit (->i_rdev) when inode is read and writes
them back truncated when inode is written to disk.  For now (and 2.4 will
have to do the same permanently) we store the original value in private
part of inode and use it instead of ->i_rdev in ->write_inode(); mknod()
sets it at the same time as ->i_rdev.  It will become unnecessary when
dev_t becomes wider than 16 bits, but for now we need it.
parent d84b5b0b
...@@ -3041,9 +3041,10 @@ static int copy_from_dinode(struct dinode * dip, struct inode *ip) ...@@ -3041,9 +3041,10 @@ static int copy_from_dinode(struct dinode * dip, struct inode *ip)
jfs_ip->next_index = le32_to_cpu(dip->di_next_index); jfs_ip->next_index = le32_to_cpu(dip->di_next_index);
jfs_ip->otime = le32_to_cpu(dip->di_otime.tv_sec); jfs_ip->otime = le32_to_cpu(dip->di_otime.tv_sec);
jfs_ip->acltype = le32_to_cpu(dip->di_acltype); jfs_ip->acltype = le32_to_cpu(dip->di_acltype);
jfs_ip->dev = le32_to_cpu(dip->di_rdev);
if (S_ISCHR(ip->i_mode) || S_ISBLK(ip->i_mode)) if (S_ISCHR(ip->i_mode) || S_ISBLK(ip->i_mode))
ip->i_rdev = le32_to_cpu(dip->di_rdev); ip->i_rdev = old_decode_dev(jfs_ip->dev);
if (S_ISDIR(ip->i_mode)) { if (S_ISDIR(ip->i_mode)) {
memcpy(&jfs_ip->i_dirtable, &dip->di_dirtable, 384); memcpy(&jfs_ip->i_dirtable, &dip->di_dirtable, 384);
...@@ -3100,9 +3101,7 @@ static void copy_to_dinode(struct dinode * dip, struct inode *ip) ...@@ -3100,9 +3101,7 @@ static void copy_to_dinode(struct dinode * dip, struct inode *ip)
dip->di_otime.tv_sec = cpu_to_le32(jfs_ip->otime); dip->di_otime.tv_sec = cpu_to_le32(jfs_ip->otime);
dip->di_otime.tv_nsec = 0; dip->di_otime.tv_nsec = 0;
dip->di_acltype = cpu_to_le32(jfs_ip->acltype); dip->di_acltype = cpu_to_le32(jfs_ip->acltype);
dip->di_rdev = cpu_to_le32(jfs_ip->dev);
if (S_ISCHR(ip->i_mode) || S_ISBLK(ip->i_mode))
dip->di_rdev = cpu_to_le32(ip->i_rdev);
} }
#ifdef _JFS_DEBUG_IMAP #ifdef _JFS_DEBUG_IMAP
......
...@@ -93,6 +93,7 @@ struct jfs_inode_info { ...@@ -93,6 +93,7 @@ struct jfs_inode_info {
unchar _inline_ea[128]; /* 128: inline extended attr */ unchar _inline_ea[128]; /* 128: inline extended attr */
} link; } link;
} u; } u;
u32 dev; /* will die when we get wide dev_t */
struct inode vfs_inode; struct inode vfs_inode;
}; };
#define i_xtroot u.file._xtroot #define i_xtroot u.file._xtroot
...@@ -143,7 +144,7 @@ struct jfs_sb_info { ...@@ -143,7 +144,7 @@ struct jfs_sb_info {
short nbperpage; /* blocks per page */ short nbperpage; /* blocks per page */
short l2nbperpage; /* log2 blocks per page */ short l2nbperpage; /* log2 blocks per page */
short l2niperblk; /* log2 inodes per page */ short l2niperblk; /* log2 inodes per page */
u32 logdev; /* external log device */ dev_t logdev; /* external log device */
uint aggregate; /* volume identifier in log record */ uint aggregate; /* volume identifier in log record */
pxd_t logpxd; /* pxd describing log */ pxd_t logpxd; /* pxd describing log */
pxd_t fsckpxd; /* pxd describing fsck wkspc */ pxd_t fsckpxd; /* pxd describing fsck wkspc */
......
...@@ -395,7 +395,7 @@ static int chkSuper(struct super_block *sb) ...@@ -395,7 +395,7 @@ static int chkSuper(struct super_block *sb)
if (sbi->mntflag & JFS_INLINELOG) if (sbi->mntflag & JFS_INLINELOG)
sbi->logpxd = j_sb->s_logpxd; sbi->logpxd = j_sb->s_logpxd;
else { else {
sbi->logdev = le32_to_cpu(j_sb->s_logdev); sbi->logdev = old_decode_dev(le32_to_cpu(j_sb->s_logdev));
memcpy(sbi->uuid, j_sb->s_uuid, sizeof(sbi->uuid)); memcpy(sbi->uuid, j_sb->s_uuid, sizeof(sbi->uuid));
memcpy(sbi->loguuid, j_sb->s_loguuid, sizeof(sbi->uuid)); memcpy(sbi->loguuid, j_sb->s_loguuid, sizeof(sbi->uuid));
} }
......
...@@ -1302,6 +1302,7 @@ int jfs_rename(struct inode *old_dir, struct dentry *old_dentry, ...@@ -1302,6 +1302,7 @@ int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
*/ */
int jfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev) int jfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
{ {
struct jfs_inode_info *jfs_ip;
struct btstack btstack; struct btstack btstack;
struct component_name dname; struct component_name dname;
ino_t ino; ino_t ino;
...@@ -1324,6 +1325,7 @@ int jfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev) ...@@ -1324,6 +1325,7 @@ int jfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
rc = -ENOSPC; rc = -ENOSPC;
goto out1; goto out1;
} }
jfs_ip = JFS_IP(ip);
tid = txBegin(dir->i_sb, 0); tid = txBegin(dir->i_sb, 0);
...@@ -1342,6 +1344,7 @@ int jfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev) ...@@ -1342,6 +1344,7 @@ int jfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
goto out3; goto out3;
ip->i_op = &jfs_file_inode_operations; ip->i_op = &jfs_file_inode_operations;
jfs_ip->dev = old_encode_dev(rdev);
init_special_inode(ip, ip->i_mode, rdev); init_special_inode(ip, ip->i_mode, rdev);
insert_inode_hash(ip); insert_inode_hash(ip);
......
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