Commit d31f07fc authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] loop: remove LO_FLAGS_BH_REMAP

From: Hugh Dickins <hugh@veritas.com>

Jonah Sherman <jsherman@stuy.edu> pointed out back in February how
LO_FLAGS_BH_REMAP is never actually set, since loop_init_xfer only calls
the init for non-0 encryption type.  Fix that or scrap it?  Let's scrap it
for now, that path (hacking values in bio instead of copying data) seems
never to have been tested, and adds to the number of paths through loop:
leave that optimization to some other occasion.
parent 5651a85c
...@@ -120,12 +120,6 @@ static int transfer_xor(struct loop_device *lo, int cmd, char *raw_buf, ...@@ -120,12 +120,6 @@ static int transfer_xor(struct loop_device *lo, int cmd, char *raw_buf,
return 0; return 0;
} }
static int none_status(struct loop_device *lo, const struct loop_info64 *info)
{
lo->lo_flags |= LO_FLAGS_BH_REMAP;
return 0;
}
static int xor_status(struct loop_device *lo, const struct loop_info64 *info) static int xor_status(struct loop_device *lo, const struct loop_info64 *info)
{ {
if (info->lo_encrypt_key_size <= 0) if (info->lo_encrypt_key_size <= 0)
...@@ -136,7 +130,6 @@ static int xor_status(struct loop_device *lo, const struct loop_info64 *info) ...@@ -136,7 +130,6 @@ static int xor_status(struct loop_device *lo, const struct loop_info64 *info)
struct loop_func_table none_funcs = { struct loop_func_table none_funcs = {
.number = LO_CRYPT_NONE, .number = LO_CRYPT_NONE,
.transfer = transfer_none, .transfer = transfer_none,
.init = none_status,
}; };
struct loop_func_table xor_funcs = { struct loop_func_table xor_funcs = {
...@@ -480,14 +473,6 @@ static struct bio *loop_get_buffer(struct loop_device *lo, struct bio *rbh) ...@@ -480,14 +473,6 @@ static struct bio *loop_get_buffer(struct loop_device *lo, struct bio *rbh)
{ {
struct bio *bio; struct bio *bio;
/*
* for xfer_funcs that can operate on the same bh, do that
*/
if (lo->lo_flags & LO_FLAGS_BH_REMAP) {
bio = rbh;
goto out_bh;
}
/* /*
* When called on the page reclaim -> writepage path, this code can * When called on the page reclaim -> writepage path, this code can
* trivially consume all memory. So we drop PF_MEMALLOC to avoid * trivially consume all memory. So we drop PF_MEMALLOC to avoid
...@@ -507,8 +492,6 @@ static struct bio *loop_get_buffer(struct loop_device *lo, struct bio *rbh) ...@@ -507,8 +492,6 @@ static struct bio *loop_get_buffer(struct loop_device *lo, struct bio *rbh)
bio->bi_end_io = loop_end_io_transfer; bio->bi_end_io = loop_end_io_transfer;
bio->bi_private = rbh; bio->bi_private = rbh;
out_bh:
bio->bi_sector = rbh->bi_sector + (lo->lo_offset >> 9); bio->bi_sector = rbh->bi_sector + (lo->lo_offset >> 9);
bio->bi_rw = rbh->bi_rw; bio->bi_rw = rbh->bi_rw;
bio->bi_bdev = lo->lo_device; bio->bi_bdev = lo->lo_device;
......
...@@ -70,7 +70,6 @@ typedef int (* transfer_proc_t)(struct loop_device *, int cmd, ...@@ -70,7 +70,6 @@ typedef int (* transfer_proc_t)(struct loop_device *, int cmd,
*/ */
#define LO_FLAGS_DO_BMAP 1 #define LO_FLAGS_DO_BMAP 1
#define LO_FLAGS_READ_ONLY 2 #define LO_FLAGS_READ_ONLY 2
#define LO_FLAGS_BH_REMAP 4
#include <asm/posix_types.h> /* for __kernel_old_dev_t */ #include <asm/posix_types.h> /* for __kernel_old_dev_t */
#include <asm/types.h> /* for __u64 */ #include <asm/types.h> /* for __u64 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment