summaryrefslogtreecommitdiff
path: root/super1.c
diff options
context:
space:
mode:
authorSong Liu <songliubraving@fb.com>2015-10-21 11:35:14 -0700
committerNeilBrown <neilb@suse.com>2015-10-22 12:19:09 +1100
commit051f326550f5f2c6e3329878d2c9a5558a5a41ff (patch)
tree681e15674cdc2c5b84302680d1a4e9ca5e95cc92 /super1.c
parente80357f8254d8102fcfe2db9252922fbb054640a (diff)
downloadmdadm-051f326550f5f2c6e3329878d2c9a5558a5a41ff.tar.gz
mdadm: refactor write journal code in Assemble and Incremental
As discussed, standalone require_journal() in struct superswitch is not a very good idea. Instead, journal related information fits well in struct mdinfo. This patch simplifies journal support code in Assemble and Incremental as: - Add journal_device_required and journal_clean to struct mdinfo; - Remove function require_journal from struct superswitch; - Update Assemble and Incremental to use journal_device_required and journal_clean from struct mdinfo (instead of separate var). Signed-off-by: Song Liu <songliubraving@fb.com> Signed-off-by: Shaohua Li <shli@fb.com> Signed-off-by: NeilBrown <neilb@suse.com>
Diffstat (limited to 'super1.c')
-rw-r--r--super1.c19
1 files changed, 3 insertions, 16 deletions
diff --git a/super1.c b/super1.c
index c879713..58e6f9d 100644
--- a/super1.c
+++ b/super1.c
@@ -140,21 +140,6 @@ struct misc_dev_info {
|MD_FEATURE_BITMAP_VERSIONED \
|MD_FEATURE_JOURNAL \
)
-/* return value:
- * 0, jouranl not required
- * 1, journal required
- * 2, no superblock loated (st->sb == NULL)
- */
-static int require_journal1(struct supertype *st)
-{
- struct mdp_superblock_1 *sb = st->sb;
-
- if (sb->feature_map & MD_FEATURE_JOURNAL)
- return 1;
- else if (!sb)
- return 2; /* no sb loaded */
- return 0;
-}
static int role_from_sb(struct mdp_superblock_1 *sb)
{
@@ -1086,6 +1071,9 @@ static void getinfo_super1(struct supertype *st, struct mdinfo *info, char *map)
}
info->array.working_disks = working;
+ if (sb->feature_map & __le32_to_cpu(MD_FEATURE_JOURNAL))
+ info->journal_device_required = 1;
+ info->journal_clean = 0;
}
static struct mdinfo *container_content1(struct supertype *st, char *subarray)
@@ -2637,7 +2625,6 @@ struct superswitch super1 = {
.locate_bitmap = locate_bitmap1,
.write_bitmap = write_bitmap1,
.free_super = free_super1,
- .require_journal = require_journal1,
#if __BYTE_ORDER == BIG_ENDIAN
.swapuuid = 0,
#else