/* * Copyright (C) 2015, SUSE * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * */#include<linux/module.h>#include<linux/kthread.h>#include<linux/dlm.h>#include<linux/sched.h>#include<linux/raid/md_p.h>#include"md.h"#include"bitmap.h"#include"md-cluster.h"#define LVB_SIZE 64#define NEW_DEV_TIMEOUT 5000structdlm_lock_resource{dlm_lockspace_t*ls;structdlm_lksblksb;char*name;/* lock name. */uint32_tflags;/* flags to pass to dlm_lock() */wait_queue_head_tsync_locking;/* wait queue for synchronized locking */boolsync_locking_done;void(*bast)(void*arg,intmode);/* blocking AST function pointer*/structmddev*mddev;/* pointing back to mddev. */intmode;};structsuspend_info{intslot;sector_tlo;sector_thi;structlist_headlist;};structresync_info{__le64lo;__le64hi;};/* md_cluster_info flags */#define MD_CLUSTER_WAITING_FOR_NEWDISK 1#define MD_CLUSTER_SUSPEND_READ_BALANCING 2#define MD_CLUSTER_BEGIN_JOIN_CLUSTER 3/* Lock the send communication. This is done through * bit manipulation as opposed to a mutex in order to * accomodate lock and hold. See next comment. */#define MD_CLUSTER_SEND_LOCK 4/* If cluster operations (such as adding a disk) must lock the * communication channel, so as to perform extra operations * (update metadata) and no other operation is allowed on the * MD. Token needs to be locked and held until the operation * completes witha md_update_sb(), which would eventually release * the lock. */#define MD_CLUSTER_SEND_LOCKED_ALREADY 5/* We should receive message after node joined cluster and * set up all the related infos such as bitmap and personality */#define MD_CLUSTER_ALREADY_IN_CLUSTER 6#define MD_CLUSTER_PENDING_RECV_EVENT 7#define MD_CLUSTER_HOLDING_MUTEX_FOR_RECVD 8structmd_cluster_info{structmddev*mddev;/* the md device which md_cluster_info belongs to *//* dlm lock space and resources for clustered raid. */dlm_lockspace_t*lockspace;intslot_number;structcompletioncompletion;structmutexrecv_mutex;structdlm_lock_resource*bitmap_lockres;structdlm_lock_resource**other_bitmap_lockres;structdlm_lock_resource*resync_lockres;structlist_headsuspend_list;spinlock_tsuspend_lock;structmd_thread*recovery_thread;unsignedlongrecovery_map;/* communication loc resources */structdlm_lock_resource*ack_lockres;structdlm_lock_resource*message_lockres;structdlm_lock_resource*token_lockres;structdlm_lock_resource*no_new_dev_lockres;