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

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

	Similar fix for UFS; touching device node (and they have 32bit
dev_t) ends up killing upper 16 bits, which makes for very unhappy
*BSD, since that turns /dev/ad0s1 into alias of /dev/ad0.  Again, for
now we store on-disk value in private part of inode and use it instead
of ->i_rdev in ->write_inode().
parent ec55b83d
...@@ -475,6 +475,7 @@ void ufs_read_inode (struct inode * inode) ...@@ -475,6 +475,7 @@ void ufs_read_inode (struct inode * inode)
struct ufs_sb_private_info * uspi; struct ufs_sb_private_info * uspi;
struct ufs_inode * ufs_inode; struct ufs_inode * ufs_inode;
struct buffer_head * bh; struct buffer_head * bh;
mode_t mode;
unsigned i; unsigned i;
unsigned flags; unsigned flags;
...@@ -500,7 +501,7 @@ void ufs_read_inode (struct inode * inode) ...@@ -500,7 +501,7 @@ void ufs_read_inode (struct inode * inode)
/* /*
* Copy data to the in-core inode. * Copy data to the in-core inode.
*/ */
inode->i_mode = fs16_to_cpu(sb, ufs_inode->ui_mode); inode->i_mode = mode = fs16_to_cpu(sb, ufs_inode->ui_mode);
inode->i_nlink = fs16_to_cpu(sb, ufs_inode->ui_nlink); inode->i_nlink = fs16_to_cpu(sb, ufs_inode->ui_nlink);
if (inode->i_nlink == 0) if (inode->i_nlink == 0)
ufs_error (sb, "ufs_read_inode", "inode %lu has zero nlink\n", inode->i_ino); ufs_error (sb, "ufs_read_inode", "inode %lu has zero nlink\n", inode->i_ino);
...@@ -527,9 +528,7 @@ void ufs_read_inode (struct inode * inode) ...@@ -527,9 +528,7 @@ void ufs_read_inode (struct inode * inode)
ufsi->i_oeftflag = fs32_to_cpu(sb, ufs_inode->ui_u3.ui_sun.ui_oeftflag); ufsi->i_oeftflag = fs32_to_cpu(sb, ufs_inode->ui_u3.ui_sun.ui_oeftflag);
ufsi->i_lastfrag = (inode->i_size + uspi->s_fsize - 1) >> uspi->s_fshift; ufsi->i_lastfrag = (inode->i_size + uspi->s_fsize - 1) >> uspi->s_fshift;
if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)) if (S_ISCHR(mode) || S_ISBLK(mode) || inode->i_blocks) {
;
else if (inode->i_blocks) {
for (i = 0; i < (UFS_NDADDR + UFS_NINDIR); i++) for (i = 0; i < (UFS_NDADDR + UFS_NINDIR); i++)
ufsi->i_u1.i_data[i] = ufs_inode->ui_u2.ui_addr.ui_db[i]; ufsi->i_u1.i_data[i] = ufs_inode->ui_u2.ui_addr.ui_db[i];
} }
...@@ -555,7 +554,7 @@ void ufs_read_inode (struct inode * inode) ...@@ -555,7 +554,7 @@ void ufs_read_inode (struct inode * inode)
} }
} else } else
init_special_inode(inode, inode->i_mode, init_special_inode(inode, inode->i_mode,
fs32_to_cpu(sb, ufs_inode->ui_u2.ui_addr.ui_db[0])); old_decode_dev(fs32_to_cpu(sb, ufsi->i_u1.i_data[0])));
brelse (bh); brelse (bh);
...@@ -618,9 +617,10 @@ static int ufs_update_inode(struct inode * inode, int do_sync) ...@@ -618,9 +617,10 @@ static int ufs_update_inode(struct inode * inode, int do_sync)
ufs_inode->ui_u3.ui_sun.ui_oeftflag = cpu_to_fs32(sb, ufsi->i_oeftflag); ufs_inode->ui_u3.ui_sun.ui_oeftflag = cpu_to_fs32(sb, ufsi->i_oeftflag);
} }
if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)) if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)) {
ufs_inode->ui_u2.ui_addr.ui_db[0] = cpu_to_fs32(sb, inode->i_rdev); /* ufs_inode->ui_u2.ui_addr.ui_db[0] = cpu_to_fs32(sb, inode->i_rdev); */
else if (inode->i_blocks) { ufs_inode->ui_u2.ui_addr.ui_db[0] = ufsi->i_u1.i_data[0];
} else if (inode->i_blocks) {
for (i = 0; i < (UFS_NDADDR + UFS_NINDIR); i++) for (i = 0; i < (UFS_NDADDR + UFS_NINDIR); i++)
ufs_inode->ui_u2.ui_addr.ui_db[i] = ufsi->i_u1.i_data[i]; ufs_inode->ui_u2.ui_addr.ui_db[i] = ufsi->i_u1.i_data[i];
} }
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <linux/ufs_fs.h> #include <linux/ufs_fs.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include "swab.h" /* will go away - see comment in mknod() */
#undef UFS_NAMEI_DEBUG #undef UFS_NAMEI_DEBUG
...@@ -118,6 +119,9 @@ static int ufs_mknod (struct inode * dir, struct dentry *dentry, int mode, dev_t ...@@ -118,6 +119,9 @@ static int ufs_mknod (struct inode * dir, struct dentry *dentry, int mode, dev_t
int err = PTR_ERR(inode); int err = PTR_ERR(inode);
if (!IS_ERR(inode)) { if (!IS_ERR(inode)) {
init_special_inode(inode, mode, rdev); init_special_inode(inode, mode, rdev);
/* NOTE: that'll go when we get wide dev_t */
UFS_I(inode)->i_u1.i_data[0] = cpu_to_fs32(inode->i_sb,
old_encode_dev(rdev));
mark_inode_dirty(inode); mark_inode_dirty(inode);
lock_kernel(); lock_kernel();
err = ufs_add_nondir(dentry, inode); err = ufs_add_nondir(dentry, inode);
......
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