File tree Expand file tree Collapse file tree 1 file changed +17
-8
lines changed Expand file tree Collapse file tree 1 file changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -1231,24 +1231,33 @@ static unsigned int drbd_max_discard_sectors(struct drbd_connection *connection)
1231
1231
return AL_EXTENT_SIZE >> 9 ;
1232
1232
}
1233
1233
1234
- static void decide_on_discard_support (struct drbd_device * device ,
1234
+ static bool drbd_discard_supported (struct drbd_connection * connection ,
1235
1235
struct drbd_backing_dev * bdev )
1236
1236
{
1237
- struct drbd_connection * connection =
1238
- first_peer_device (device )-> connection ;
1239
- struct request_queue * q = device -> rq_queue ;
1240
- unsigned int max_discard_sectors ;
1241
-
1242
1237
if (bdev && !bdev_max_discard_sectors (bdev -> backing_bdev ))
1243
- goto not_supported ;
1238
+ return false ;
1244
1239
1245
1240
if (connection -> cstate >= C_CONNECTED &&
1246
1241
!(connection -> agreed_features & DRBD_FF_TRIM )) {
1247
1242
drbd_info (connection ,
1248
1243
"peer DRBD too old, does not support TRIM: disabling discards\n" );
1249
- goto not_supported ;
1244
+ return false ;
1250
1245
}
1251
1246
1247
+ return true;
1248
+ }
1249
+
1250
+ static void decide_on_discard_support (struct drbd_device * device ,
1251
+ struct drbd_backing_dev * bdev )
1252
+ {
1253
+ struct drbd_connection * connection =
1254
+ first_peer_device (device )-> connection ;
1255
+ struct request_queue * q = device -> rq_queue ;
1256
+ unsigned int max_discard_sectors ;
1257
+
1258
+ if (!drbd_discard_supported (connection , bdev ))
1259
+ goto not_supported ;
1260
+
1252
1261
/*
1253
1262
* We don't care for the granularity, really.
1254
1263
*
You can’t perform that action at this time.
0 commit comments