aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Thompson <daniel.thompson@linaro.org>2017-08-02 12:17:18 +0100
committerDaniel Thompson <daniel.thompson@linaro.org>2017-08-02 12:17:18 +0100
commit05b8e07126b22128086aa37f57e986442e021c63 (patch)
treee7e5bb483082f7646d2b250045dc2318434a39a3
parentd8375f6fcb41e02671d3194da6fa9a8dee4bb863 (diff)
Revert "fs: ubifs: RDA support"
This reverts commit f036351e82caecf4da084d52f3c46b6d9bb0f10c.
-rw-r--r--fs/ubifs/io.c5
-rw-r--r--fs/ubifs/lpt.c5
-rw-r--r--fs/ubifs/master.c22
-rw-r--r--fs/ubifs/recovery.c40
-rw-r--r--fs/ubifs/replay.c20
-rw-r--r--fs/ubifs/sb.c5
-rw-r--r--fs/ubifs/scan.c18
-rw-r--r--fs/ubifs/super.c44
8 files changed, 39 insertions, 120 deletions
diff --git a/fs/ubifs/io.c b/fs/ubifs/io.c
index 1c3d275976..aae5c65eae 100644
--- a/fs/ubifs/io.c
+++ b/fs/ubifs/io.c
@@ -251,10 +251,7 @@ void ubifs_prepare_node(struct ubifs_info *c, void *node, int len, int pad)
if (pad) {
len = ALIGN(len, 8);
- if (is_power_of_2(c->min_io_size))
- pad = ALIGN(len, c->min_io_size) - len;
- else
- pad = roundup(len, c->min_io_size) - len;
+ pad = ALIGN(len, c->min_io_size) - len;
ubifs_pad(c, node + len, pad);
}
}
diff --git a/fs/ubifs/lpt.c b/fs/ubifs/lpt.c
index 542f4e0560..1a50d4cc27 100644
--- a/fs/ubifs/lpt.c
+++ b/fs/ubifs/lpt.c
@@ -123,10 +123,7 @@ static void do_calc_lpt_geom(struct ubifs_info *c)
sz -= c->leb_size;
tot_wastage += per_leb_wastage;
}
- if (is_power_of_2(c->min_io_size))
- tot_wastage += ALIGN(sz, c->min_io_size) - sz;
- else
- tot_wastage += roundup(sz, c->min_io_size) - sz;
+ tot_wastage += ALIGN(sz, c->min_io_size) - sz;
c->lpt_sz += tot_wastage;
}
diff --git a/fs/ubifs/master.c b/fs/ubifs/master.c
index e5f3bf1228..3f2926e870 100644
--- a/fs/ubifs/master.c
+++ b/fs/ubifs/master.c
@@ -108,22 +108,12 @@ static int validate_master(const struct ubifs_info *c)
goto out;
}
- if (c->min_io_shift == 0) {
- if (c->lhead_lnum < UBIFS_LOG_LNUM ||
- c->lhead_lnum >= UBIFS_LOG_LNUM + c->log_lebs ||
- c->lhead_offs < 0 || c->lhead_offs >= c->leb_size ||
- c->lhead_offs % c->min_io_size) {
- err = 4;
- goto out;
- }
- } else {
- if (c->lhead_lnum < UBIFS_LOG_LNUM ||
- c->lhead_lnum >= UBIFS_LOG_LNUM + c->log_lebs ||
- c->lhead_offs < 0 || c->lhead_offs >= c->leb_size ||
- c->lhead_offs & (c->min_io_size - 1)) {
- err = 4;
- goto out;
- }
+ if (c->lhead_lnum < UBIFS_LOG_LNUM ||
+ c->lhead_lnum >= UBIFS_LOG_LNUM + c->log_lebs ||
+ c->lhead_offs < 0 || c->lhead_offs >= c->leb_size ||
+ c->lhead_offs & (c->min_io_size - 1)) {
+ err = 4;
+ goto out;
}
if (c->zroot.lnum >= c->leb_cnt || c->zroot.lnum < c->main_first ||
diff --git a/fs/ubifs/recovery.c b/fs/ubifs/recovery.c
index 1350fcbd8c..744465005c 100644
--- a/fs/ubifs/recovery.c
+++ b/fs/ubifs/recovery.c
@@ -365,11 +365,7 @@ static int is_last_write(const struct ubifs_info *c, void *buf, int offs)
* Round up to the next c->min_io_size boundary i.e. 'offs' is in the
* last wbuf written. After that should be empty space.
*/
- if (c->min_io_shift == 0)
- empty_offs = roundup(offs + 1, c->min_io_size);
- else
- empty_offs = ALIGN(offs + 1, c->min_io_size);
-
+ empty_offs = ALIGN(offs + 1, c->min_io_size);
check_len = c->leb_size - empty_offs;
p = buf + empty_offs - offs;
@@ -405,10 +401,7 @@ static void clean_buf(const struct ubifs_info *c, void **buf, int lnum,
}
ubifs_assert(!(*offs & 7));
- if (c->min_io_shift == 0)
- empty_offs = roundup(*offs, c->min_io_size);
- else
- empty_offs = ALIGN(*offs, c->min_io_size);
+ empty_offs = ALIGN(*offs, c->min_io_size);
pad_len = empty_offs - *offs;
ubifs_pad(c, *buf, pad_len);
*offs += pad_len;
@@ -436,10 +429,7 @@ static int no_more_nodes(const struct ubifs_info *c, void *buf, int len,
int skip, dlen = le32_to_cpu(ch->len);
/* Check for empty space after the corrupt node's common header */
- if (c->min_io_shift == 0)
- skip = roundup(offs + UBIFS_CH_SZ, c->min_io_size) - offs;
- else
- skip = ALIGN(offs + UBIFS_CH_SZ, c->min_io_size) - offs;
+ skip = ALIGN(offs + UBIFS_CH_SZ, c->min_io_size) - offs;
if (is_empty(buf + skip, len - skip))
return 1;
/*
@@ -451,10 +441,7 @@ static int no_more_nodes(const struct ubifs_info *c, void *buf, int len,
return 0;
}
/* Now we know the corrupt node's length we can skip over it */
- if (c->min_io_shift == 0)
- skip = roundup(offs + dlen, c->min_io_size) - offs;
- else
- skip = ALIGN(offs + dlen, c->min_io_size) - offs;
+ skip = ALIGN(offs + dlen, c->min_io_size) - offs;
/* After which there should be empty space */
if (is_empty(buf + skip, len - skip))
return 1;
@@ -661,17 +648,9 @@ struct ubifs_scan_leb *ubifs_recover_leb(struct ubifs_info *c, int lnum,
need_clean = 1;
}
- if (c->min_io_shift == 0)
- {
- if (offs % c->min_io_size) {
- clean_buf(c, &buf, lnum, &offs, &len);
- need_clean = 1;
- }
- } else {
- if (offs & (c->min_io_size - 1)) {
- clean_buf(c, &buf, lnum, &offs, &len);
- need_clean = 1;
- }
+ if (offs % c->min_io_size) {
+ clean_buf(c, &buf, lnum, &offs, &len);
+ need_clean = 1;
}
ubifs_end_scan(c, sleb, lnum, offs);
@@ -968,10 +947,7 @@ static int clean_an_unclean_leb(const struct ubifs_info *c,
}
/* Pad to min_io_size */
- if (c->min_io_shift == 0)
- len = roundup(ucleb->endpt, c->min_io_size);
- else
- len = ALIGN(ucleb->endpt, c->min_io_size);
+ len = ALIGN(ucleb->endpt, c->min_io_size);
if (len > ucleb->endpt) {
int pad_len = len - ALIGN(ucleb->endpt, 8);
diff --git a/fs/ubifs/replay.c b/fs/ubifs/replay.c
index 1a351f606c..da33a14ab6 100644
--- a/fs/ubifs/replay.c
+++ b/fs/ubifs/replay.c
@@ -625,10 +625,7 @@ static int replay_bud(struct ubifs_info *c, int lnum, int offs, int jhead,
BUG();
ubifs_assert(sleb->endpt - offs >= used);
- if (c->min_io_shift == 0)
- ubifs_assert(sleb->endpt % c->min_io_size == 0);
- else
- ubifs_assert((sleb->endpt & (c->min_io_size - 1)) == 0);
+ ubifs_assert(sleb->endpt % c->min_io_size == 0);
*dirty = sleb->endpt - offs - used;
*free = c->leb_size - sleb->endpt;
@@ -798,17 +795,10 @@ static int validate_ref(struct ubifs_info *c, const struct ubifs_ref_node *ref)
* to the end of LEB and we write reference node for it during commit.
* So this is why we require 'offs > c->leb_size'.
*/
- if (c->min_io_shift == 0) {
- if (jhead >= c->jhead_cnt || lnum >= c->leb_cnt ||
- lnum < c->main_first || offs > c->leb_size ||
- offs % c->min_io_size)
- return -EINVAL;
- } else {
- if (jhead >= c->jhead_cnt || lnum >= c->leb_cnt ||
- lnum < c->main_first || offs > c->leb_size ||
- offs & (c->min_io_size - 1))
- return -EINVAL;
- }
+ if (jhead >= c->jhead_cnt || lnum >= c->leb_cnt ||
+ lnum < c->main_first || offs > c->leb_size ||
+ offs & (c->min_io_size - 1))
+ return -EINVAL;
/* Make sure we have not already looked at this bud */
bud = ubifs_search_bud(c, lnum);
diff --git a/fs/ubifs/sb.c b/fs/ubifs/sb.c
index ed61330c64..00c9cd31a0 100644
--- a/fs/ubifs/sb.c
+++ b/fs/ubifs/sb.c
@@ -199,10 +199,7 @@ struct ubifs_sb_node *ubifs_read_sb_node(struct ubifs_info *c)
struct ubifs_sb_node *sup;
int err;
- if (c->min_io_shift == 0)
- sup = kmalloc(roundup(UBIFS_SB_NODE_SZ, c->min_io_size), GFP_NOFS);
- else
- sup = kmalloc(ALIGN(UBIFS_SB_NODE_SZ, c->min_io_size), GFP_NOFS);
+ sup = kmalloc(ALIGN(UBIFS_SB_NODE_SZ, c->min_io_size), GFP_NOFS);
if (!sup)
return ERR_PTR(-ENOMEM);
diff --git a/fs/ubifs/scan.c b/fs/ubifs/scan.c
index 373ae2f9c4..0ed82479b4 100644
--- a/fs/ubifs/scan.c
+++ b/fs/ubifs/scan.c
@@ -177,14 +177,9 @@ void ubifs_end_scan(const struct ubifs_info *c, struct ubifs_scan_leb *sleb,
{
lnum = lnum;
dbg_scan("stop scanning LEB %d at offset %d", lnum, offs);
+ ubifs_assert(offs % c->min_io_size == 0);
- if (c->min_io_shift == 0) {
- ubifs_assert((offs % c->min_io_size) == 0);
- sleb->endpt = roundup(offs, c->min_io_size);
- } else {
- ubifs_assert((offs & (c->min_io_size - 1)) == 0);
- sleb->endpt = ALIGN(offs, c->min_io_size);
- }
+ sleb->endpt = ALIGN(offs, c->min_io_size);
}
/**
@@ -322,13 +317,8 @@ struct ubifs_scan_leb *ubifs_scan(const struct ubifs_info *c, int lnum,
len -= node_len;
}
- if (c->min_io_shift == 0) {
- if (offs % c->min_io_size)
- goto corrupted;
- } else {
- if (offs & (c->min_io_size - 1))
- goto corrupted;
- }
+ if (offs % c->min_io_size)
+ goto corrupted;
ubifs_end_scan(c, sleb, lnum, offs);
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 34702b1efc..26b48f029e 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -314,12 +314,7 @@ static int init_constants_early(struct ubifs_info *c)
c->leb_size = c->vi.usable_leb_size;
c->half_leb_size = c->leb_size / 2;
c->min_io_size = c->di.min_io_size;
- if (is_power_of_2(c->min_io_size))
- c->min_io_shift = fls(c->min_io_size) - 1;
- else
- c->min_io_shift = 0;
-
- ubifs_msg("UBI min_io_shift = %d \n", c->min_io_shift);
+ c->min_io_shift = fls(c->min_io_size) - 1;
if (c->leb_size < UBIFS_MIN_LEB_SZ) {
ubifs_err("too small LEBs (%d bytes), min. is %d bytes",
@@ -333,6 +328,11 @@ static int init_constants_early(struct ubifs_info *c)
return -EINVAL;
}
+ if (!is_power_of_2(c->min_io_size)) {
+ ubifs_err("bad min. I/O size %d", c->min_io_size);
+ return -EINVAL;
+ }
+
/*
* UBIFS aligns all node to 8-byte boundary, so to make function in
* io.c simpler, assume minimum I/O unit size to be 8 bytes if it is
@@ -343,13 +343,8 @@ static int init_constants_early(struct ubifs_info *c)
c->min_io_shift = 3;
}
- if (c->min_io_shift == 0) {
- c->ref_node_alsz = roundup(UBIFS_REF_NODE_SZ, c->min_io_size);
- c->mst_node_alsz = roundup(UBIFS_MST_NODE_SZ, c->min_io_size);
- } else {
- c->ref_node_alsz = ALIGN(UBIFS_REF_NODE_SZ, c->min_io_size);
- c->mst_node_alsz = ALIGN(UBIFS_MST_NODE_SZ, c->min_io_size);
- }
+ c->ref_node_alsz = ALIGN(UBIFS_REF_NODE_SZ, c->min_io_size);
+ c->mst_node_alsz = ALIGN(UBIFS_MST_NODE_SZ, c->min_io_size);
/*
* Initialize node length ranges which are mostly needed for node
@@ -388,13 +383,8 @@ static int init_constants_early(struct ubifs_info *c)
* Initialize dead and dark LEB space watermarks. See gc.c for comments
* about these values.
*/
- if (c->min_io_shift == 0) {
- c->dead_wm = roundup(MIN_WRITE_SZ, c->min_io_size);
- c->dark_wm = roundup(UBIFS_MAX_NODE_SZ, c->min_io_size);
- } else {
- c->dead_wm = ALIGN(MIN_WRITE_SZ, c->min_io_size);
- c->dark_wm = ALIGN(UBIFS_MAX_NODE_SZ, c->min_io_size);
- }
+ c->dead_wm = ALIGN(MIN_WRITE_SZ, c->min_io_size);
+ c->dark_wm = ALIGN(UBIFS_MAX_NODE_SZ, c->min_io_size);
/*
* Calculate how many bytes would be wasted at the end of LEB if it was
@@ -434,10 +424,7 @@ static int init_constants_sb(struct ubifs_info *c)
/* Make sure LEB size is large enough to fit full commit */
tmp = UBIFS_CS_NODE_SZ + UBIFS_REF_NODE_SZ * c->jhead_cnt;
- if (c->min_io_shift == 0)
- tmp = roundup(tmp, c->min_io_size);
- else
- tmp = ALIGN(tmp, c->min_io_size);
+ tmp = ALIGN(tmp, c->min_io_size);
if (tmp > c->leb_size) {
dbg_err("too small LEB size %d, at least %d needed",
c->leb_size, tmp);
@@ -668,13 +655,8 @@ static int mount_ubifs(struct ubifs_info *c)
if (err)
goto out_free;
- if (c->min_io_shift == 0) {
- sz = roundup(c->max_idx_node_sz, c->min_io_size);
- sz = roundup(sz + c->max_idx_node_sz, c->min_io_size);
- } else {
- sz = ALIGN(c->max_idx_node_sz, c->min_io_size);
- sz = ALIGN(sz + c->max_idx_node_sz, c->min_io_size);
- }
+ sz = ALIGN(c->max_idx_node_sz, c->min_io_size);
+ sz = ALIGN(sz + c->max_idx_node_sz, c->min_io_size);
c->cbuf = kmalloc(sz, GFP_NOFS);
if (!c->cbuf) {
err = -ENOMEM;