]> www.infradead.org Git - mtd-utils.git/commitdiff
ubi-tests: update to recent libubi changes
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Sun, 23 Dec 2007 16:32:09 +0000 (18:32 +0200)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Sun, 23 Dec 2007 16:32:09 +0000 (18:32 +0200)
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
tests/ubi-tests/common.c
tests/ubi-tests/integ.c
tests/ubi-tests/io_basic.c
tests/ubi-tests/io_paral.c
tests/ubi-tests/io_read.c
tests/ubi-tests/io_update.c
tests/ubi-tests/mkvol_bad.c
tests/ubi-tests/mkvol_basic.c
tests/ubi-tests/rmvol.c
tests/ubi-tests/rsvol.c

index cb63e775d81a8930d81b56f928fdf702ed12c36d..1343ec194a6b3db97147ecfe8a5f3b94c38f7444 100644 (file)
@@ -68,11 +68,11 @@ int __initial_check(const char *test, int argc, char * const argv[])
                goto close;
        }
 
-       if (dev_info.avail_ebs < MIN_AVAIL_EBS) {
+       if (dev_info.avail_lebs < MIN_AVAIL_EBS) {
                __err_msg(test, __FUNCTION__, __LINE__,
                          "insufficient available eraseblocks %d on UBI "
                          "device, required %d",
-                         dev_info.avail_ebs, MIN_AVAIL_EBS);
+                         dev_info.avail_lebs, MIN_AVAIL_EBS);
                goto close;
        }
 
