File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -772,8 +772,6 @@ static int ubd_open_dev(struct ubd *ubd_dev)
772
772
ubd_dev -> fd = fd ;
773
773
774
774
if (ubd_dev -> cow .file != NULL ){
775
- blk_queue_max_hw_sectors (ubd_dev -> queue , 8 * sizeof (long ));
776
-
777
775
err = - ENOMEM ;
778
776
ubd_dev -> cow .bitmap = vmalloc (ubd_dev -> cow .bitmap_len );
779
777
if (ubd_dev -> cow .bitmap == NULL ){
@@ -795,10 +793,6 @@ static int ubd_open_dev(struct ubd *ubd_dev)
795
793
if (err < 0 ) goto error ;
796
794
ubd_dev -> cow .fd = err ;
797
795
}
798
- if (ubd_dev -> no_trim == 0 ) {
799
- blk_queue_max_discard_sectors (ubd_dev -> queue , UBD_MAX_REQUEST );
800
- blk_queue_max_write_zeroes_sectors (ubd_dev -> queue , UBD_MAX_REQUEST );
801
- }
802
796
return 0 ;
803
797
error :
804
798
os_close_file (ubd_dev -> fd );
@@ -867,6 +861,13 @@ static int ubd_add(int n, char **error_out)
867
861
if (ubd_dev -> file == NULL )
868
862
goto out ;
869
863
864
+ if (ubd_dev -> cow .file )
865
+ lim .max_hw_sectors = 8 * sizeof (long );
866
+ if (!ubd_dev -> no_trim ) {
867
+ lim .max_hw_discard_sectors = UBD_MAX_REQUEST ;
868
+ lim .max_write_zeroes_sectors = UBD_MAX_REQUEST ;
869
+ }
870
+
870
871
err = ubd_file_size (ubd_dev , & ubd_dev -> size );
871
872
if (err < 0 ){
872
873
* error_out = "Couldn't determine size of device's file" ;
You can’t perform that action at this time.
0 commit comments