Skip to content

Commit 1e6ec9e

Browse files
osandovaxboe
authored andcommitted
Revert "loop: support 4k physical blocksize"
There's some stuff still up in the air, let's not get stuck with a subpar ABI. I'll follow up with something better for 4.14. Signed-off-by: Omar Sandoval <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent ea0ea2b commit 1e6ec9e

File tree

3 files changed

+6
-40
lines changed

3 files changed

+6
-40
lines changed

drivers/block/loop.c

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,7 @@ static void __loop_update_dio(struct loop_device *lo, bool dio)
221221
}
222222

223223
static int
224-
figure_loop_size(struct loop_device *lo, loff_t offset, loff_t sizelimit,
225-
loff_t logical_blocksize)
224+
figure_loop_size(struct loop_device *lo, loff_t offset, loff_t sizelimit)
226225
{
227226
loff_t size = get_size(offset, sizelimit, lo->lo_backing_file);
228227
sector_t x = (sector_t)size;
@@ -234,12 +233,6 @@ figure_loop_size(struct loop_device *lo, loff_t offset, loff_t sizelimit,
234233
lo->lo_offset = offset;
235234
if (lo->lo_sizelimit != sizelimit)
236235
lo->lo_sizelimit = sizelimit;
237-
if (lo->lo_flags & LO_FLAGS_BLOCKSIZE) {
238-
lo->lo_logical_blocksize = logical_blocksize;
239-
blk_queue_physical_block_size(lo->lo_queue, lo->lo_blocksize);
240-
blk_queue_logical_block_size(lo->lo_queue,
241-
lo->lo_logical_blocksize);
242-
}
243236
set_capacity(lo->lo_disk, x);
244237
bd_set_size(bdev, (loff_t)get_capacity(bdev->bd_disk) << 9);
245238
/* let user-space know about the new size */
@@ -820,7 +813,6 @@ static void loop_config_discard(struct loop_device *lo)
820813
struct file *file = lo->lo_backing_file;
821814
struct inode *inode = file->f_mapping->host;
822815
struct request_queue *q = lo->lo_queue;
823-
int lo_bits = 9;
824816

825817
/*
826818
* We use punch hole to reclaim the free space used by the
@@ -840,11 +832,9 @@ static void loop_config_discard(struct loop_device *lo)
840832

841833
q->limits.discard_granularity = inode->i_sb->s_blocksize;
842834
q->limits.discard_alignment = 0;
843-
if (lo->lo_flags & LO_FLAGS_BLOCKSIZE)
844-
lo_bits = blksize_bits(lo->lo_logical_blocksize);
845835

846-
blk_queue_max_discard_sectors(q, UINT_MAX >> lo_bits);
847-
blk_queue_max_write_zeroes_sectors(q, UINT_MAX >> lo_bits);
836+
blk_queue_max_discard_sectors(q, UINT_MAX >> 9);
837+
blk_queue_max_write_zeroes_sectors(q, UINT_MAX >> 9);
848838
queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, q);
849839
}
850840

@@ -938,7 +928,6 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode,
938928

939929
lo->use_dio = false;
940930
lo->lo_blocksize = lo_blocksize;
941-
lo->lo_logical_blocksize = 512;
942931
lo->lo_device = bdev;
943932
lo->lo_flags = lo_flags;
944933
lo->lo_backing_file = file;
@@ -1104,7 +1093,6 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info)
11041093
int err;
11051094
struct loop_func_table *xfer;
11061095
kuid_t uid = current_uid();
1107-
int lo_flags = lo->lo_flags;
11081096

11091097
if (lo->lo_encrypt_key_size &&
11101098
!uid_eq(lo->lo_key_owner, uid) &&
@@ -1137,26 +1125,9 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info)
11371125
if (err)
11381126
goto exit;
11391127

1140-
if (info->lo_flags & LO_FLAGS_BLOCKSIZE) {
1141-
if (!(lo->lo_flags & LO_FLAGS_BLOCKSIZE))
1142-
lo->lo_logical_blocksize = 512;
1143-
lo->lo_flags |= LO_FLAGS_BLOCKSIZE;
1144-
if (LO_INFO_BLOCKSIZE(info) != 512 &&
1145-
LO_INFO_BLOCKSIZE(info) != 1024 &&
1146-
LO_INFO_BLOCKSIZE(info) != 2048 &&
1147-
LO_INFO_BLOCKSIZE(info) != 4096)
1148-
return -EINVAL;
1149-
if (LO_INFO_BLOCKSIZE(info) > lo->lo_blocksize)
1150-
return -EINVAL;
1151-
}
1152-
11531128
if (lo->lo_offset != info->lo_offset ||
1154-
lo->lo_sizelimit != info->lo_sizelimit ||
1155-
lo->lo_flags != lo_flags ||
1156-
((lo->lo_flags & LO_FLAGS_BLOCKSIZE) &&
1157-
lo->lo_logical_blocksize != LO_INFO_BLOCKSIZE(info))) {
1158-
if (figure_loop_size(lo, info->lo_offset, info->lo_sizelimit,
1159-
LO_INFO_BLOCKSIZE(info))) {
1129+
lo->lo_sizelimit != info->lo_sizelimit) {
1130+
if (figure_loop_size(lo, info->lo_offset, info->lo_sizelimit)) {
11601131
err = -EFBIG;
11611132
goto exit;
11621133
}
@@ -1348,8 +1319,7 @@ static int loop_set_capacity(struct loop_device *lo)
13481319
if (unlikely(lo->lo_state != Lo_bound))
13491320
return -ENXIO;
13501321

1351-
return figure_loop_size(lo, lo->lo_offset, lo->lo_sizelimit,
1352-
lo->lo_logical_blocksize);
1322+
return figure_loop_size(lo, lo->lo_offset, lo->lo_sizelimit);
13531323
}
13541324

13551325
static int loop_set_dio(struct loop_device *lo, unsigned long arg)

drivers/block/loop.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ struct loop_device {
4949
struct file * lo_backing_file;
5050
struct block_device *lo_device;
5151
unsigned lo_blocksize;
52-
unsigned lo_logical_blocksize;
5352
void *key_data;
5453

5554
gfp_t old_gfp_mask;

include/uapi/linux/loop.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ enum {
2222
LO_FLAGS_AUTOCLEAR = 4,
2323
LO_FLAGS_PARTSCAN = 8,
2424
LO_FLAGS_DIRECT_IO = 16,
25-
LO_FLAGS_BLOCKSIZE = 32,
2625
};
2726

2827
#include <asm/posix_types.h> /* for __kernel_old_dev_t */
@@ -60,8 +59,6 @@ struct loop_info64 {
6059
__u64 lo_init[2];
6160
};
6261

63-
#define LO_INFO_BLOCKSIZE(l) (l)->lo_init[0]
64-
6562
/*
6663
* Loop filter types
6764
*/

0 commit comments

Comments
 (0)