md: cleanup mddev flag clear for takeover
Commit 6995f0b
(md: takeover should clear unrelated bits) clear
unrelated bits, but it's quite fragile. To avoid error in the future,
define a macro for unsupported mddev flags for each raid type and use it
to clear unsupported mddev flags. This should be less error-prone.
Suggested-by: NeilBrown <neilb@suse.com>
Signed-off-by: Shaohua Li <shli@fb.com>
This commit is contained in:
@@ -212,6 +212,7 @@ extern int rdev_clear_badblocks(struct md_rdev *rdev, sector_t s, int sectors,
|
||||
int is_new);
|
||||
struct md_cluster_info;
|
||||
|
||||
/* change UNSUPPORTED_MDDEV_FLAGS for each array type if new flag is added */
|
||||
enum mddev_flags {
|
||||
MD_ARRAY_FIRST_USE, /* First use of array, needs initialization */
|
||||
MD_CLOSING, /* If set, we are closing the array, do not open
|
||||
@@ -702,4 +703,11 @@ static inline int mddev_is_clustered(struct mddev *mddev)
|
||||
{
|
||||
return mddev->cluster_info && mddev->bitmap_info.nodes > 1;
|
||||
}
|
||||
|
||||
/* clear unsupported mddev_flags */
|
||||
static inline void mddev_clear_unsupported_flags(struct mddev *mddev,
|
||||
unsigned long unsupported_flags)
|
||||
{
|
||||
mddev->flags &= ~unsupported_flags;
|
||||
}
|
||||
#endif /* _MD_MD_H */
|
||||
|
Reference in New Issue
Block a user