/* calculate the real backups we need to update. */ for (i = 0; i < OCFS2_MAX_BACKUP_SUPERBLOCKS; i++) {
blkno = ocfs2_backup_super_blkno(inode->i_sb, i);
cluster = ocfs2_blocks_to_clusters(inode->i_sb, blkno); if (cluster >= clusters) break;
ret = ocfs2_read_blocks_sync(osb, blkno, 1, &backup); if (ret < 0) {
mlog_errno(ret); break;
}
ret = ocfs2_write_super_or_backup(osb, super_bh); if (ret < 0) {
mlog_errno(ret); goto out;
}
if (OCFS2_HAS_COMPAT_FEATURE(osb->sb, OCFS2_FEATURE_COMPAT_BACKUP_SB))
ret = update_backups(inode, clusters, super_bh->b_data);
out:
brelse(super_bh); if (ret)
printk(KERN_WARNING "ocfs2: Failed to update super blocks on %s" " during fs resize. This condition is not fatal," " but fsck.ocfs2 should be run to fix it\n",
osb->dev_str); return;
}
main_bm_inode = ocfs2_get_system_file_inode(osb,
GLOBAL_BITMAP_SYSTEM_INODE,
OCFS2_INVALID_SLOT); if (!main_bm_inode) {
ret = -EINVAL;
mlog_errno(ret); goto out;
}
inode_lock(main_bm_inode);
ret = ocfs2_inode_lock(main_bm_inode, &main_bm_bh, 1); if (ret < 0) {
mlog_errno(ret); goto out_mutex;
}
fe = (struct ocfs2_dinode *)main_bm_bh->b_data;
/* main_bm_bh is validated by inode read inside ocfs2_inode_lock(),
* so any corruption is a code bug. */
BUG_ON(!OCFS2_IS_VALID_DINODE(fe));
if (le16_to_cpu(fe->id2.i_chain.cl_cpg) !=
ocfs2_group_bitmap_size(osb->sb, 0,
osb->s_feature_incompat) * 8) {
mlog(ML_ERROR, "The disk is too old and small. " "Force to do offline resize.");
ret = -EINVAL; goto out_unlock;
}
handle = ocfs2_start_trans(osb, OCFS2_GROUP_EXTEND_CREDITS); if (IS_ERR(handle)) {
mlog_errno(PTR_ERR(handle));
ret = -EINVAL; goto out_unlock;
}
/* update the last group descriptor and inode. */
ret = ocfs2_update_last_group_and_inode(handle, main_bm_inode,
main_bm_bh, group_bh,
first_new_cluster,
new_clusters); if (ret) {
mlog_errno(ret); goto out_commit;
}
if (cluster < total_clusters)
mlog(ML_ERROR, "add a group which is in the current volume.\n"); elseif (input->chain >= cl_count)
mlog(ML_ERROR, "input chain exceeds the limit.\n"); elseif (next_free != cl_count && next_free != input->chain)
mlog(ML_ERROR, "the add group should be in chain %u\n", next_free); elseif (total_clusters + input->clusters < total_clusters)
mlog(ML_ERROR, "add group's clusters overflow.\n"); elseif (input->clusters > cl_cpg)
mlog(ML_ERROR, "the cluster exceeds the maximum of a group\n"); elseif (input->frees > input->clusters)
mlog(ML_ERROR, "the free cluster exceeds the total clusters\n"); elseif (total_clusters % cl_cpg != 0)
mlog(ML_ERROR, "the last group isn't full. Use group extend first.\n"); elseif (input->group != ocfs2_which_cluster_group(inode, cluster))
mlog(ML_ERROR, "group blkno is invalid\n"); elseif ((ret = ocfs2_check_new_group(inode, di, input, group_bh)))
mlog(ML_ERROR, "group descriptor check failed.\n"); else
ret = 0;
if (ocfs2_is_hard_readonly(osb) || ocfs2_is_soft_readonly(osb)) return -EROFS;
main_bm_inode = ocfs2_get_system_file_inode(osb,
GLOBAL_BITMAP_SYSTEM_INODE,
OCFS2_INVALID_SLOT); if (!main_bm_inode) {
ret = -EINVAL;
mlog_errno(ret); goto out;
}
inode_lock(main_bm_inode);
ret = ocfs2_inode_lock(main_bm_inode, &main_bm_bh, 1); if (ret < 0) {
mlog_errno(ret); goto out_mutex;
}
fe = (struct ocfs2_dinode *)main_bm_bh->b_data;
if (le16_to_cpu(fe->id2.i_chain.cl_cpg) !=
ocfs2_group_bitmap_size(osb->sb, 0,
osb->s_feature_incompat) * 8) {
mlog(ML_ERROR, "The disk is too old and small." " Force to do offline resize.");
ret = -EINVAL; goto out_unlock;
}
ret = ocfs2_read_blocks_sync(osb, input->group, 1, &group_bh); if (ret < 0) {
mlog(ML_ERROR, "Can't read the group descriptor # %llu " "from the device.", (unsignedlonglong)input->group); goto out_unlock;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.