Lines Matching +full:rc +full:- +full:map +full:- +full:name
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (C) International Business Machines Corp., 2000-2004
18 * allocation map inode" (aka fileset inode):
21 * allocation map inode" (aka aggregate inode) where each inode
23 * on-disk inode in uniform way at both aggregate and fileset level;
33 * mntvfs -> fileset ipimap+ -> aggregate ipbmap -> aggregate ipaimap;
34 * fileset vfs -> vp(1) <-> ... <-> vp(n) <->vproot;
58 * NAME: jfs_mount(sb)
62 * PARAMETER: sb - super block
64 * RETURN: -EBUSY - device already mounted or open for write
65 * -EBUSY - cvrdvp already mounted;
66 * -EBUSY - mount table full
67 * -ENOTDIR- cvrdvp not directory on a device mount
68 * -ENXIO - device open failure
72 int rc = 0; /* Return code */ in jfs_mount() local
83 if ((rc = chkSuper(sb))) { in jfs_mount()
90 rc = -EIO; in jfs_mount()
93 sbi->ipaimap = ipaimap; in jfs_mount()
98 * initialize aggregate inode allocation map in jfs_mount()
100 if ((rc = diMount(ipaimap))) { in jfs_mount()
101 jfs_err("jfs_mount: diMount(ipaimap) failed w/rc = %d", rc); in jfs_mount()
106 * open aggregate block allocation map in jfs_mount()
110 rc = -EIO; in jfs_mount()
116 sbi->ipbmap = ipbmap; in jfs_mount()
119 * initialize aggregate block allocation map in jfs_mount()
121 if ((rc = dbMount(ipbmap))) { in jfs_mount()
122 jfs_err("jfs_mount: dbMount failed w/rc = %d", rc); in jfs_mount()
127 * open the secondary aggregate inode allocation map in jfs_mount()
129 * This is a duplicate of the aggregate inode allocation map. in jfs_mount()
137 if ((sbi->mntflag & JFS_BAD_SAIT) == 0) { in jfs_mount()
141 rc = -EIO; in jfs_mount()
144 sbi->ipaimap2 = ipaimap2; in jfs_mount()
149 * initialize secondary aggregate inode allocation map in jfs_mount()
151 if ((rc = diMount(ipaimap2))) { in jfs_mount()
152 jfs_err("jfs_mount: diMount(ipaimap2) failed, rc = %d", in jfs_mount()
153 rc); in jfs_mount()
158 sbi->ipaimap2 = NULL; in jfs_mount()
164 * open fileset inode allocation map (aka fileset inode) in jfs_mount()
169 /* open fileset secondary inode allocation map */ in jfs_mount()
170 rc = -EIO; in jfs_mount()
175 /* map further access of per fileset inodes by the fileset inode */ in jfs_mount()
176 sbi->ipimap = ipimap; in jfs_mount()
178 /* initialize fileset inode allocation map */ in jfs_mount()
179 if ((rc = diMount(ipimap))) { in jfs_mount()
180 jfs_err("jfs_mount: diMount failed w/rc = %d", rc); in jfs_mount()
184 return rc; in jfs_mount()
190 /* close fileset inode allocation map inode */ in jfs_mount()
193 /* close secondary aggregate inode allocation map */ in jfs_mount()
200 err_umount_ipbmap: /* close aggregate block allocation map */ in jfs_mount()
204 err_umount_ipaimap: /* close aggregate inode allocation map */ in jfs_mount()
209 if (rc) in jfs_mount()
210 jfs_err("Mount JFS Failure: %d", rc); in jfs_mount()
212 return rc; in jfs_mount()
216 * NAME: jfs_mount_rw(sb, remount)
218 * FUNCTION: Completes read-write mount, or remounts read-only volume
219 * as read-write
224 int rc; in jfs_mount_rw() local
227 * If we are re-mounting a previously read-only volume, we want to in jfs_mount_rw()
228 * re-read the inode and block maps, since fsck.jfs may have updated in jfs_mount_rw()
232 if (chkSuper(sb) || (sbi->state != FM_CLEAN)) in jfs_mount_rw()
233 return -EINVAL; in jfs_mount_rw()
235 truncate_inode_pages(sbi->ipimap->i_mapping, 0); in jfs_mount_rw()
236 truncate_inode_pages(sbi->ipbmap->i_mapping, 0); in jfs_mount_rw()
237 diUnmount(sbi->ipimap, 1); in jfs_mount_rw()
238 if ((rc = diMount(sbi->ipimap))) { in jfs_mount_rw()
240 return rc; in jfs_mount_rw()
243 dbUnmount(sbi->ipbmap, 1); in jfs_mount_rw()
244 if ((rc = dbMount(sbi->ipbmap))) { in jfs_mount_rw()
246 return rc; in jfs_mount_rw()
253 if ((rc = lmLogOpen(sb))) in jfs_mount_rw()
254 return rc; in jfs_mount_rw()
259 if ((rc = updateSuper(sb, FM_MOUNT))) { in jfs_mount_rw()
260 jfs_err("jfs_mount: updateSuper failed w/rc = %d", rc); in jfs_mount_rw()
262 return rc; in jfs_mount_rw()
270 return rc; in jfs_mount_rw()
285 int rc = 0; in chkSuper() local
295 if ((rc = readSuper(sb, &bh))) in chkSuper()
296 return rc; in chkSuper()
297 j_sb = (struct jfs_superblock *)bh->b_data; in chkSuper()
303 if (strncmp(j_sb->s_magic, JFS_MAGIC, 4) || in chkSuper()
304 le32_to_cpu(j_sb->s_version) > JFS_VERSION) { in chkSuper()
305 rc = -EINVAL; in chkSuper()
309 bsize = le32_to_cpu(j_sb->s_bsize); in chkSuper()
312 rc = -EINVAL; in chkSuper()
317 le32_to_cpu(j_sb->s_flag), le32_to_cpu(j_sb->s_state), in chkSuper()
318 (unsigned long long) le64_to_cpu(j_sb->s_size)); in chkSuper()
321 if ((j_sb->s_flag & cpu_to_le32(JFS_BAD_SAIT)) != in chkSuper()
324 AIM_bytesize = lengthPXD(&(j_sb->s_aim2)) * bsize; in chkSuper()
326 AIT_bytesize = lengthPXD(&(j_sb->s_ait2)) * bsize; in chkSuper()
327 AIM_byte_addr = addressPXD(&(j_sb->s_aim2)) * bsize; in chkSuper()
328 AIT_byte_addr = addressPXD(&(j_sb->s_ait2)) * bsize; in chkSuper()
329 byte_addr_diff0 = AIT_byte_addr - AIM_byte_addr; in chkSuper()
330 fsckwsp_addr = addressPXD(&(j_sb->s_fsckpxd)) * bsize; in chkSuper()
331 byte_addr_diff1 = fsckwsp_addr - AIT_byte_addr; in chkSuper()
336 j_sb->s_flag |= cpu_to_le32(JFS_BAD_SAIT); in chkSuper()
339 if ((j_sb->s_flag & cpu_to_le32(JFS_GROUPCOMMIT)) != in chkSuper()
341 j_sb->s_flag |= cpu_to_le32(JFS_GROUPCOMMIT); in chkSuper()
344 if (j_sb->s_state != cpu_to_le32(FM_CLEAN) && in chkSuper()
347 rc = -EINVAL; in chkSuper()
351 sbi->state = le32_to_cpu(j_sb->s_state); in chkSuper()
352 sbi->mntflag = le32_to_cpu(j_sb->s_flag); in chkSuper()
358 sbi->bsize = bsize; in chkSuper()
359 sbi->l2bsize = le16_to_cpu(j_sb->s_l2bsize); in chkSuper()
362 if (sbi->l2bsize != ilog2((u32)bsize) || in chkSuper()
363 j_sb->pad != 0 || in chkSuper()
364 le32_to_cpu(j_sb->s_state) > FM_STATE_MAX) { in chkSuper()
365 rc = -EINVAL; in chkSuper()
374 sbi->nbperpage = PSIZE >> sbi->l2bsize; in chkSuper()
375 sbi->l2nbperpage = L2PSIZE - sbi->l2bsize; in chkSuper()
376 sbi->l2niperblk = sbi->l2bsize - L2DISIZE; in chkSuper()
377 if (sbi->mntflag & JFS_INLINELOG) in chkSuper()
378 sbi->logpxd = j_sb->s_logpxd; in chkSuper()
380 sbi->logdev = new_decode_dev(le32_to_cpu(j_sb->s_logdev)); in chkSuper()
381 uuid_copy(&sbi->uuid, &j_sb->s_uuid); in chkSuper()
382 uuid_copy(&sbi->loguuid, &j_sb->s_loguuid); in chkSuper()
384 sbi->fsckpxd = j_sb->s_fsckpxd; in chkSuper()
385 sbi->ait2 = j_sb->s_ait2; in chkSuper()
389 return rc; in chkSuper()
396 * update synchronously superblock if it is mounted read-write.
403 int rc; in updateSuper() local
405 if (sbi->flag & JFS_NOINTEGRITY) { in updateSuper()
407 sbi->p_state = state; in updateSuper()
410 sbi->p_state = sbi->state; in updateSuper()
413 state = sbi->p_state; in updateSuper()
416 } else if (sbi->state == FM_DIRTY) in updateSuper()
419 if ((rc = readSuper(sb, &bh))) in updateSuper()
420 return rc; in updateSuper()
422 j_sb = (struct jfs_superblock *)bh->b_data; in updateSuper()
424 j_sb->s_state = cpu_to_le32(state); in updateSuper()
425 sbi->state = state; in updateSuper()
429 j_sb->s_logdev = cpu_to_le32(new_encode_dev(sbi->log->bdev->bd_dev)); in updateSuper()
430 j_sb->s_logserial = cpu_to_le32(sbi->log->serial); in updateSuper()
436 if (j_sb->s_flag & cpu_to_le32(JFS_DASD_ENABLED)) in updateSuper()
437 j_sb->s_flag |= cpu_to_le32(JFS_DASD_PRIME); in updateSuper()
456 *bpp = sb_bread(sb, SUPER1_OFF >> sb->s_blocksize_bits); in readSuper()
461 *bpp = sb_bread(sb, SUPER2_OFF >> sb->s_blocksize_bits); in readSuper()
465 return -EIO; in readSuper()
481 * to update block allocation map at aggregate level.
485 struct jfs_log *log = JFS_SBI(sb)->log; in logMOUNT()
492 lrd.aggregate = cpu_to_le32(new_encode_dev(sb->s_bdev->bd_dev)); in logMOUNT()