⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fsckbmap.c

📁 jfs 源码
💻 C
📖 第 1 页 / 共 4 页
字号:
					    dmap_1stblk;					/*					 * note that there is always AT MOST a single L2 page					 */					bmap_recptr->L1pg_idx++;				}			}		}	}	/*	 * finish up the partial pages	 */	if (rbam_rc == FSCK_OK) {		if (bmap_recptr->dmappg_idx != 0) {			/* there's a partial L0 page */			for (leafidx = bmap_recptr->dmappg_idx;			     (leafidx <= MAXIDX); leafidx++) {				bmap_recptr->L0_wsp_sleafs[leafidx] = -1;			}			rbam_rc = Ln_tree_rebuild(0, bmap_recptr->L0pg_1stblk,						  &(bmap_recptr->L0_bufptr),						  &sumtree_root_data);			if (rbam_rc == FSCK_OK) {				/*				 * the data in the L0 summary tree root goes into				 * a leaf of the current L1 page				 */				bmap_recptr->L1_wsp_sleafs[bmap_recptr->							   L0pg_idx] =				    sumtree_root_data;				bmap_recptr->L0pg_idx++;			}		}	}	if (rbam_rc == FSCK_OK) {		if ((bmap_recptr->L1pg_count > 0) && (bmap_recptr->L0pg_idx != 0)) {			/* there's enough data for an L1 level, and there's a partial L1 page */			for (leafidx = bmap_recptr->L0pg_idx;			     (leafidx <= MAXIDX); leafidx++) {				bmap_recptr->L1_wsp_sleafs[leafidx] = -1;			}			rbam_rc = Ln_tree_rebuild(1, bmap_recptr->L1pg_1stblk,						  &(bmap_recptr->L1_bufptr),						  &sumtree_root_data);			if (rbam_rc == FSCK_OK) {				/*				 * the data in the L0 summary tree root goes into				 * a leaf of the current L1 page				 */				bmap_recptr->L2_wsp_sleafs[bmap_recptr->							   L1pg_idx] =				    sumtree_root_data;				bmap_recptr->L1pg_idx++;			}		}	}	if (rbam_rc == FSCK_OK) {		if ((bmap_recptr->L2pg_count > 0) && (bmap_recptr->L1pg_idx != 0)) {			/* there's enough data for an L2 level, and there's a partial L2 page */			for (leafidx = bmap_recptr->L1pg_idx;			     (leafidx <= MAXIDX); leafidx++) {				bmap_recptr->L2_wsp_sleafs[leafidx] = -1;			}			rbam_rc = Ln_tree_rebuild(2, bmap_recptr->L2pg_1stblk,						  &(bmap_recptr->L2_bufptr),						  &sumtree_root_data);		}	}	/*	 * Now go verify the Block Allocation Map Control page	 */	if (rbam_rc == FSCK_OK) {		rbam_rc = ctlpage_rebuild(sumtree_root_data);	}	return (rbam_rc);}/***************************************************************************** * NAME: stree_rebuild * * FUNCTION:  Rebuild the specified summary tree. * * PARAMETERS: *      prms_ptr   - input - pointer to a data area describing the tree *                           to rebuild and containing the dmap which the *                           tree summarizes. *      root_data  - input - pointer to a variable in which to return the *                           data value stored in the root node of the tree * * RETURNS: *      success: FSCK_OK *      failure: something else */int stree_rebuild(struct fsck_stree_proc_parms *prms_ptr, int8_t * root_data){	int bsr_rc = FSCK_OK;	uint32_t node_idx, last_leaf_idx;	/*	 * copy the leaf data into the buffer	 */	last_leaf_idx = prms_ptr->leafidx + prms_ptr->nleafs - 1;	for (node_idx = prms_ptr->leafidx; (node_idx <= last_leaf_idx);	     node_idx++) {		prms_ptr->buf_stree[node_idx] = prms_ptr->wsp_stree[node_idx];	}	/*	 * build the summary tree from the "raw" leaf values	 */	*root_data =	    ujfs_adjtree(prms_ptr->buf_stree, prms_ptr->l2nleafs,			 prms_ptr->budmin);	return (bsr_rc);}/***************************************************************************** * NAME: stree_verify * * FUNCTION:  Verify the specified summary tree. * * PARAMETERS: *      prms_ptr   - input - pointer to a data area describing the tree *                           to verify and containing the dmap which the *                           tree summarizes. *      root_data  - input - pointer to a variable in which to return the *                           data value which should be in the root node *                           of the tree (and may in fact be in the root *                           node of the tree) * * RETURNS: *      success: FSCK_OK *      failure: something else */int stree_verify(struct fsck_stree_proc_parms *prms_ptr, int8_t * root_data){	int bsv_rc = FSCK_OK;	uint32_t node_idx, last_leaf_idx;	/*	 * build the summary tree from the "raw" leaf values	 */	*root_data =	    ujfs_adjtree(prms_ptr->wsp_stree, prms_ptr->l2nleafs,			 prms_ptr->budmin);	/*	 * Now see if the tree in the buffer matches the one we just	 * built in the workspace.	 *	 * We distinguish between incorrect internal nodes and incorrect	 * leaf nodes because they can be symptoms of different problems.	 */	for (node_idx = 0; (node_idx < prms_ptr->leafidx); node_idx++) {		if (prms_ptr->buf_stree[node_idx] != prms_ptr->wsp_stree[node_idx]) {			/* they don't match! */			*(prms_ptr->intval_error) = -1;			fsck_send_msg(fsck_BMAPBADLNV, node_idx, fsck_ref_msg(prms_ptr->page_level),				      prms_ptr->page_ordno);		}	}	last_leaf_idx = prms_ptr->leafidx + prms_ptr->nleafs - 1;	for (node_idx = prms_ptr->leafidx; (node_idx <= last_leaf_idx);	     node_idx++) {		if (prms_ptr->buf_stree[node_idx] != prms_ptr->wsp_stree[node_idx]) {			/* they don't match! */			*(prms_ptr->lfval_error) = -1;			fsck_send_msg(fsck_BMAPBADLFV, node_idx, fsck_ref_msg(prms_ptr->page_level),				      prms_ptr->page_ordno);		}	}	return (bsv_rc);}/***************************************************************************** * NAME: verify_blkall_map * * FUNCTION:  Validate the JFS Aggregate Block Map for the aggregate. * * PARAMETERS:  none * * RETURNS: *      success: FSCK_OK *      failure: something else */int verify_blkall_map(){	int vbam_rc = FSCK_OK;	int8_t sumtree_root_data;	uint32_t leafidx;#define MAXIDX (LPERCTL - 1)	vbam_rc = init_bmap_info();	/*	 * since the dmap I/O buffer is really the same storage as the	 * IAG I/O buffer, flush out any pending writes that may remain	 * from IAG processing.	 */	vbam_rc = iags_flush();	/*	 * Verify the dmap pages.  Verify each L0 and L1 page	 * if and when the information for is complete.	 */	while ((vbam_rc == FSCK_OK)	       && (bmap_recptr->dmappg_ordno < bmap_recptr->dmappg_count)) {		vbam_rc = dmappg_verify(&sumtree_root_data);		if (vbam_rc != FSCK_OK)			continue;					/*		 * the data in the dmap summary tree root goes into a leaf of		 * the current L0 page		 */		bmap_recptr->L0_wsp_sleafs[bmap_recptr->dmappg_idx] =		    sumtree_root_data;		/* move to next dmap page */		bmap_recptr->dmappg_ordno++;		bmap_recptr->dmap_1stblk += BPERDMAP;                if (bmap_recptr->dmappg_idx < MAXIDX) {			/* still gathering info about this L0 page */			bmap_recptr->dmappg_idx++;			continue;					}		/* we have all the info needed for the current L0 page */		bmap_recptr->dmappg_idx = 0;		vbam_rc = Ln_tree_verify(0, bmap_recptr->L0pg_1stblk,					 &(bmap_recptr->L0_bufptr),					 &sumtree_root_data);		if (vbam_rc != FSCK_OK)			continue;					/*		 * the data in the L0 summary tree root goes into		 * a leaf of the current L1 page		 */		bmap_recptr->L1_wsp_sleafs[bmap_recptr->L0pg_idx] =		    sumtree_root_data;		/* move to the next L0 page */		bmap_recptr->L0pg_ordno++;		bmap_recptr->L0pg_1stblk = bmap_recptr->dmap_1stblk;		if (bmap_recptr->L0pg_idx < MAXIDX) {			/* still gathering info about this L1 page */			bmap_recptr->L0pg_idx++;			continue;		}		/* we have all the info needed for the current L1 page */		bmap_recptr->L0pg_idx = 0;		vbam_rc = Ln_tree_verify(1, bmap_recptr->L1pg_1stblk,					 &(bmap_recptr->L1_bufptr),					 &sumtree_root_data);		if (vbam_rc == FSCK_OK) {			/*			 * the data in the L1 summary tree root goes into			 * a leaf of the current L2 page			 */			bmap_recptr->L2_wsp_sleafs[bmap_recptr->L1pg_idx] =			    sumtree_root_data;			/* move to the next L1 page */			bmap_recptr->L1pg_ordno++;			bmap_recptr->L1pg_1stblk = bmap_recptr->dmap_1stblk;			/*			 * note that there is always AT MOST a single L2 page			 */			bmap_recptr->L1pg_idx++;		}	}	/*	 * finish up the partial pages	 */	if (vbam_rc == FSCK_OK) {		if (bmap_recptr->dmappg_idx != 0) {			/* there's a partial L0 page */			for (leafidx = bmap_recptr->dmappg_idx;			     (leafidx <= MAXIDX); leafidx++) {				bmap_recptr->L0_wsp_sleafs[leafidx] = -1;			}			vbam_rc = Ln_tree_verify(0, bmap_recptr->L0pg_1stblk,						 &(bmap_recptr->L0_bufptr),						 &sumtree_root_data);			if (vbam_rc == FSCK_OK) {				/*				 * the data in the L0 summary tree root goes into				 * a leaf of the current L1 page				 */				bmap_recptr->L1_wsp_sleafs[bmap_recptr->							   L0pg_idx] =				    sumtree_root_data;				bmap_recptr->L0pg_idx++;			}		}	}	if (vbam_rc == FSCK_OK) {		if ((bmap_recptr->L1pg_count > 0) && (bmap_recptr->L0pg_idx != 0)) {			/* there's enough data for an L1 level, and there's a partial L1 page */			for (leafidx = bmap_recptr->L0pg_idx;			     (leafidx <= MAXIDX); leafidx++) {				bmap_recptr->L1_wsp_sleafs[leafidx] = -1;			}	/* end for leafidx */			vbam_rc = Ln_tree_verify(1, bmap_recptr->L1pg_1stblk,						 &(bmap_recptr->L1_bufptr),						 &sumtree_root_data);			if (vbam_rc == FSCK_OK) {				/*				 * the data in the L0 summary tree root goes into				 * a leaf of the current L1 page				 */				bmap_recptr->L2_wsp_sleafs[bmap_recptr->							   L1pg_idx] =				    sumtree_root_data;				bmap_recptr->L1pg_idx++;			}		}	}	if (vbam_rc == FSCK_OK) {		if ((bmap_recptr->L2pg_count > 0) && (bmap_recptr->L1pg_idx != 0)) {			/* there's enough data for an L2 level, and there's a partial L2 page */			for (leafidx = bmap_recptr->L1pg_idx;			     (leafidx <= MAXIDX); leafidx++) {				bmap_recptr->L2_wsp_sleafs[leafidx] = -1;			}			vbam_rc = Ln_tree_verify(2, bmap_recptr->L2pg_1stblk,						 &(bmap_recptr->L2_bufptr),						 &sumtree_root_data);		}	}	/*	 * Now go verify the Block Allocation Map Control page	 */	if (vbam_rc == FSCK_OK) {		vbam_rc = ctlpage_verify(sumtree_root_data);	}	/*	 * issue summary messages about the Block Allocation Map validation	 */	if (vbam_rc == FSCK_OK) {		vbam_rc = verify_blkall_summary_msgs();	}	return (vbam_rc);}/***************************************************************************** * NAME: verify_blkall_summary_msgs * * FUNCTION: Issue summary messages with the results of JFS Aggregate Block *           Map validation. * * PARAMETERS:  none * * RETURNS: *      success: FSCK_OK *      failure: something else */int verify_blkall_summary_msgs(){	int vbsm_rc = FSCK_OK;	if (bmap_recptr->dmap_pmap_error) {		fsck_send_msg(fsck_BADDMAPPMAPS);	}	if (bmap_recptr->dmap_slfv_error) {		fsck_send_msg(fsck_BADBMAPSLFV, fsck_ref_msg(fsck_dmap));	}	if (bmap_recptr->dmap_slnv_error) {		fsck_send_msg(fsck_BADBMAPSLNV, fsck_ref_msg(fsck_dmap));	}	if (bmap_recptr->dmap_other_error) {		fsck_send_msg(fsck_BADBMAPSOTHER, fsck_ref_msg(fsck_dmap));	}	if (bmap_recptr->L0pg_slfv_error) {		fsck_send_msg(fsck_BADBMAPSLFV, fsck_ref_msg(fsck_L0));	}	if (bmap_recptr->L0pg_slnv_error) {		fsck_send_msg(fsck_BADBMAPSLNV, fsck_ref_msg(fsck_L0));	}	if (bmap_recptr->L0pg_other_error) {		fsck_send_msg(fsck_BADBMAPSOTHER, fsck_ref_msg(fsck_L0));	}	if (bmap_recptr->L1pg_slfv_error) {		fsck_send_msg(fsck_BADBMAPSLFV, fsck_ref_msg(fsck_L1));	}	if (bmap_recptr->L1pg_slnv_error) {		fsck_send_msg(fsck_BADBMAPSLNV, fsck_ref_msg(fsck_L1));	}	if (bmap_recptr->L1pg_other_error) {		fsck_send_msg(fsck_BADBMAPSOTHER, fsck_ref_msg(fsck_L1));	}	if (bmap_recptr->L2pg_slfv_error) {		fsck_send_msg(fsck_BADBMAPSLFV, fsck_ref_msg(fsck_L2));	}	if (bmap_recptr->L2pg_slnv_error) {		fsck_send_msg(fsck_BADBMAPSLNV, fsck_ref_msg(fsck_L2));	}	if (bmap_recptr->L2pg_other_error) {		fsck_send_msg(fsck_BADBMAPSOTHER, fsck_ref_msg(fsck_L2));	}	if (bmap_recptr->ctl_fctl_error) {		fsck_send_msg(fsck_BADBMAPCAGFCL);	}	if (bmap_recptr->ctl_other_error) {		fsck_send_msg(fsck_BADBMAPCOTH);	}	if (bmap_recptr->dmap_pmap_error || bmap_recptr->dmap_slfv_error ||	    bmap_recptr->dmap_slnv_error || bmap_recptr->dmap_other_error ||	    bmap_recptr->L0pg_slfv_error || bmap_recptr->L0pg_slnv_error ||	    bmap_recptr->L0pg_other_error || bmap_recptr->L1pg_slfv_error ||	    bmap_recptr->L1pg_slnv_error || bmap_recptr->L1pg_other_error ||	    bmap_recptr->L2pg_slfv_error || bmap_recptr->L2pg_slnv_error ||	    bmap_recptr->L2pg_other_error) {		agg_recptr->ag_dirty = 1;		fsck_send_msg(fsck_BADBLKALLOC);	}	if (bmap_recptr->ctl_fctl_error || bmap_recptr->ctl_other_error) {		agg_recptr->ag_dirty = 1;		fsck_send_msg(fsck_BADBLKALLOCCTL);	}	return (vbsm_rc);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -