X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=fs%2Fjfs%2Fjfs_imap.c;fp=fs%2Fjfs%2Fjfs_imap.c;h=5384cac3bc829435f52901c4c93d84b6b81d95b5;hb=64ba3f394c830ec48a1c31b53dcae312c56f1604;hp=361920334d618ecd8bed25b330163dc79210afc2;hpb=be1e6109ac94a859551f8e1774eb9a8469fe055c;p=linux-2.6.git diff --git a/fs/jfs/jfs_imap.c b/fs/jfs/jfs_imap.c index 361920334..5384cac3b 100644 --- a/fs/jfs/jfs_imap.c +++ b/fs/jfs/jfs_imap.c @@ -67,14 +67,14 @@ static HLIST_HEAD(aggregate_hash); * imap locks */ /* iag free list lock */ -#define IAGFREE_LOCK_INIT(imap) mutex_init(&imap->im_freelock) -#define IAGFREE_LOCK(imap) mutex_lock(&imap->im_freelock) -#define IAGFREE_UNLOCK(imap) mutex_unlock(&imap->im_freelock) +#define IAGFREE_LOCK_INIT(imap) init_MUTEX(&imap->im_freelock) +#define IAGFREE_LOCK(imap) down(&imap->im_freelock) +#define IAGFREE_UNLOCK(imap) up(&imap->im_freelock) /* per ag iag list locks */ -#define AG_LOCK_INIT(imap,index) mutex_init(&(imap->im_aglock[index])) -#define AG_LOCK(imap,agno) mutex_lock(&imap->im_aglock[agno]) -#define AG_UNLOCK(imap,agno) mutex_unlock(&imap->im_aglock[agno]) +#define AG_LOCK_INIT(imap,index) init_MUTEX(&(imap->im_aglock[index])) +#define AG_LOCK(imap,agno) down(&imap->im_aglock[agno]) +#define AG_UNLOCK(imap,agno) up(&imap->im_aglock[agno]) /* * forward references @@ -1262,7 +1262,7 @@ int diFree(struct inode *ip) * to be freed by the transaction; */ tid = txBegin(ipimap->i_sb, COMMIT_FORCE); - mutex_lock(&JFS_IP(ipimap)->commit_mutex); + down(&JFS_IP(ipimap)->commit_sem); /* acquire tlock of the iag page of the freed ixad * to force the page NOHOMEOK (even though no data is @@ -1295,7 +1295,7 @@ int diFree(struct inode *ip) rc = txCommit(tid, 1, &iplist[0], COMMIT_FORCE); txEnd(tid); - mutex_unlock(&JFS_IP(ipimap)->commit_mutex); + up(&JFS_IP(ipimap)->commit_sem); /* unlock the AG inode map information */ AG_UNLOCK(imap, agno); @@ -2555,13 +2555,13 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp) * addressing structure pointing to the new iag page; */ tid = txBegin(sb, COMMIT_FORCE); - mutex_lock(&JFS_IP(ipimap)->commit_mutex); + down(&JFS_IP(ipimap)->commit_sem); /* update the inode map addressing structure to point to it */ if ((rc = xtInsert(tid, ipimap, 0, blkno, xlen, &xaddr, 0))) { txEnd(tid); - mutex_unlock(&JFS_IP(ipimap)->commit_mutex); + up(&JFS_IP(ipimap)->commit_sem); /* Free the blocks allocated for the iag since it was * not successfully added to the inode map */ @@ -2627,7 +2627,7 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp) rc = txCommit(tid, 1, &iplist[0], COMMIT_FORCE); txEnd(tid); - mutex_unlock(&JFS_IP(ipimap)->commit_mutex); + up(&JFS_IP(ipimap)->commit_sem); duplicateIXtree(sb, blkno, xlen, &xaddr); @@ -3075,7 +3075,6 @@ static void duplicateIXtree(struct super_block *sb, s64 blkno, static int copy_from_dinode(struct dinode * dip, struct inode *ip) { struct jfs_inode_info *jfs_ip = JFS_IP(ip); - struct jfs_sb_info *sbi = JFS_SBI(ip->i_sb); uid_t uid; gid_t gid; @@ -3083,38 +3082,14 @@ static int copy_from_dinode(struct dinode * dip, struct inode *ip) jfs_ip->mode2 = le32_to_cpu(dip->di_mode); ip->i_mode = le32_to_cpu(dip->di_mode) & 0xffff; - if (sbi->umask != -1) { - ip->i_mode = (ip->i_mode & ~0777) | (0777 & ~sbi->umask); - /* For directories, add x permission if r is allowed by umask */ - if (S_ISDIR(ip->i_mode)) { - if (ip->i_mode & 0400) - ip->i_mode |= 0100; - if (ip->i_mode & 0040) - ip->i_mode |= 0010; - if (ip->i_mode & 0004) - ip->i_mode |= 0001; - } - } ip->i_nlink = le32_to_cpu(dip->di_nlink); uid = le32_to_cpu(dip->di_uid); gid = le32_to_cpu(dip->di_gid); + ip->i_uid = INOXID_UID(XID_TAG(ip), uid, gid); + ip->i_gid = INOXID_GID(XID_TAG(ip), uid, gid); ip->i_xid = INOXID_XID(XID_TAG(ip), uid, gid, 0); - jfs_ip->saved_uid = INOXID_UID(XID_TAG(ip), uid, gid); - if (sbi->uid == -1) - ip->i_uid = jfs_ip->saved_uid; - else { - ip->i_uid = sbi->uid; - } - - jfs_ip->saved_gid = INOXID_GID(XID_TAG(ip), uid, gid); - if (sbi->gid == -1) - ip->i_gid = jfs_ip->saved_gid; - else { - ip->i_gid = sbi->gid; - } - ip->i_size = le64_to_cpu(dip->di_size); ip->i_atime.tv_sec = le32_to_cpu(dip->di_atime.tv_sec); ip->i_atime.tv_nsec = le32_to_cpu(dip->di_atime.tv_nsec); @@ -3122,6 +3097,7 @@ static int copy_from_dinode(struct dinode * dip, struct inode *ip) ip->i_mtime.tv_nsec = le32_to_cpu(dip->di_mtime.tv_nsec); ip->i_ctime.tv_sec = le32_to_cpu(dip->di_ctime.tv_sec); ip->i_ctime.tv_nsec = le32_to_cpu(dip->di_ctime.tv_nsec); + ip->i_blksize = ip->i_sb->s_blocksize; ip->i_blocks = LBLK2PBLK(ip->i_sb, le64_to_cpu(dip->di_nblocks)); ip->i_generation = le32_to_cpu(dip->di_gen); @@ -3164,31 +3140,26 @@ static int copy_from_dinode(struct dinode * dip, struct inode *ip) static void copy_to_dinode(struct dinode * dip, struct inode *ip) { struct jfs_inode_info *jfs_ip = JFS_IP(ip); - struct jfs_sb_info *sbi = JFS_SBI(ip->i_sb); + uid_t uid; + gid_t gid; dip->di_fileset = cpu_to_le32(jfs_ip->fileset); - dip->di_inostamp = cpu_to_le32(sbi->inostamp); + dip->di_inostamp = cpu_to_le32(JFS_SBI(ip->i_sb)->inostamp); dip->di_number = cpu_to_le32(ip->i_ino); dip->di_gen = cpu_to_le32(ip->i_generation); dip->di_size = cpu_to_le64(ip->i_size); dip->di_nblocks = cpu_to_le64(PBLK2LBLK(ip->i_sb, ip->i_blocks)); dip->di_nlink = cpu_to_le32(ip->i_nlink); - dip->di_uid = cpu_to_le32(XIDINO_UID(XID_TAG(ip), - (sbi->uid == -1) ? ip->i_uid : jfs_ip->saved_uid, ip->i_xid)); - dip->di_gid = cpu_to_le32(XIDINO_GID(XID_TAG(ip), - (sbi->gid == -1) ? ip->i_gid : jfs_ip->saved_gid, ip->i_xid)); - + uid = XIDINO_UID(XID_TAG(ip), ip->i_uid, ip->i_xid); + gid = XIDINO_GID(XID_TAG(ip), ip->i_gid, ip->i_xid); + dip->di_uid = cpu_to_le32(uid); + dip->di_gid = cpu_to_le32(gid); /* * mode2 is only needed for storing the higher order bits. * Trust i_mode for the lower order ones */ - if (sbi->umask == -1) - dip->di_mode = cpu_to_le32((jfs_ip->mode2 & 0xffff0000) | - ip->i_mode); - else /* Leave the original permissions alone */ - dip->di_mode = cpu_to_le32(jfs_ip->mode2); - + dip->di_mode = cpu_to_le32((jfs_ip->mode2 & 0xffff0000) | ip->i_mode); dip->di_atime.tv_sec = cpu_to_le32(ip->i_atime.tv_sec); dip->di_atime.tv_nsec = cpu_to_le32(ip->i_atime.tv_nsec); dip->di_ctime.tv_sec = cpu_to_le32(ip->i_ctime.tv_sec);