diff options
| author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-03-21 12:08:21 -0500 |
|---|---|---|
| committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-03-21 12:08:21 -0500 |
| commit | ac58c9059da8886b5e8cde012a80266b18ca146e (patch) | |
| tree | 40bf486843a2cace6c3a959d73423e50e6aa0c00 /fs/jfs/jfs_imap.c | |
| parent | df6db302cb236ac3a683d535a3e2073d9f4b2833 (diff) | |
| parent | c4a1745aa09fc110afdefea0e5d025043e348bae (diff) | |
Merge branch 'linus'
Diffstat (limited to 'fs/jfs/jfs_imap.c')
| -rw-r--r-- | fs/jfs/jfs_imap.c | 72 |
1 files changed, 55 insertions, 17 deletions
diff --git a/fs/jfs/jfs_imap.c b/fs/jfs/jfs_imap.c index 4efa0d0eec39..ccbe60aff83d 100644 --- a/fs/jfs/jfs_imap.c +++ b/fs/jfs/jfs_imap.c | |||
| @@ -66,14 +66,14 @@ static HLIST_HEAD(aggregate_hash); | |||
| 66 | * imap locks | 66 | * imap locks |
| 67 | */ | 67 | */ |
| 68 | /* iag free list lock */ | 68 | /* iag free list lock */ |
| 69 | #define IAGFREE_LOCK_INIT(imap) init_MUTEX(&imap->im_freelock) | 69 | #define IAGFREE_LOCK_INIT(imap) mutex_init(&imap->im_freelock) |
| 70 | #define IAGFREE_LOCK(imap) down(&imap->im_freelock) | 70 | #define IAGFREE_LOCK(imap) mutex_lock(&imap->im_freelock) |
| 71 | #define IAGFREE_UNLOCK(imap) up(&imap->im_freelock) | 71 | #define IAGFREE_UNLOCK(imap) mutex_unlock(&imap->im_freelock) |
| 72 | 72 | ||
| 73 | /* per ag iag list locks */ | 73 | /* per ag iag list locks */ |
| 74 | #define AG_LOCK_INIT(imap,index) init_MUTEX(&(imap->im_aglock[index])) | 74 | #define AG_LOCK_INIT(imap,index) mutex_init(&(imap->im_aglock[index])) |
| 75 | #define AG_LOCK(imap,agno) down(&imap->im_aglock[agno]) | 75 | #define AG_LOCK(imap,agno) mutex_lock(&imap->im_aglock[agno]) |
| 76 | #define AG_UNLOCK(imap,agno) up(&imap->im_aglock[agno]) | 76 | #define AG_UNLOCK(imap,agno) mutex_unlock(&imap->im_aglock[agno]) |
| 77 | 77 | ||
| 78 | /* | 78 | /* |
| 79 | * forward references | 79 | * forward references |
| @@ -1261,7 +1261,7 @@ int diFree(struct inode *ip) | |||
| 1261 | * to be freed by the transaction; | 1261 | * to be freed by the transaction; |
| 1262 | */ | 1262 | */ |
| 1263 | tid = txBegin(ipimap->i_sb, COMMIT_FORCE); | 1263 | tid = txBegin(ipimap->i_sb, COMMIT_FORCE); |
| 1264 | down(&JFS_IP(ipimap)->commit_sem); | 1264 | mutex_lock(&JFS_IP(ipimap)->commit_mutex); |
| 1265 | 1265 | ||
| 1266 | /* acquire tlock of the iag page of the freed ixad | 1266 | /* acquire tlock of the iag page of the freed ixad |
| 1267 | * to force the page NOHOMEOK (even though no data is | 1267 | * to force the page NOHOMEOK (even though no data is |
| @@ -1294,7 +1294,7 @@ int diFree(struct inode *ip) | |||
| 1294 | rc = txCommit(tid, 1, &iplist[0], COMMIT_FORCE); | 1294 | rc = txCommit(tid, 1, &iplist[0], COMMIT_FORCE); |
| 1295 | 1295 | ||
| 1296 | txEnd(tid); | 1296 | txEnd(tid); |
| 1297 | up(&JFS_IP(ipimap)->commit_sem); | 1297 | mutex_unlock(&JFS_IP(ipimap)->commit_mutex); |
| 1298 | 1298 | ||
| 1299 | /* unlock the AG inode map information */ | 1299 | /* unlock the AG inode map information */ |
| 1300 | AG_UNLOCK(imap, agno); | 1300 | AG_UNLOCK(imap, agno); |
| @@ -2554,13 +2554,13 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp) | |||
| 2554 | * addressing structure pointing to the new iag page; | 2554 | * addressing structure pointing to the new iag page; |
| 2555 | */ | 2555 | */ |
| 2556 | tid = txBegin(sb, COMMIT_FORCE); | 2556 | tid = txBegin(sb, COMMIT_FORCE); |
| 2557 | down(&JFS_IP(ipimap)->commit_sem); | 2557 | mutex_lock(&JFS_IP(ipimap)->commit_mutex); |
| 2558 | 2558 | ||
| 2559 | /* update the inode map addressing structure to point to it */ | 2559 | /* update the inode map addressing structure to point to it */ |
| 2560 | if ((rc = | 2560 | if ((rc = |
| 2561 | xtInsert(tid, ipimap, 0, blkno, xlen, &xaddr, 0))) { | 2561 | xtInsert(tid, ipimap, 0, blkno, xlen, &xaddr, 0))) { |
| 2562 | txEnd(tid); | 2562 | txEnd(tid); |
| 2563 | up(&JFS_IP(ipimap)->commit_sem); | 2563 | mutex_unlock(&JFS_IP(ipimap)->commit_mutex); |
| 2564 | /* Free the blocks allocated for the iag since it was | 2564 | /* Free the blocks allocated for the iag since it was |
| 2565 | * not successfully added to the inode map | 2565 | * not successfully added to the inode map |
| 2566 | */ | 2566 | */ |
| @@ -2626,7 +2626,7 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp) | |||
| 2626 | rc = txCommit(tid, 1, &iplist[0], COMMIT_FORCE); | 2626 | rc = txCommit(tid, 1, &iplist[0], COMMIT_FORCE); |
| 2627 | 2627 | ||
| 2628 | txEnd(tid); | 2628 | txEnd(tid); |
| 2629 | up(&JFS_IP(ipimap)->commit_sem); | 2629 | mutex_unlock(&JFS_IP(ipimap)->commit_mutex); |
| 2630 | 2630 | ||
| 2631 | duplicateIXtree(sb, blkno, xlen, &xaddr); | 2631 | duplicateIXtree(sb, blkno, xlen, &xaddr); |
| 2632 | 2632 | ||
| @@ -3074,14 +3074,40 @@ static void duplicateIXtree(struct super_block *sb, s64 blkno, | |||
| 3074 | static int copy_from_dinode(struct dinode * dip, struct inode *ip) | 3074 | static int copy_from_dinode(struct dinode * dip, struct inode *ip) |
| 3075 | { | 3075 | { |
| 3076 | struct jfs_inode_info *jfs_ip = JFS_IP(ip); | 3076 | struct jfs_inode_info *jfs_ip = JFS_IP(ip); |
| 3077 | struct jfs_sb_info *sbi = JFS_SBI(ip->i_sb); | ||
| 3077 | 3078 | ||
| 3078 | jfs_ip->fileset = le32_to_cpu(dip->di_fileset); | 3079 | jfs_ip->fileset = le32_to_cpu(dip->di_fileset); |
| 3079 | jfs_ip->mode2 = le32_to_cpu(dip->di_mode); | 3080 | jfs_ip->mode2 = le32_to_cpu(dip->di_mode); |
| 3080 | 3081 | ||
| 3081 | ip->i_mode = le32_to_cpu(dip->di_mode) & 0xffff; | 3082 | ip->i_mode = le32_to_cpu(dip->di_mode) & 0xffff; |
| 3083 | if (sbi->umask != -1) { | ||
| 3084 | ip->i_mode = (ip->i_mode & ~0777) | (0777 & ~sbi->umask); | ||
| 3085 | /* For directories, add x permission if r is allowed by umask */ | ||
| 3086 | if (S_ISDIR(ip->i_mode)) { | ||
| 3087 | if (ip->i_mode & 0400) | ||
| 3088 | ip->i_mode |= 0100; | ||
| 3089 | if (ip->i_mode & 0040) | ||
| 3090 | ip->i_mode |= 0010; | ||
| 3091 | if (ip->i_mode & 0004) | ||
| 3092 | ip->i_mode |= 0001; | ||
| 3093 | } | ||
| 3094 | } | ||
| 3082 | ip->i_nlink = le32_to_cpu(dip->di_nlink); | 3095 | ip->i_nlink = le32_to_cpu(dip->di_nlink); |
| 3083 | ip->i_uid = le32_to_cpu(dip->di_uid); | 3096 | |
| 3084 | ip->i_gid = le32_to_cpu(dip->di_gid); | 3097 | jfs_ip->saved_uid = le32_to_cpu(dip->di_uid); |
| 3098 | if (sbi->uid == -1) | ||
| 3099 | ip->i_uid = jfs_ip->saved_uid; | ||
| 3100 | else { | ||
| 3101 | ip->i_uid = sbi->uid; | ||
| 3102 | } | ||
| 3103 | |||
| 3104 | jfs_ip->saved_gid = le32_to_cpu(dip->di_gid); | ||
| 3105 | if (sbi->gid == -1) | ||
| 3106 | ip->i_gid = jfs_ip->saved_gid; | ||
| 3107 | else { | ||
| 3108 | ip->i_gid = sbi->gid; | ||
| 3109 | } | ||
| 3110 | |||
| 3085 | ip->i_size = le64_to_cpu(dip->di_size); | 3111 | ip->i_size = le64_to_cpu(dip->di_size); |
| 3086 | ip->i_atime.tv_sec = le32_to_cpu(dip->di_atime.tv_sec); | 3112 | ip->i_atime.tv_sec = le32_to_cpu(dip->di_atime.tv_sec); |
| 3087 | ip->i_atime.tv_nsec = le32_to_cpu(dip->di_atime.tv_nsec); | 3113 | ip->i_atime.tv_nsec = le32_to_cpu(dip->di_atime.tv_nsec); |
| @@ -3132,21 +3158,33 @@ static int copy_from_dinode(struct dinode * dip, struct inode *ip) | |||
| 3132 | static void copy_to_dinode(struct dinode * dip, struct inode *ip) | 3158 | static void copy_to_dinode(struct dinode * dip, struct inode *ip) |
| 3133 | { | 3159 | { |
| 3134 | struct jfs_inode_info *jfs_ip = JFS_IP(ip); | 3160 | struct jfs_inode_info *jfs_ip = JFS_IP(ip); |
| 3161 | struct jfs_sb_info *sbi = JFS_SBI(ip->i_sb); | ||
| 3135 | 3162 | ||
| 3136 | dip->di_fileset = cpu_to_le32(jfs_ip->fileset); | 3163 | dip->di_fileset = cpu_to_le32(jfs_ip->fileset); |
| 3137 | dip->di_inostamp = cpu_to_le32(JFS_SBI(ip->i_sb)->inostamp); | 3164 | dip->di_inostamp = cpu_to_le32(sbi->inostamp); |
| 3138 | dip->di_number = cpu_to_le32(ip->i_ino); | 3165 | dip->di_number = cpu_to_le32(ip->i_ino); |
| 3139 | dip->di_gen = cpu_to_le32(ip->i_generation); | 3166 | dip->di_gen = cpu_to_le32(ip->i_generation); |
| 3140 | dip->di_size = cpu_to_le64(ip->i_size); | 3167 | dip->di_size = cpu_to_le64(ip->i_size); |
| 3141 | dip->di_nblocks = cpu_to_le64(PBLK2LBLK(ip->i_sb, ip->i_blocks)); | 3168 | dip->di_nblocks = cpu_to_le64(PBLK2LBLK(ip->i_sb, ip->i_blocks)); |
| 3142 | dip->di_nlink = cpu_to_le32(ip->i_nlink); | 3169 | dip->di_nlink = cpu_to_le32(ip->i_nlink); |
| 3143 | dip->di_uid = cpu_to_le32(ip->i_uid); | 3170 | if (sbi->uid == -1) |
| 3144 | dip->di_gid = cpu_to_le32(ip->i_gid); | 3171 | dip->di_uid = cpu_to_le32(ip->i_uid); |
| 3172 | else | ||
| 3173 | dip->di_uid = cpu_to_le32(jfs_ip->saved_uid); | ||
| 3174 | if (sbi->gid == -1) | ||
| 3175 | dip->di_gid = cpu_to_le32(ip->i_gid); | ||
| 3176 | else | ||
| 3177 | dip->di_gid = cpu_to_le32(jfs_ip->saved_gid); | ||
| 3145 | /* | 3178 | /* |
| 3146 | * mode2 is only needed for storing the higher order bits. | 3179 | * mode2 is only needed for storing the higher order bits. |
| 3147 | * Trust i_mode for the lower order ones | 3180 | * Trust i_mode for the lower order ones |
| 3148 | */ | 3181 | */ |
| 3149 | dip->di_mode = cpu_to_le32((jfs_ip->mode2 & 0xffff0000) | ip->i_mode); | 3182 | if (sbi->umask == -1) |
| 3183 | dip->di_mode = cpu_to_le32((jfs_ip->mode2 & 0xffff0000) | | ||
| 3184 | ip->i_mode); | ||
| 3185 | else /* Leave the original permissions alone */ | ||
| 3186 | dip->di_mode = cpu_to_le32(jfs_ip->mode2); | ||
| 3187 | |||
| 3150 | dip->di_atime.tv_sec = cpu_to_le32(ip->i_atime.tv_sec); | 3188 | dip->di_atime.tv_sec = cpu_to_le32(ip->i_atime.tv_sec); |
| 3151 | dip->di_atime.tv_nsec = cpu_to_le32(ip->i_atime.tv_nsec); | 3189 | dip->di_atime.tv_nsec = cpu_to_le32(ip->i_atime.tv_nsec); |
| 3152 | dip->di_ctime.tv_sec = cpu_to_le32(ip->i_ctime.tv_sec); | 3190 | dip->di_ctime.tv_sec = cpu_to_le32(ip->i_ctime.tv_sec); |