@@ -146,7 +146,7 @@ int __check_volume(libubi_t libubi, struct ubi_dev_info *dev_info,
 {
        int ret;
        struct ubi_vol_info vol_info;
-       int eb_size;
+       int leb_size;
        long long rsvd_bytes;
 
        ret = ubi_get_vol_info1(libubi, dev_info->dev_num, vol_id, &vol_info);
@@ -178,17 +178,17 @@ int __check_volume(libubi_t libubi, struct ubi_dev_info *dev_info,
                return -1;
        }
 
-       eb_size = dev_info->eb_size - (dev_info->eb_size % req->alignment);
-       if (eb_size != vol_info.eb_size) {
+       leb_size = dev_info->leb_size - (dev_info->leb_size % req->alignment);
+       if (leb_size != vol_info.leb_size) {
                __err_msg(test, func, line,
                          "bad usable LEB size %d, should be %d",
-                         vol_info.eb_size, eb_size);
+                         vol_info.leb_size, leb_size);
                return -1;
        }
 
        rsvd_bytes = req->bytes;
-       if (rsvd_bytes % eb_size)
-               rsvd_bytes += eb_size - (rsvd_bytes % eb_size);
+       if (rsvd_bytes % leb_size)
+               rsvd_bytes += leb_size - (rsvd_bytes % leb_size);
 
        if (rsvd_bytes != vol_info.rsvd_bytes) {
                __err_msg(test, func, line,
index 4da712117f875f341460764977d1e6f98f59fddf..e8bffabb330251cb88b4c2eeb28430ef83b5369f 100644 (file)
@@ -228,11 +228,11 @@ static void check_erase_block(struct erase_block_info *erase_block, int fd)
 {
        struct write_info *w;
        off64_t gap_end;
-       int eb_size = erase_block->volume->info.eb_size;
+       int leb_size = erase_block->volume->info.leb_size;
        ssize_t bytes_read;
 
        w = erase_block->writes;
-       gap_end = erase_block->offset + eb_size;
+       gap_end = erase_block->offset + leb_size;
        while (w) {
                if (w->offset + w->size < gap_end) {
                        /* There is a gap. Check all 0xff */
@@ -294,7 +294,7 @@ static void check_erase_block(struct erase_block_info *erase_block, int fd)
 static int write_to_erase_block(struct erase_block_info *erase_block, int fd)
 {
        int page_size = erase_block->volume->ubi_device->info.min_io_size;
-       int eb_size = erase_block->volume->info.eb_size;
+       int leb_size = erase_block->volume->info.leb_size;
        int next_offset = 0;
        int space, size;
        off64_t offset;
@@ -303,14 +303,14 @@ static int write_to_erase_block(struct erase_block_info *erase_block, int fd)
 
        if (erase_block->writes)
                next_offset = erase_block->writes->offset_within_block + erase_block->writes->size;
-       space = eb_size - next_offset;
+       space = leb_size - next_offset;
        if (space <= 0)
                return 0; /* No space */
        if (!get_random_number(10)) {
                /* 1 time in 10 leave a gap */
                next_offset += get_random_number(space);
                next_offset = (next_offset / page_size) * page_size;
-               space = eb_size - next_offset;
+               space = leb_size - next_offset;
        }
        if (get_random_number(2))
                size = 1 * page_size;
@@ -329,7 +329,7 @@ static int write_to_erase_block(struct erase_block_info *erase_block, int fd)
        }
        if (size == 0 || size > space)
                size = page_size;
-       if (next_offset + size > eb_size)
+       if (next_offset + size > leb_size)
                error_exit("internal error");
        offset = erase_block->offset + next_offset;
        if (offset < erase_block->top_of_data)
@@ -420,7 +420,7 @@ static void operate_on_open_volume(struct volume_fd *vol_fd)
                close_volume(vol_fd);
        else {
                /* Pick an erase block at random */
-               int eb_no = get_random_number(vol_fd->volume->info.rsvd_ebs);
+               int eb_no = get_random_number(vol_fd->volume->info.rsvd_lebs);
                operate_on_erase_block(&vol_fd->volume->erase_blocks[eb_no], vol_fd->fd);
        }
 }
@@ -471,7 +471,7 @@ static void operate_on_ubi_device(struct ubi_device_info *ubi_device)
 
                req.vol_id = UBI_VOL_NUM_AUTO;
                req.alignment = 1; /* TODO: What is this? */
-               req.bytes = ubi_device->info.eb_size * max_ebs_per_vol;
+               req.bytes = ubi_device->info.leb_size * max_ebs_per_vol;
                if (req.bytes == 0 || req.bytes > ubi_device->info.avail_bytes)
                        req.bytes = ubi_device->info.avail_bytes;
                req.vol_type = UBI_DYNAMIC_VOLUME;
@@ -482,12 +482,12 @@ static void operate_on_ubi_device(struct ubi_device_info *ubi_device)
                s->ubi_device = ubi_device;
                if (ubi_get_vol_info1(libubi, ubi_device->info.dev_num, req.vol_id, &s->info))
                        error_exit("ubi_get_vol_info failed");
-               n = s->info.rsvd_ebs;
+               n = s->info.rsvd_lebs;
                s->erase_blocks = allocate(sizeof(struct erase_block_info) * n);
                for (i = 0; i < n; ++i) {
                        s->erase_blocks[i].volume = s;
                        s->erase_blocks[i].block_number = i;
-                       s->erase_blocks[i].offset = i * (off64_t) s->info.eb_size;
+                       s->erase_blocks[i].offset = i * (off64_t) s->info.leb_size;
                        s->erase_blocks[i].top_of_data = s->erase_blocks[i].offset;
                }
                /* FIXME: Correctly get device file name */
@@ -551,10 +551,10 @@ static void get_ubi_devices_info(void)
                /* FIXME: Correctly get device file name */
                sprintf(dev_name, "/dev/ubi%d", i);
                s->device_file_name = strdup(dev_name);
-               if (buf_size < s->info.eb_size)
-                       buf_size = s->info.eb_size;
-               if (max_ebs_per_vol && s->info.eb_size * max_ebs_per_vol < s->info.avail_bytes)
-                       total_space += s->info.eb_size * max_ebs_per_vol;
+               if (buf_size < s->info.leb_size)
+                       buf_size = s->info.leb_size;
+               if (max_ebs_per_vol && s->info.leb_size * max_ebs_per_vol < s->info.avail_bytes)
+                       total_space += s->info.leb_size * max_ebs_per_vol;
                else
                        total_space += s->info.avail_bytes;
        }
@@ -603,7 +603,7 @@ static void check_volume(struct volume_info *vol)
        fd = open(vol->device_file_name, O_RDWR | O_LARGEFILE);
        if (fd == -1)
                error_exit("Failed to open volume device file");
-       for (pos = 0; pos < vol->info.rsvd_ebs; ++pos)
+       for (pos = 0; pos < vol->info.rsvd_lebs; ++pos)
                check_erase_block(eb++, fd);
        if (close(fd) == -1)
                error_exit("Failed to close volume device file");
index 2e8809a3c4cdbee8b08f6dfb10a445e98f7f3a6f..26544cca5d08c7bbe699090a2609c80c8d9ac9e7 100644 (file)
@@ -135,7 +135,7 @@ static int test_aligned(int type)
        struct ubi_mkvol_request req;
        const char *name = TESTNAME ":test_aligned()";
        char vol_node[strlen(UBI_VOLUME_PATTERN) + 100];
-       int alignments[] = ALIGNMENTS(dev_info.eb_size);
+       int alignments[] = ALIGNMENTS(dev_info.leb_size);
 
        req.vol_type = type;
        req.name = name;
@@ -148,7 +148,7 @@ static int test_aligned(int type)
                if (req.alignment == 0)
                        req.alignment = dev_info.min_io_size;
 
-               ebsz = dev_info.eb_size - dev_info.eb_size % req.alignment;
+               ebsz = dev_info.leb_size - dev_info.leb_size % req.alignment;
                req.bytes = MIN_AVAIL_EBS * ebsz;
 
                if (ubi_mkvol(libubi, node, &req)) {
index 488a0b0093aa0e42e5703dd8d48a84f5412a7a3e..3d1b901e8449b87524399c67ff68dfeee4841e8f 100644 (file)
@@ -84,12 +84,12 @@ int main(int argc, char * const argv[])
        mem_limit = memory_limit();
        if (mem_limit && mem_limit < dev_info.avail_bytes)
                total_bytes = req.bytes =
-                               (mem_limit / dev_info.eb_size / THREADS_NUM)
-                               * dev_info.eb_size;
+                               (mem_limit / dev_info.leb_size / THREADS_NUM)
+                               * dev_info.leb_size;
        else
                total_bytes = req.bytes =
-                               ((dev_info.avail_ebs - 3) / THREADS_NUM)
-                               * dev_info.eb_size;
+                               ((dev_info.avail_lebs - 3) / THREADS_NUM)
+                               * dev_info.leb_size;
        for (i = 0; i < THREADS_NUM; i++) {
                char name[100];
 
@@ -108,7 +108,7 @@ int main(int argc, char * const argv[])
        req.vol_id = THREADS_NUM;
        req.name = TESTNAME ":static";
        req.vol_type = UBI_DYNAMIC_VOLUME;
-       req.bytes = 3*dev_info.eb_size;
+       req.bytes = 3*dev_info.leb_size;
        if (ubi_mkvol(libubi, node, &req)) {
                failed("ubi_mkvol");
                goto remove;
index c5d1da70bf2c94f4956d03448b33fd29f17b938d..3fccf930cb5487c502024fcf477bb3b6b889ccc5 100644 (file)
@@ -184,13 +184,13 @@ static int test_read1(struct ubi_vol_info *vol_info);
 static int test_read(int type)
 {
        const char *name = TESTNAME ":test_read()";
-       int alignments[] = ALIGNMENTS(dev_info.eb_size);
+       int alignments[] = ALIGNMENTS(dev_info.leb_size);
        char vol_node[strlen(UBI_VOLUME_PATTERN) + 100];
        struct ubi_mkvol_request req;
        int i;
 
        for (i = 0; i < sizeof(alignments)/sizeof(int); i++) {
-               int eb_size;
+               int leb_size;
                struct ubi_vol_info vol_info;
 
                req.vol_id = UBI_VOL_NUM_AUTO;
@@ -202,8 +202,8 @@ static int test_read(int type)
                if (req.alignment == 0)
                        req.alignment = dev_info.min_io_size;
 
-               eb_size = dev_info.eb_size - dev_info.eb_size % req.alignment;
-               req.bytes =  MIN_AVAIL_EBS * eb_size;
+               leb_size = dev_info.leb_size - dev_info.leb_size % req.alignment;
+               req.bytes =  MIN_AVAIL_EBS * leb_size;
 
                if (ubi_mkvol(libubi, node, &req)) {
                        failed("ubi_mkvol");
@@ -254,7 +254,7 @@ static int test_read1(struct ubi_vol_info *vol_info)
 {
        int i, written = 0;
        char vol_node[strlen(UBI_VOLUME_PATTERN) + 100];
-       int lengthes[] = LENGTHES(dev_info.min_io_size, vol_info->eb_size);
+       int lengthes[] = LENGTHES(dev_info.min_io_size, vol_info->leb_size);
 
        sprintf(&vol_node[0], UBI_VOLUME_PATTERN, dev_info.dev_num,
                vol_info->vol_id);
@@ -336,7 +336,7 @@ static int test_read3(const struct ubi_vol_info *vol_info, int len, off_t off);
 static int test_read2(const struct ubi_vol_info *vol_info, int len)
 {
        int i;
-       off_t offsets[] = OFFSETS(dev_info.min_io_size, vol_info->eb_size,
+       off_t offsets[] = OFFSETS(dev_info.min_io_size, vol_info->leb_size,
                                  vol_info->data_bytes);
 
        for (i = 0; i < sizeof(offsets)/sizeof(off_t); i++) {
index 2e3422a62748d92755c566dd4d0a919f551962f5..543cb8c24a8f1bc34119dc17dc0b72781c9d0144 100644 (file)
@@ -85,13 +85,13 @@ static int test_update(int type)
 {
        struct ubi_mkvol_request req;
        const char *name = TESTNAME ":io_update()";
-       int alignments[] = ALIGNMENTS(dev_info.eb_size);
+       int alignments[] = ALIGNMENTS(dev_info.leb_size);
        struct ubi_vol_info vol_info;
        char vol_node[strlen(UBI_VOLUME_PATTERN) + 100];
        int i;
 
        for (i = 0; i < sizeof(alignments)/sizeof(int); i++) {
-               int eb_size;
+               int leb_size;
 
                req.vol_id = UBI_VOL_NUM_AUTO;
                req.vol_type = type;
@@ -102,8 +102,8 @@ static int test_update(int type)
                if (req.alignment == 0)
                        req.alignment = dev_info.min_io_size;
 
-               eb_size = dev_info.eb_size - dev_info.eb_size % req.alignment;
-               req.bytes =  MIN_AVAIL_EBS * eb_size;
+               leb_size = dev_info.leb_size - dev_info.leb_size % req.alignment;
+               req.bytes =  MIN_AVAIL_EBS * leb_size;
 
                if (ubi_mkvol(libubi, node, &req)) {
                        failed("ubi_mkvol");
@@ -166,7 +166,7 @@ remove:
 static int test_update1(struct ubi_vol_info *vol_info)
 {
        int sequences[SEQ_SZ][3] = SEQUENCES(dev_info.min_io_size,
-                                            vol_info->eb_size);
+                                            vol_info->leb_size);
        char vol_node[strlen(UBI_VOLUME_PATTERN) + 100];
        unsigned char buf[vol_info->rsvd_bytes];
        int fd, i, j;
@@ -265,7 +265,7 @@ static int test_update_ff(void)
        struct ubi_vol_info vol_info;
        char vol_node[strlen(UBI_VOLUME_PATTERN) + 100];
        int i, fd, ret, types[2];
-       int upd_len = MIN_AVAIL_EBS * dev_info.eb_size;
+       int upd_len = MIN_AVAIL_EBS * dev_info.leb_size;
        char buf[upd_len], buf1[upd_len];
 
        for(i = 0; i < MIN_AVAIL_EBS; i++) {
index 023b06b2462a0fea6345f60ff25643302f88af64..5f2ddf0b26aeb8ea570dfccf34b7e7fca15fea44 100644 (file)
@@ -108,7 +108,7 @@ static int test_mkvol(void)
                         req.alignment))
                return -1;
 
-       req.alignment = dev_info.eb_size + 1;
+       req.alignment = dev_info.leb_size + 1;
        ret = ubi_mkvol(libubi, node, &req);
        if (check_failed(ret, EINVAL, "ubi_mkvol", "alignment = %d",
                         req.alignment))
@@ -139,16 +139,16 @@ static int test_mkvol(void)
        if (check_failed(ret, ENOSPC, "ubi_mkvol", "bytes = %lld", req.bytes))
                return -1;
 
-       req.alignment = dev_info.eb_size - dev_info.min_io_size;
-       req.bytes = (dev_info.eb_size - dev_info.eb_size % req.alignment) *
-                   dev_info.avail_ebs + 1;
+       req.alignment = dev_info.leb_size - dev_info.min_io_size;
+       req.bytes = (dev_info.leb_size - dev_info.leb_size % req.alignment) *
+                   dev_info.avail_lebs + 1;
        ret = ubi_mkvol(libubi, node, &req);
        if (check_failed(ret, ENOSPC, "ubi_mkvol", "bytes = %lld", req.bytes))
                return -1;
 
        /* Bad vol_type */
        req.alignment = 1;
-       req.bytes = dev_info.eb_size;
+       req.bytes = dev_info.leb_size;
        req.vol_type = UBI_DYNAMIC_VOLUME + UBI_STATIC_VOLUME;
        ret = ubi_mkvol(libubi, node, &req);
        if (check_failed(ret, EINVAL, "ubi_mkvol", "vol_type = %d",
index e2120e9557602866d35c19aa354d3f637e0ad9f9..f9f1c6936276eec2f1e0780aa8c9d2a28a34eeee 100644 (file)
@@ -80,7 +80,7 @@ static int mkvol_alignment(void)
        struct ubi_mkvol_request req;
        int i, vol_id, ebsz;
        const char *name = TESTNAME ":mkvol_alignment()";
-       int alignments[] = ALIGNMENTS(dev_info.eb_size);
+       int alignments[] = ALIGNMENTS(dev_info.leb_size);
 
        for (i = 0; i < sizeof(alignments)/sizeof(int); i++) {
                req.vol_id = UBI_VOL_NUM_AUTO;
@@ -92,8 +92,8 @@ static int mkvol_alignment(void)
                        req.alignment = dev_info.min_io_size;
 
                /* Bear in mind alignment reduces EB size */
-               ebsz = dev_info.eb_size - dev_info.eb_size % req.alignment;
-               req.bytes = dev_info.avail_ebs * ebsz;
+               ebsz = dev_info.leb_size - dev_info.leb_size % req.alignment;
+               req.bytes = dev_info.avail_lebs * ebsz;
 
                req.vol_type = UBI_DYNAMIC_VOLUME;
                req.name = name;
index fb9b344c262f95a2a0e1b6e4832c1d83f4cbdabe..6c523193f61013604b65c5da13c396be3b1cf611 100644 (file)
@@ -33,7 +33,7 @@
 #define TESTNAME "rmvol"
 #include "common.h"
 
-#define SYSFS_FILE "/sys/class/ubi/ubi%d_%d/usable_eb_size"
+#define SYSFS_FILE "/sys/class/ubi/ubi%d_%d/usable_leb_size"
 
 int main(int argc, char * const argv[])
 {
@@ -64,7 +64,7 @@ int main(int argc, char * const argv[])
        /* Create a small dynamic volume */
        req.vol_id = UBI_VOL_NUM_AUTO;
        req.alignment = dev_info.min_io_size;
-       req.bytes = dev_info.eb_size;
+       req.bytes = dev_info.leb_size;
        req.vol_type = UBI_DYNAMIC_VOLUME;
        req.name = "rmvol";
 
@@ -134,7 +134,7 @@ static int mkvol_alignment(void)
        struct ubi_mkvol_request req;
        int i, vol_id, ebsz;
        const char *name = TESTNAME ":mkvol_alignment()";
-       int alignments[] = ALIGNMENTS(dev_info.eb_size);
+       int alignments[] = ALIGNMENTS(dev_info.leb_size);
 
        for (i = 0; i < sizeof(alignments)/sizeof(int); i++) {
                req.vol_id = UBI_VOL_NUM_AUTO;
@@ -146,8 +146,8 @@ static int mkvol_alignment(void)
                        req.alignment = dev_info.min_io_size;
 
                /* Bear in mind alignment reduces EB size */
-               ebsz = dev_info.eb_size - dev_info.eb_size % req.alignment;
-               req.bytes = dev_info.avail_ebs * ebsz;
+               ebsz = dev_info.leb_size - dev_info.leb_size % req.alignment;
+               req.bytes = dev_info.avail_lebs * ebsz;
 
                req.vol_type = UBI_DYNAMIC_VOLUME;
                req.name = name;
index 7a9e5ea03ebc05a795ecdc2bf3324fb18fdf5543..d05d05a8b8c955a96ba7965f330a21219165f8f0 100644 (file)
@@ -88,7 +88,7 @@ static int test_basic(int type)
 
        req.vol_id = UBI_VOL_NUM_AUTO;
        req.alignment = 1;
-       req.bytes = MIN_AVAIL_EBS * dev_info.eb_size;
+       req.bytes = MIN_AVAIL_EBS * dev_info.leb_size;
        req.vol_type = type;
        req.name = name;
 
@@ -97,7 +97,7 @@ static int test_basic(int type)
                return -1;
        }
 
-       req.bytes = dev_info.eb_size;
+       req.bytes = dev_info.leb_size;
        if (ubi_rsvol(libubi, node, req.vol_id, req.bytes)) {
                failed("ubi_rsvol");
                goto remove;
@@ -106,7 +106,7 @@ static int test_basic(int type)
        if (check_volume(req.vol_id, &req))
                goto remove;
 
-       req.bytes = (MIN_AVAIL_EBS + 1) * dev_info.eb_size;
+       req.bytes = (MIN_AVAIL_EBS + 1) * dev_info.leb_size;
        if (ubi_rsvol(libubi, node, req.vol_id, req.bytes)) {
                failed("ubi_rsvol");
                goto remove;
@@ -148,13 +148,13 @@ static int test_rsvol1(struct ubi_vol_info *vol_info);
 static int test_rsvol(int type)
 {
        const char *name = TESTNAME "test_rsvol:()";
-       int alignments[] = ALIGNMENTS(dev_info.eb_size);
+       int alignments[] = ALIGNMENTS(dev_info.leb_size);
        char vol_node[strlen(UBI_VOLUME_PATTERN) + 100];
        struct ubi_mkvol_request req;
        int i;
 
        for (i = 0; i < sizeof(alignments)/sizeof(int); i++) {
-               int eb_size;
+               int leb_size;
                struct ubi_vol_info vol_info;
 
                req.vol_id = UBI_VOL_NUM_AUTO;
@@ -166,8 +166,8 @@ static int test_rsvol(int type)
                if (req.alignment == 0)
                        req.alignment = dev_info.min_io_size;
 
-               eb_size = dev_info.eb_size - dev_info.eb_size % req.alignment;
-               req.bytes =  MIN_AVAIL_EBS * eb_size;
+               leb_size = dev_info.leb_size - dev_info.leb_size % req.alignment;
+               req.bytes =  MIN_AVAIL_EBS * leb_size;
 
                if (ubi_mkvol(libubi, node, &req)) {
                        failed("ubi_mkvol");
@@ -212,7 +212,7 @@ static int test_rsvol1(struct ubi_vol_info *vol_info)
        int fd, i, ret;
 
        /* Make the volume smaller and check basic volume I/O */
-       bytes = vol_info->rsvd_bytes - vol_info->eb_size;
+       bytes = vol_info->rsvd_bytes - vol_info->leb_size;
        if (ubi_rsvol(libubi, node, vol_info->vol_id, bytes - 1)) {
                failed("ubi_rsvol");
                return -1;
@@ -230,9 +230,9 @@ static int test_rsvol1(struct ubi_vol_info *vol_info)
                return -1;
        }
 
-       if (vol_info1.rsvd_ebs != vol_info->rsvd_ebs - 1) {
-               err_msg("rsvd_ebs %d, must be %d",
-                       vol_info1.rsvd_ebs, vol_info->rsvd_ebs - 1);
+       if (vol_info1.rsvd_lebs != vol_info->rsvd_lebs - 1) {
+               err_msg("rsvd_lebs %d, must be %d",
+                       vol_info1.rsvd_lebs, vol_info->rsvd_lebs - 1);
                return -1;
        }
 
@@ -247,7 +247,7 @@ static int test_rsvol1(struct ubi_vol_info *vol_info)
                return -1;
        }
 
-       bytes = vol_info->rsvd_bytes - vol_info->eb_size - 1;
+       bytes = vol_info->rsvd_bytes - vol_info->leb_size - 1;
        if (ubi_update_start(libubi, fd, bytes)) {
                failed("ubi_update_start");
                goto close;
@@ -270,7 +270,7 @@ static int test_rsvol1(struct ubi_vol_info *vol_info)
        }
 
        if (ubi_rsvol(libubi, node, vol_info->vol_id,
-                     vol_info->eb_size * dev_info.avail_ebs)) {
+                     vol_info->leb_size * dev_info.avail_lebs)) {
                failed("ubi_rsvol");
                return -1;
        }