|
@@ -46,9 +46,10 @@
|
|
|
#include "drbd_int.h"
|
|
|
#include "drbd_protocol.h"
|
|
|
#include "drbd_req.h"
|
|
|
-
|
|
|
#include "drbd_vli.h"
|
|
|
|
|
|
+#define PRO_FEATURES (FF_TRIM)
|
|
|
+
|
|
|
struct packet_info {
|
|
|
enum drbd_packet cmd;
|
|
|
unsigned int size;
|
|
@@ -3705,6 +3706,13 @@ static int receive_sizes(struct drbd_connection *connection, struct packet_info
|
|
|
put_ldev(device);
|
|
|
}
|
|
|
|
|
|
+ device->peer_max_bio_size = be32_to_cpu(p->max_bio_size);
|
|
|
+ drbd_reconsider_max_bio_size(device);
|
|
|
+ /* Leave drbd_reconsider_max_bio_size() before drbd_determine_dev_size().
|
|
|
+ In case we cleared the QUEUE_FLAG_DISCARD from our queue in
|
|
|
+ drbd_reconsider_max_bio_size(), we can be sure that after
|
|
|
+ drbd_determine_dev_size() no REQ_DISCARDs are in the queue. */
|
|
|
+
|
|
|
ddsf = be16_to_cpu(p->dds_flags);
|
|
|
if (get_ldev(device)) {
|
|
|
dd = drbd_determine_dev_size(device, ddsf, NULL);
|
|
@@ -3717,9 +3725,6 @@ static int receive_sizes(struct drbd_connection *connection, struct packet_info
|
|
|
drbd_set_my_capacity(device, p_size);
|
|
|
}
|
|
|
|
|
|
- device->peer_max_bio_size = be32_to_cpu(p->max_bio_size);
|
|
|
- drbd_reconsider_max_bio_size(device);
|
|
|
-
|
|
|
if (get_ldev(device)) {
|
|
|
if (device->ldev->known_size != drbd_get_capacity(device->ldev->backing_bdev)) {
|
|
|
device->ldev->known_size = drbd_get_capacity(device->ldev->backing_bdev);
|
|
@@ -4688,6 +4693,7 @@ static int drbd_send_features(struct drbd_connection *connection)
|
|
|
memset(p, 0, sizeof(*p));
|
|
|
p->protocol_min = cpu_to_be32(PRO_VERSION_MIN);
|
|
|
p->protocol_max = cpu_to_be32(PRO_VERSION_MAX);
|
|
|
+ p->feature_flags = cpu_to_be32(PRO_FEATURES);
|
|
|
return conn_send_command(connection, sock, P_CONNECTION_FEATURES, sizeof(*p), NULL, 0);
|
|
|
}
|
|
|
|
|
@@ -4741,10 +4747,14 @@ static int drbd_do_features(struct drbd_connection *connection)
|
|
|
goto incompat;
|
|
|
|
|
|
connection->agreed_pro_version = min_t(int, PRO_VERSION_MAX, p->protocol_max);
|
|
|
+ connection->agreed_features = PRO_FEATURES & be32_to_cpu(p->feature_flags);
|
|
|
|
|
|
drbd_info(connection, "Handshake successful: "
|
|
|
"Agreed network protocol version %d\n", connection->agreed_pro_version);
|
|
|
|
|
|
+ drbd_info(connection, "Agreed to%ssupport TRIM on protocol level\n",
|
|
|
+ connection->agreed_features & FF_TRIM ? " " : " not ");
|
|
|
+
|
|
|
return 1;
|
|
|
|
|
|
incompat:
|