diff options
author | Lars Ellenberg <lars.ellenberg@linbit.com> | 2011-03-23 09:31:09 -0400 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2012-11-08 10:44:20 -0500 |
commit | f399002e68e626e7bc443e6fcab1772704cc197f (patch) | |
tree | 0d6abf88f3ebf5c619994c929d5baf728a3f579c /drivers/block/drbd/drbd_receiver.c | |
parent | 6b75dced005c7f06b81934167e36bcfc690cc3a7 (diff) |
drbd: distribute former syncer_conf settings to disk, connection, and resource level
This commit breaks the API again.
Move per-volume former syncer options into disk_conf.
Move per-connection former syncer options into net_conf.
Renamed the remainign sync_conf to res_opts
Syncer settings have been changeable at runtime, so we need to prepare
for these settings to be runtime-changeable in their new home as well.
Introduce new configuration operations, and share the netlink attribute
between "attach" (create new disk) and "disk-opts" (change options).
Same for "connect" and "net-opts".
Some fields cannot be changed at runtime, however.
Introduce a new flag GENLA_F_INVARIANT to be able to trigger on that in
the generated validation and assignment functions.
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers/block/drbd/drbd_receiver.c')
-rw-r--r-- | drivers/block/drbd/drbd_receiver.c | 51 |
1 files changed, 28 insertions, 23 deletions
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index 50c52712715e..c8c826b2444f 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c | |||
@@ -763,7 +763,7 @@ int drbd_connected(int vnr, void *p, void *data) | |||
763 | &mdev->tconn->cstate_mutex : | 763 | &mdev->tconn->cstate_mutex : |
764 | &mdev->own_state_mutex; | 764 | &mdev->own_state_mutex; |
765 | 765 | ||
766 | ok &= drbd_send_sync_param(mdev, &mdev->sync_conf); | 766 | ok &= drbd_send_sync_param(mdev); |
767 | ok &= drbd_send_sizes(mdev, 0, 0); | 767 | ok &= drbd_send_sizes(mdev, 0, 0); |
768 | ok &= drbd_send_uuids(mdev); | 768 | ok &= drbd_send_uuids(mdev); |
769 | ok &= drbd_send_state(mdev); | 769 | ok &= drbd_send_state(mdev); |
@@ -2085,7 +2085,7 @@ int drbd_rs_should_slow_down(struct drbd_conf *mdev, sector_t sector) | |||
2085 | int throttle = 0; | 2085 | int throttle = 0; |
2086 | 2086 | ||
2087 | /* feature disabled? */ | 2087 | /* feature disabled? */ |
2088 | if (mdev->sync_conf.c_min_rate == 0) | 2088 | if (mdev->ldev->dc.c_min_rate == 0) |
2089 | return 0; | 2089 | return 0; |
2090 | 2090 | ||
2091 | spin_lock_irq(&mdev->al_lock); | 2091 | spin_lock_irq(&mdev->al_lock); |
@@ -2125,7 +2125,7 @@ int drbd_rs_should_slow_down(struct drbd_conf *mdev, sector_t sector) | |||
2125 | db = mdev->rs_mark_left[i] - rs_left; | 2125 | db = mdev->rs_mark_left[i] - rs_left; |
2126 | dbdt = Bit2KB(db/dt); | 2126 | dbdt = Bit2KB(db/dt); |
2127 | 2127 | ||
2128 | if (dbdt > mdev->sync_conf.c_min_rate) | 2128 | if (dbdt > mdev->ldev->dc.c_min_rate) |
2129 | throttle = 1; | 2129 | throttle = 1; |
2130 | } | 2130 | } |
2131 | return throttle; | 2131 | return throttle; |
@@ -3001,7 +3001,10 @@ static int receive_SyncParam(struct drbd_conf *mdev, enum drbd_packet cmd, | |||
3001 | if (drbd_recv(mdev->tconn, &p->head.payload, header_size) != header_size) | 3001 | if (drbd_recv(mdev->tconn, &p->head.payload, header_size) != header_size) |
3002 | return false; | 3002 | return false; |
3003 | 3003 | ||
3004 | mdev->sync_conf.rate = be32_to_cpu(p->rate); | 3004 | if (get_ldev(mdev)) { |
3005 | mdev->ldev->dc.resync_rate = be32_to_cpu(p->rate); | ||
3006 | put_ldev(mdev); | ||
3007 | } | ||
3005 | 3008 | ||
3006 | if (apv >= 88) { | 3009 | if (apv >= 88) { |
3007 | if (apv == 88) { | 3010 | if (apv == 88) { |
@@ -3029,10 +3032,10 @@ static int receive_SyncParam(struct drbd_conf *mdev, enum drbd_packet cmd, | |||
3029 | p->csums_alg[SHARED_SECRET_MAX-1] = 0; | 3032 | p->csums_alg[SHARED_SECRET_MAX-1] = 0; |
3030 | } | 3033 | } |
3031 | 3034 | ||
3032 | if (strcmp(mdev->sync_conf.verify_alg, p->verify_alg)) { | 3035 | if (strcmp(mdev->tconn->net_conf->verify_alg, p->verify_alg)) { |
3033 | if (mdev->state.conn == C_WF_REPORT_PARAMS) { | 3036 | if (mdev->state.conn == C_WF_REPORT_PARAMS) { |
3034 | dev_err(DEV, "Different verify-alg settings. me=\"%s\" peer=\"%s\"\n", | 3037 | dev_err(DEV, "Different verify-alg settings. me=\"%s\" peer=\"%s\"\n", |
3035 | mdev->sync_conf.verify_alg, p->verify_alg); | 3038 | mdev->tconn->net_conf->verify_alg, p->verify_alg); |
3036 | goto disconnect; | 3039 | goto disconnect; |
3037 | } | 3040 | } |
3038 | verify_tfm = drbd_crypto_alloc_digest_safe(mdev, | 3041 | verify_tfm = drbd_crypto_alloc_digest_safe(mdev, |
@@ -3043,10 +3046,10 @@ static int receive_SyncParam(struct drbd_conf *mdev, enum drbd_packet cmd, | |||
3043 | } | 3046 | } |
3044 | } | 3047 | } |
3045 | 3048 | ||
3046 | if (apv >= 89 && strcmp(mdev->sync_conf.csums_alg, p->csums_alg)) { | 3049 | if (apv >= 89 && strcmp(mdev->tconn->net_conf->csums_alg, p->csums_alg)) { |
3047 | if (mdev->state.conn == C_WF_REPORT_PARAMS) { | 3050 | if (mdev->state.conn == C_WF_REPORT_PARAMS) { |
3048 | dev_err(DEV, "Different csums-alg settings. me=\"%s\" peer=\"%s\"\n", | 3051 | dev_err(DEV, "Different csums-alg settings. me=\"%s\" peer=\"%s\"\n", |
3049 | mdev->sync_conf.csums_alg, p->csums_alg); | 3052 | mdev->tconn->net_conf->csums_alg, p->csums_alg); |
3050 | goto disconnect; | 3053 | goto disconnect; |
3051 | } | 3054 | } |
3052 | csums_tfm = drbd_crypto_alloc_digest_safe(mdev, | 3055 | csums_tfm = drbd_crypto_alloc_digest_safe(mdev, |
@@ -3057,37 +3060,39 @@ static int receive_SyncParam(struct drbd_conf *mdev, enum drbd_packet cmd, | |||
3057 | } | 3060 | } |
3058 | } | 3061 | } |
3059 | 3062 | ||
3060 | if (apv > 94) { | 3063 | if (apv > 94 && get_ldev(mdev)) { |
3061 | mdev->sync_conf.rate = be32_to_cpu(p->rate); | 3064 | mdev->ldev->dc.resync_rate = be32_to_cpu(p->rate); |
3062 | mdev->sync_conf.c_plan_ahead = be32_to_cpu(p->c_plan_ahead); | 3065 | mdev->ldev->dc.c_plan_ahead = be32_to_cpu(p->c_plan_ahead); |
3063 | mdev->sync_conf.c_delay_target = be32_to_cpu(p->c_delay_target); | 3066 | mdev->ldev->dc.c_delay_target = be32_to_cpu(p->c_delay_target); |
3064 | mdev->sync_conf.c_fill_target = be32_to_cpu(p->c_fill_target); | 3067 | mdev->ldev->dc.c_fill_target = be32_to_cpu(p->c_fill_target); |
3065 | mdev->sync_conf.c_max_rate = be32_to_cpu(p->c_max_rate); | 3068 | mdev->ldev->dc.c_max_rate = be32_to_cpu(p->c_max_rate); |
3066 | 3069 | ||
3067 | fifo_size = (mdev->sync_conf.c_plan_ahead * 10 * SLEEP_TIME) / HZ; | 3070 | fifo_size = (mdev->ldev->dc.c_plan_ahead * 10 * SLEEP_TIME) / HZ; |
3068 | if (fifo_size != mdev->rs_plan_s.size && fifo_size > 0) { | 3071 | if (fifo_size != mdev->rs_plan_s.size && fifo_size > 0) { |
3069 | rs_plan_s = kzalloc(sizeof(int) * fifo_size, GFP_KERNEL); | 3072 | rs_plan_s = kzalloc(sizeof(int) * fifo_size, GFP_KERNEL); |
3070 | if (!rs_plan_s) { | 3073 | if (!rs_plan_s) { |
3071 | dev_err(DEV, "kmalloc of fifo_buffer failed"); | 3074 | dev_err(DEV, "kmalloc of fifo_buffer failed"); |
3075 | put_ldev(mdev); | ||
3072 | goto disconnect; | 3076 | goto disconnect; |
3073 | } | 3077 | } |
3074 | } | 3078 | } |
3079 | put_ldev(mdev); | ||
3075 | } | 3080 | } |
3076 | 3081 | ||
3077 | spin_lock(&mdev->peer_seq_lock); | 3082 | spin_lock(&mdev->peer_seq_lock); |
3078 | /* lock against drbd_nl_syncer_conf() */ | 3083 | /* lock against drbd_nl_syncer_conf() */ |
3079 | if (verify_tfm) { | 3084 | if (verify_tfm) { |
3080 | strcpy(mdev->sync_conf.verify_alg, p->verify_alg); | 3085 | strcpy(mdev->tconn->net_conf->verify_alg, p->verify_alg); |
3081 | mdev->sync_conf.verify_alg_len = strlen(p->verify_alg) + 1; | 3086 | mdev->tconn->net_conf->verify_alg_len = strlen(p->verify_alg) + 1; |
3082 | crypto_free_hash(mdev->verify_tfm); | 3087 | crypto_free_hash(mdev->tconn->verify_tfm); |
3083 | mdev->verify_tfm = verify_tfm; | 3088 | mdev->tconn->verify_tfm = verify_tfm; |
3084 | dev_info(DEV, "using verify-alg: \"%s\"\n", p->verify_alg); | 3089 | dev_info(DEV, "using verify-alg: \"%s\"\n", p->verify_alg); |
3085 | } | 3090 | } |
3086 | if (csums_tfm) { | 3091 | if (csums_tfm) { |
3087 | strcpy(mdev->sync_conf.csums_alg, p->csums_alg); | 3092 | strcpy(mdev->tconn->net_conf->csums_alg, p->csums_alg); |
3088 | mdev->sync_conf.csums_alg_len = strlen(p->csums_alg) + 1; | 3093 | mdev->tconn->net_conf->csums_alg_len = strlen(p->csums_alg) + 1; |
3089 | crypto_free_hash(mdev->csums_tfm); | 3094 | crypto_free_hash(mdev->tconn->csums_tfm); |
3090 | mdev->csums_tfm = csums_tfm; | 3095 | mdev->tconn->csums_tfm = csums_tfm; |
3091 | dev_info(DEV, "using csums-alg: \"%s\"\n", p->csums_alg); | 3096 | dev_info(DEV, "using csums-alg: \"%s\"\n", p->csums_alg); |
3092 | } | 3097 | } |
3093 | if (fifo_size != mdev->rs_plan_s.size) { | 3098 | if (fifo_size != mdev->rs_plan_s.size) { |