sb = &mbuf.m_sb;
libxfs_sb_from_disk(sb, XFS_BUF_TO_SBP(sbp));
- mp = libxfs_mount(&mbuf, sb, xargs.ddev, xargs.logdev, xargs.rtdev, 1);
+ mp = libxfs_mount(&mbuf, sb, xargs.ddev, xargs.logdev, xargs.rtdev, 0);
if (mp == NULL) {
do_log(_("%s: %s filesystem failed to initialize\n"
"%s: Aborting.\n"), progname, source_name, progname);
}
mp = libxfs_mount(&xmount, sbp, x.ddev, x.logdev, x.rtdev,
- LIBXFS_MOUNT_ROOTINOS | LIBXFS_MOUNT_DEBUGGER);
+ LIBXFS_MOUNT_DEBUGGER);
if (!mp) {
- mp = libxfs_mount(&xmount, sbp, x.ddev, x.logdev, x.rtdev,
- LIBXFS_MOUNT_DEBUGGER);
- if (!mp) {
- fprintf(stderr, _("%s: device %s unusable (not an XFS "
- "filesystem?)\n"), progname, fsdevice);
- exit(1);
- }
+ fprintf(stderr,
+ _("%s: device %s unusable (not an XFS filesystem?)\n"),
+ progname, fsdevice);
+ exit(1);
}
blkbb = 1 << mp->m_blkbb_log;
+ /*
+ * xfs_check needs corrected incore superblock values
+ */
+ if (sbp->sb_rootino != NULLFSINO &&
+ xfs_sb_version_haslazysbcount(&mp->m_sb)) {
+ int error = xfs_initialize_perag_data(mp, sbp->sb_agcount);
+ if (error) {
+ fprintf(stderr,
+ _("%s: cannot init perag data (%d). Continuing anyway.\n"),
+ progname, error);
+ }
+ }
+
if (xfs_sb_version_hascrc(&mp->m_sb))
type_set_tab_crc();
uint m_rsumsize; /* size of rt summary, bytes */
struct xfs_inode *m_rbmip; /* pointer to bitmap inode */
struct xfs_inode *m_rsumip; /* pointer to summary inode */
- struct xfs_inode *m_rootip; /* pointer to root directory */
struct xfs_buftarg *m_ddev_targp;
struct xfs_buftarg *m_logdev_targp;
struct xfs_buftarg *m_rtdev_targp;
int pagb_count; /* pagb slots in use */
} xfs_perag_t;
-#define LIBXFS_MOUNT_ROOTINOS 0x0001
-#define LIBXFS_MOUNT_DEBUGGER 0x0002
-#define LIBXFS_MOUNT_32BITINODES 0x0004
-#define LIBXFS_MOUNT_32BITINOOPT 0x0008
-#define LIBXFS_MOUNT_COMPAT_ATTR 0x0010
-#define LIBXFS_MOUNT_ATTR2 0x0020
+#define LIBXFS_MOUNT_DEBUGGER 0x0001
+#define LIBXFS_MOUNT_32BITINODES 0x0002
+#define LIBXFS_MOUNT_32BITINOOPT 0x0004
+#define LIBXFS_MOUNT_COMPAT_ATTR 0x0008
+#define LIBXFS_MOUNT_ATTR2 0x0010
#define LIBXFS_IHASHSIZE(sbp) (1<<10)
#define LIBXFS_BHASHSIZE(sbp) (1<<10)
xfs_dir_startup();
}
-/*
- * Get the bitmap and summary inodes into the mount structure
- * at mount time.
- */
-static int
-rtmount_inodes(xfs_mount_t *mp)
-{
- int error;
- xfs_sb_t *sbp;
-
- sbp = &mp->m_sb;
- if (sbp->sb_rbmino == NULLFSINO)
- return 0;
- error = libxfs_iget(mp, NULL, sbp->sb_rbmino, 0, &mp->m_rbmip, 0);
- if (error) {
- fprintf(stderr,
- _("%s: cannot read realtime bitmap inode (%d)\n"),
- progname, error);
- return error;
- }
- ASSERT(mp->m_rbmip != NULL);
- ASSERT(sbp->sb_rsumino != NULLFSINO);
- error = libxfs_iget(mp, NULL, sbp->sb_rsumino, 0, &mp->m_rsumip, 0);
- if (error) {
- libxfs_iput(mp->m_rbmip, 0);
- fprintf(stderr,
- _("%s: cannot read realtime summary inode (%d)\n"),
- progname, error);
- return error;
- }
- ASSERT(mp->m_rsumip != NULL);
- return 0;
-}
-
/*
* Initialize realtime fields in the mount structure.
*/
exit(1);
}
- /*
- * mkfs calls mount before the root inode is allocated.
- */
- if ((flags & LIBXFS_MOUNT_ROOTINOS) && sbp->sb_rootino != NULLFSINO) {
- error = libxfs_iget(mp, NULL, sbp->sb_rootino, 0,
- &mp->m_rootip, 0);
- if (error) {
- fprintf(stderr, _("%s: cannot read root inode (%d)\n"),
- progname, error);
- if (!(flags & LIBXFS_MOUNT_DEBUGGER))
- return NULL;
- }
- ASSERT(mp->m_rootip != NULL);
- }
- if ((flags & LIBXFS_MOUNT_ROOTINOS) && rtmount_inodes(mp)) {
- if (mp->m_rootip)
- libxfs_iput(mp->m_rootip, 0);
- return NULL;
- }
-
- /*
- * mkfs calls mount before the AGF/AGI structures are written.
- */
- if ((flags & LIBXFS_MOUNT_ROOTINOS) && sbp->sb_rootino != NULLFSINO &&
- xfs_sb_version_haslazysbcount(&mp->m_sb)) {
- error = xfs_initialize_perag_data(mp, sbp->sb_agcount);
- if (error) {
- fprintf(stderr, _("%s: cannot init perag data (%d)\n"),
- progname, error);
- return NULL;
- }
- }
-
return mp;
}
pip = ip;
mp->m_sb.sb_rootino = ip->i_ino;
libxfs_mod_sb(tp, XFS_SB_ROOTINO);
- mp->m_rootip = ip;
isroot = 1;
} else {
libxfs_trans_ijoin(tp, pip, 0);
memset(XFS_BUF_PTR(buf), 0, sectorsize);
libxfs_sb_to_disk((void *)XFS_BUF_PTR(buf), sbp, XFS_SB_ALL_BITS);
libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE);
+ libxfs_purgebuf(buf);
/*
* If the data area is a file, then grow it out to its final size
(xfs_extlen_t)XFS_FSB_TO_BB(mp, logblocks),
&sbp->sb_uuid, logversion, lsunit, XLOG_FMT);
- mp = libxfs_mount(mp, sbp, xi.ddev, xi.logdev, xi.rtdev, 1);
+ mp = libxfs_mount(mp, sbp, xi.ddev, xi.logdev, xi.rtdev, 0);
if (mp == NULL) {
fprintf(stderr, _("%s: filesystem failed to initialize\n"),
progname);
/*
* Allocate the root inode and anything else in the proto file.
*/
- mp->m_rootip = NULL;
parse_proto(mp, &fsx, &protostring);
/*
ip->i_df.if_bytes = ip->i_df.if_real_bytes = 0;
ip->i_df.if_u1.if_extents = NULL;
- mp->m_rootip = ip;
-
/*
* initialize the directory
*/