Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 75d9bbc7 authored by Goldwyn Rodrigues's avatar Goldwyn Rodrigues Committed by Joel Becker
Browse files

Initialize max_slots early



Functions such as ocfs2_recovery_init() make use of osb->max_slots.
Initialize osb->max_slots early so the functions may use the correct
value.

Signed-off-by: default avatarGoldwyn Rodrigues <rgoldwyn@suse.de>
Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
parent f30d44f3
Loading
Loading
Loading
Loading
+9 −9
Original line number Original line Diff line number Diff line
@@ -2105,6 +2105,15 @@ static int ocfs2_initialize_super(struct super_block *sb,
	snprintf(osb->dev_str, sizeof(osb->dev_str), "%u,%u",
	snprintf(osb->dev_str, sizeof(osb->dev_str), "%u,%u",
		 MAJOR(osb->sb->s_dev), MINOR(osb->sb->s_dev));
		 MAJOR(osb->sb->s_dev), MINOR(osb->sb->s_dev));


	osb->max_slots = le16_to_cpu(di->id2.i_super.s_max_slots);
	if (osb->max_slots > OCFS2_MAX_SLOTS || osb->max_slots == 0) {
		mlog(ML_ERROR, "Invalid number of node slots (%u)\n",
		     osb->max_slots);
		status = -EINVAL;
		goto bail;
	}
	mlog(0, "max_slots for this device: %u\n", osb->max_slots);

	ocfs2_orphan_scan_init(osb);
	ocfs2_orphan_scan_init(osb);


	status = ocfs2_recovery_init(osb);
	status = ocfs2_recovery_init(osb);
@@ -2143,15 +2152,6 @@ static int ocfs2_initialize_super(struct super_block *sb,
		goto bail;
		goto bail;
	}
	}


	osb->max_slots = le16_to_cpu(di->id2.i_super.s_max_slots);
	if (osb->max_slots > OCFS2_MAX_SLOTS || osb->max_slots == 0) {
		mlog(ML_ERROR, "Invalid number of node slots (%u)\n",
		     osb->max_slots);
		status = -EINVAL;
		goto bail;
	}
	mlog(0, "max_slots for this device: %u\n", osb->max_slots);

	osb->slot_recovery_generations =
	osb->slot_recovery_generations =
		kcalloc(osb->max_slots, sizeof(*osb->slot_recovery_generations),
		kcalloc(osb->max_slots, sizeof(*osb->slot_recovery_generations),
			GFP_KERNEL);
			GFP_KERNEL);