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 /* initialize fileset inode allocation map */ in jfs_mount()
176 if ((rc = diMount(ipimap))) { in jfs_mount()
177 jfs_err("jfs_mount: diMount failed w/rc = %d", rc); in jfs_mount()
181 /* map further access of per fileset inodes by the fileset inode */ in jfs_mount()
182 sbi->ipimap = ipimap; 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()
238 IWRITE_LOCK(sbi->ipimap, RDWRLOCK_IMAP); in jfs_mount_rw()
239 diUnmount(sbi->ipimap, 1); in jfs_mount_rw()
240 if ((rc = diMount(sbi->ipimap))) { in jfs_mount_rw()
241 IWRITE_UNLOCK(sbi->ipimap); in jfs_mount_rw()
243 return rc; in jfs_mount_rw()
245 IWRITE_UNLOCK(sbi->ipimap); in jfs_mount_rw()
247 dbUnmount(sbi->ipbmap, 1); in jfs_mount_rw()
248 if ((rc = dbMount(sbi->ipbmap))) { in jfs_mount_rw()
250 return rc; in jfs_mount_rw()
257 if ((rc = lmLogOpen(sb))) in jfs_mount_rw()
258 return rc; in jfs_mount_rw()
263 if ((rc = updateSuper(sb, FM_MOUNT))) { in jfs_mount_rw()
264 jfs_err("jfs_mount: updateSuper failed w/rc = %d", rc); in jfs_mount_rw()
266 return rc; in jfs_mount_rw()
274 return rc; in jfs_mount_rw()
289 int rc = 0; in chkSuper() local
299 if ((rc = readSuper(sb, &bh))) in chkSuper()
300 return rc; in chkSuper()
301 j_sb = (struct jfs_superblock *)bh->b_data; in chkSuper()
307 if (strncmp(j_sb->s_magic, JFS_MAGIC, 4) || in chkSuper()
308 le32_to_cpu(j_sb->s_version) > JFS_VERSION) { in chkSuper()
309 rc = -EINVAL; in chkSuper()
313 bsize = le32_to_cpu(j_sb->s_bsize); in chkSuper()
316 rc = -EINVAL; in chkSuper()
321 le32_to_cpu(j_sb->s_flag), le32_to_cpu(j_sb->s_state), in chkSuper()
322 (unsigned long long) le64_to_cpu(j_sb->s_size)); in chkSuper()
325 if ((j_sb->s_flag & cpu_to_le32(JFS_BAD_SAIT)) != in chkSuper()
328 AIM_bytesize = lengthPXD(&(j_sb->s_aim2)) * bsize; in chkSuper()
330 AIT_bytesize = lengthPXD(&(j_sb->s_ait2)) * bsize; in chkSuper()
331 AIM_byte_addr = addressPXD(&(j_sb->s_aim2)) * bsize; in chkSuper()
332 AIT_byte_addr = addressPXD(&(j_sb->s_ait2)) * bsize; in chkSuper()
333 byte_addr_diff0 = AIT_byte_addr - AIM_byte_addr; in chkSuper()
334 fsckwsp_addr = addressPXD(&(j_sb->s_fsckpxd)) * bsize; in chkSuper()
335 byte_addr_diff1 = fsckwsp_addr - AIT_byte_addr; in chkSuper()
340 j_sb->s_flag |= cpu_to_le32(JFS_BAD_SAIT); in chkSuper()
343 if ((j_sb->s_flag & cpu_to_le32(JFS_GROUPCOMMIT)) != in chkSuper()
345 j_sb->s_flag |= cpu_to_le32(JFS_GROUPCOMMIT); in chkSuper()
348 if (j_sb->s_state != cpu_to_le32(FM_CLEAN) && in chkSuper()
351 rc = -EINVAL; in chkSuper()
355 sbi->state = le32_to_cpu(j_sb->s_state); in chkSuper()
356 sbi->mntflag = le32_to_cpu(j_sb->s_flag); in chkSuper()
362 sbi->bsize = bsize; in chkSuper()
363 sbi->l2bsize = le16_to_cpu(j_sb->s_l2bsize); in chkSuper()
366 if (sbi->l2bsize != ilog2((u32)bsize) || in chkSuper()
367 j_sb->pad != 0 || in chkSuper()
368 le32_to_cpu(j_sb->s_state) > FM_STATE_MAX) { in chkSuper()
369 rc = -EINVAL; in chkSuper()
378 sbi->nbperpage = PSIZE >> sbi->l2bsize; in chkSuper()
379 sbi->l2nbperpage = L2PSIZE - sbi->l2bsize; in chkSuper()
380 sbi->l2niperblk = sbi->l2bsize - L2DISIZE; in chkSuper()
381 if (sbi->mntflag & JFS_INLINELOG) in chkSuper()
382 sbi->logpxd = j_sb->s_logpxd; in chkSuper()
384 sbi->logdev = new_decode_dev(le32_to_cpu(j_sb->s_logdev)); in chkSuper()
385 uuid_copy(&sbi->uuid, &j_sb->s_uuid); in chkSuper()
386 uuid_copy(&sbi->loguuid, &j_sb->s_loguuid); in chkSuper()
388 sbi->fsckpxd = j_sb->s_fsckpxd; in chkSuper()
389 sbi->ait2 = j_sb->s_ait2; in chkSuper()
393 return rc; in chkSuper()
400 * update synchronously superblock if it is mounted read-write.
407 int rc; in updateSuper() local
409 if (sbi->flag & JFS_NOINTEGRITY) { in updateSuper()
411 sbi->p_state = state; in updateSuper()
414 sbi->p_state = sbi->state; in updateSuper()
417 state = sbi->p_state; in updateSuper()
420 } else if (sbi->state == FM_DIRTY) in updateSuper()
423 if ((rc = readSuper(sb, &bh))) in updateSuper()
424 return rc; in updateSuper()
426 j_sb = (struct jfs_superblock *)bh->b_data; in updateSuper()
428 j_sb->s_state = cpu_to_le32(state); in updateSuper()
429 sbi->state = state; in updateSuper()
433 j_sb->s_logdev = cpu_to_le32( in updateSuper()
434 new_encode_dev(sbi->log->bdev_handle->bdev->bd_dev)); in updateSuper()
435 j_sb->s_logserial = cpu_to_le32(sbi->log->serial); in updateSuper()
441 if (j_sb->s_flag & cpu_to_le32(JFS_DASD_ENABLED)) in updateSuper()
442 j_sb->s_flag |= cpu_to_le32(JFS_DASD_PRIME); in updateSuper()
461 *bpp = sb_bread(sb, SUPER1_OFF >> sb->s_blocksize_bits); in readSuper()
466 *bpp = sb_bread(sb, SUPER2_OFF >> sb->s_blocksize_bits); in readSuper()
470 return -EIO; in readSuper()
486 * to update block allocation map at aggregate level.
490 struct jfs_log *log = JFS_SBI(sb)->log; in logMOUNT()
497 lrd.aggregate = cpu_to_le32(new_encode_dev(sb->s_bdev->bd_dev)); in logMOUNT()