diff options
author | Philipp Reisner <philipp.reisner@linbit.com> | 2010-03-24 12:11:33 -0400 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2010-05-17 19:15:44 -0400 |
commit | e89b591c3aba0af87f5248b15f56ce7a4f439c16 (patch) | |
tree | 311b6977d986e9549ee9193b4471fc937007c3f5 /drivers/block | |
parent | 02d9a94bbb0d4e0fec8db6735bdc4ccfaac8f0ce (diff) |
drbd: Implemented flags for the resize packet
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/drbd/drbd_int.h | 14 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_main.c | 8 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_nl.c | 2 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_receiver.c | 19 |
4 files changed, 25 insertions, 18 deletions
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h index 37a25a6084dd..e09132483980 100644 --- a/drivers/block/drbd/drbd_int.h +++ b/drivers/block/drbd/drbd_int.h | |||
@@ -481,7 +481,8 @@ struct p_sizes { | |||
481 | u64 u_size; /* user requested size */ | 481 | u64 u_size; /* user requested size */ |
482 | u64 c_size; /* current exported size */ | 482 | u64 c_size; /* current exported size */ |
483 | u32 max_segment_size; /* Maximal size of a BIO */ | 483 | u32 max_segment_size; /* Maximal size of a BIO */ |
484 | u32 queue_order_type; | 484 | u16 queue_order_type; /* not yet implemented in DRBD*/ |
485 | u16 dds_flags; /* use enum dds_flags here. */ | ||
485 | } __packed; | 486 | } __packed; |
486 | 487 | ||
487 | struct p_state { | 488 | struct p_state { |
@@ -1081,6 +1082,11 @@ enum chg_state_flags { | |||
1081 | CS_ORDERED = CS_WAIT_COMPLETE + CS_SERIALIZE, | 1082 | CS_ORDERED = CS_WAIT_COMPLETE + CS_SERIALIZE, |
1082 | }; | 1083 | }; |
1083 | 1084 | ||
1085 | enum dds_flags { | ||
1086 | DDSF_FORCED = 1, | ||
1087 | DDSF_NO_RESYNC = 2, /* Do not run a resync for the new space */ | ||
1088 | }; | ||
1089 | |||
1084 | extern void drbd_init_set_defaults(struct drbd_conf *mdev); | 1090 | extern void drbd_init_set_defaults(struct drbd_conf *mdev); |
1085 | extern int drbd_change_state(struct drbd_conf *mdev, enum chg_state_flags f, | 1091 | extern int drbd_change_state(struct drbd_conf *mdev, enum chg_state_flags f, |
1086 | union drbd_state mask, union drbd_state val); | 1092 | union drbd_state mask, union drbd_state val); |
@@ -1113,7 +1119,7 @@ extern int drbd_send_protocol(struct drbd_conf *mdev); | |||
1113 | extern int drbd_send_uuids(struct drbd_conf *mdev); | 1119 | extern int drbd_send_uuids(struct drbd_conf *mdev); |
1114 | extern int drbd_send_uuids_skip_initial_sync(struct drbd_conf *mdev); | 1120 | extern int drbd_send_uuids_skip_initial_sync(struct drbd_conf *mdev); |
1115 | extern int drbd_send_sync_uuid(struct drbd_conf *mdev, u64 val); | 1121 | extern int drbd_send_sync_uuid(struct drbd_conf *mdev, u64 val); |
1116 | extern int drbd_send_sizes(struct drbd_conf *mdev, int trigger_reply); | 1122 | extern int drbd_send_sizes(struct drbd_conf *mdev, int trigger_reply, enum dds_flags flags); |
1117 | extern int _drbd_send_state(struct drbd_conf *mdev); | 1123 | extern int _drbd_send_state(struct drbd_conf *mdev); |
1118 | extern int drbd_send_state(struct drbd_conf *mdev); | 1124 | extern int drbd_send_state(struct drbd_conf *mdev); |
1119 | extern int _drbd_send_cmd(struct drbd_conf *mdev, struct socket *sock, | 1125 | extern int _drbd_send_cmd(struct drbd_conf *mdev, struct socket *sock, |
@@ -1382,10 +1388,6 @@ extern void drbd_suspend_io(struct drbd_conf *mdev); | |||
1382 | extern void drbd_resume_io(struct drbd_conf *mdev); | 1388 | extern void drbd_resume_io(struct drbd_conf *mdev); |
1383 | extern char *ppsize(char *buf, unsigned long long size); | 1389 | extern char *ppsize(char *buf, unsigned long long size); |
1384 | extern sector_t drbd_new_dev_size(struct drbd_conf *, struct drbd_backing_dev *, int); | 1390 | extern sector_t drbd_new_dev_size(struct drbd_conf *, struct drbd_backing_dev *, int); |
1385 | enum dds_flags { | ||
1386 | DDSF_FORCED = 1, | ||
1387 | DDSF_NO_RESYNC = 2, /* Do not run a resync for the new space */ | ||
1388 | }; | ||
1389 | enum determine_dev_size { dev_size_error = -1, unchanged = 0, shrunk = 1, grew = 2 }; | 1391 | enum determine_dev_size { dev_size_error = -1, unchanged = 0, shrunk = 1, grew = 2 }; |
1390 | extern enum determine_dev_size drbd_determin_dev_size(struct drbd_conf *, enum dds_flags) __must_hold(local); | 1392 | extern enum determine_dev_size drbd_determin_dev_size(struct drbd_conf *, enum dds_flags) __must_hold(local); |
1391 | extern void resync_after_online_grow(struct drbd_conf *); | 1393 | extern void resync_after_online_grow(struct drbd_conf *); |
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index 65c2a65d3d64..a478dad82dae 100644 --- a/drivers/block/drbd/drbd_main.c +++ b/drivers/block/drbd/drbd_main.c | |||
@@ -1240,7 +1240,7 @@ static void after_state_ch(struct drbd_conf *mdev, union drbd_state os, | |||
1240 | os.disk == D_ATTACHING && ns.disk == D_NEGOTIATING) { | 1240 | os.disk == D_ATTACHING && ns.disk == D_NEGOTIATING) { |
1241 | kfree(mdev->p_uuid); /* We expect to receive up-to-date UUIDs soon. */ | 1241 | kfree(mdev->p_uuid); /* We expect to receive up-to-date UUIDs soon. */ |
1242 | mdev->p_uuid = NULL; /* ...to not use the old ones in the mean time */ | 1242 | mdev->p_uuid = NULL; /* ...to not use the old ones in the mean time */ |
1243 | drbd_send_sizes(mdev, 0); /* to start sync... */ | 1243 | drbd_send_sizes(mdev, 0, 0); /* to start sync... */ |
1244 | drbd_send_uuids(mdev); | 1244 | drbd_send_uuids(mdev); |
1245 | drbd_send_state(mdev); | 1245 | drbd_send_state(mdev); |
1246 | } | 1246 | } |
@@ -1763,7 +1763,7 @@ int drbd_send_sync_uuid(struct drbd_conf *mdev, u64 val) | |||
1763 | (struct p_header *)&p, sizeof(p)); | 1763 | (struct p_header *)&p, sizeof(p)); |
1764 | } | 1764 | } |
1765 | 1765 | ||
1766 | int drbd_send_sizes(struct drbd_conf *mdev, int trigger_reply) | 1766 | int drbd_send_sizes(struct drbd_conf *mdev, int trigger_reply, enum dds_flags flags) |
1767 | { | 1767 | { |
1768 | struct p_sizes p; | 1768 | struct p_sizes p; |
1769 | sector_t d_size, u_size; | 1769 | sector_t d_size, u_size; |
@@ -1775,7 +1775,6 @@ int drbd_send_sizes(struct drbd_conf *mdev, int trigger_reply) | |||
1775 | d_size = drbd_get_max_capacity(mdev->ldev); | 1775 | d_size = drbd_get_max_capacity(mdev->ldev); |
1776 | u_size = mdev->ldev->dc.disk_size; | 1776 | u_size = mdev->ldev->dc.disk_size; |
1777 | q_order_type = drbd_queue_order_type(mdev); | 1777 | q_order_type = drbd_queue_order_type(mdev); |
1778 | p.queue_order_type = cpu_to_be32(drbd_queue_order_type(mdev)); | ||
1779 | put_ldev(mdev); | 1778 | put_ldev(mdev); |
1780 | } else { | 1779 | } else { |
1781 | d_size = 0; | 1780 | d_size = 0; |
@@ -1787,7 +1786,8 @@ int drbd_send_sizes(struct drbd_conf *mdev, int trigger_reply) | |||
1787 | p.u_size = cpu_to_be64(u_size); | 1786 | p.u_size = cpu_to_be64(u_size); |
1788 | p.c_size = cpu_to_be64(trigger_reply ? 0 : drbd_get_capacity(mdev->this_bdev)); | 1787 | p.c_size = cpu_to_be64(trigger_reply ? 0 : drbd_get_capacity(mdev->this_bdev)); |
1789 | p.max_segment_size = cpu_to_be32(queue_max_segment_size(mdev->rq_queue)); | 1788 | p.max_segment_size = cpu_to_be32(queue_max_segment_size(mdev->rq_queue)); |
1790 | p.queue_order_type = cpu_to_be32(q_order_type); | 1789 | p.queue_order_type = cpu_to_be16(q_order_type); |
1790 | p.dds_flags = cpu_to_be16(flags); | ||
1791 | 1791 | ||
1792 | ok = drbd_send_cmd(mdev, USE_DATA_SOCKET, P_SIZES, | 1792 | ok = drbd_send_cmd(mdev, USE_DATA_SOCKET, P_SIZES, |
1793 | (struct p_header *)&p, sizeof(p)); | 1793 | (struct p_header *)&p, sizeof(p)); |
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c index 360e506426b0..6f7933376a11 100644 --- a/drivers/block/drbd/drbd_nl.c +++ b/drivers/block/drbd/drbd_nl.c | |||
@@ -1521,7 +1521,7 @@ static int drbd_nl_resize(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp, | |||
1521 | set_bit(RESIZE_PENDING, &mdev->flags); | 1521 | set_bit(RESIZE_PENDING, &mdev->flags); |
1522 | 1522 | ||
1523 | drbd_send_uuids(mdev); | 1523 | drbd_send_uuids(mdev); |
1524 | drbd_send_sizes(mdev, 1); | 1524 | drbd_send_sizes(mdev, 1, 0); |
1525 | } | 1525 | } |
1526 | 1526 | ||
1527 | fail: | 1527 | fail: |
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index 6876041fc3d8..11b1bafde28b 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c | |||
@@ -902,7 +902,7 @@ retry: | |||
902 | if (!drbd_send_protocol(mdev)) | 902 | if (!drbd_send_protocol(mdev)) |
903 | return -1; | 903 | return -1; |
904 | drbd_send_sync_param(mdev, &mdev->sync_conf); | 904 | drbd_send_sync_param(mdev, &mdev->sync_conf); |
905 | drbd_send_sizes(mdev, 0); | 905 | drbd_send_sizes(mdev, 0, 0); |
906 | drbd_send_uuids(mdev); | 906 | drbd_send_uuids(mdev); |
907 | drbd_send_state(mdev); | 907 | drbd_send_state(mdev); |
908 | clear_bit(USE_DEGR_WFC_T, &mdev->flags); | 908 | clear_bit(USE_DEGR_WFC_T, &mdev->flags); |
@@ -2866,6 +2866,7 @@ static int receive_sizes(struct drbd_conf *mdev, struct p_header *h) | |||
2866 | unsigned int max_seg_s; | 2866 | unsigned int max_seg_s; |
2867 | sector_t p_size, p_usize, my_usize; | 2867 | sector_t p_size, p_usize, my_usize; |
2868 | int ldsc = 0; /* local disk size changed */ | 2868 | int ldsc = 0; /* local disk size changed */ |
2869 | enum dds_flags ddsf; | ||
2869 | 2870 | ||
2870 | ERR_IF(h->length != (sizeof(*p)-sizeof(*h))) return FALSE; | 2871 | ERR_IF(h->length != (sizeof(*p)-sizeof(*h))) return FALSE; |
2871 | if (drbd_recv(mdev, h->payload, h->length) != h->length) | 2872 | if (drbd_recv(mdev, h->payload, h->length) != h->length) |
@@ -2921,8 +2922,9 @@ static int receive_sizes(struct drbd_conf *mdev, struct p_header *h) | |||
2921 | } | 2922 | } |
2922 | #undef min_not_zero | 2923 | #undef min_not_zero |
2923 | 2924 | ||
2925 | ddsf = be16_to_cpu(p->dds_flags); | ||
2924 | if (get_ldev(mdev)) { | 2926 | if (get_ldev(mdev)) { |
2925 | dd = drbd_determin_dev_size(mdev, 0); | 2927 | dd = drbd_determin_dev_size(mdev, ddsf); |
2926 | put_ldev(mdev); | 2928 | put_ldev(mdev); |
2927 | if (dd == dev_size_error) | 2929 | if (dd == dev_size_error) |
2928 | return FALSE; | 2930 | return FALSE; |
@@ -2942,7 +2944,7 @@ static int receive_sizes(struct drbd_conf *mdev, struct p_header *h) | |||
2942 | if (max_seg_s != queue_max_segment_size(mdev->rq_queue)) | 2944 | if (max_seg_s != queue_max_segment_size(mdev->rq_queue)) |
2943 | drbd_setup_queue_param(mdev, max_seg_s); | 2945 | drbd_setup_queue_param(mdev, max_seg_s); |
2944 | 2946 | ||
2945 | drbd_setup_order_type(mdev, be32_to_cpu(p->queue_order_type)); | 2947 | drbd_setup_order_type(mdev, be16_to_cpu(p->queue_order_type)); |
2946 | put_ldev(mdev); | 2948 | put_ldev(mdev); |
2947 | } | 2949 | } |
2948 | 2950 | ||
@@ -2951,14 +2953,17 @@ static int receive_sizes(struct drbd_conf *mdev, struct p_header *h) | |||
2951 | drbd_get_capacity(mdev->this_bdev) || ldsc) { | 2953 | drbd_get_capacity(mdev->this_bdev) || ldsc) { |
2952 | /* we have different sizes, probably peer | 2954 | /* we have different sizes, probably peer |
2953 | * needs to know my new size... */ | 2955 | * needs to know my new size... */ |
2954 | drbd_send_sizes(mdev, 0); | 2956 | drbd_send_sizes(mdev, 0, ddsf); |
2955 | } | 2957 | } |
2956 | if (test_and_clear_bit(RESIZE_PENDING, &mdev->flags) || | 2958 | if (test_and_clear_bit(RESIZE_PENDING, &mdev->flags) || |
2957 | (dd == grew && mdev->state.conn == C_CONNECTED)) { | 2959 | (dd == grew && mdev->state.conn == C_CONNECTED)) { |
2958 | if (mdev->state.pdsk >= D_INCONSISTENT && | 2960 | if (mdev->state.pdsk >= D_INCONSISTENT && |
2959 | mdev->state.disk >= D_INCONSISTENT) | 2961 | mdev->state.disk >= D_INCONSISTENT) { |
2960 | resync_after_online_grow(mdev); | 2962 | if (ddsf & DDSF_NO_RESYNC) |
2961 | else | 2963 | dev_info(DEV, "Resync of new storage suppressed with --assume-clean\n"); |
2964 | else | ||
2965 | resync_after_online_grow(mdev); | ||
2966 | } else | ||
2962 | set_bit(RESYNC_AFTER_NEG, &mdev->flags); | 2967 | set_bit(RESYNC_AFTER_NEG, &mdev->flags); |
2963 | } | 2968 | } |
2964 | } | 2969 | } |