UBI: modify ubi_wl_flush function to clear work queue for a lnum
[pandora-kernel.git] / drivers / mtd / ubi / cdev.c
index ad76592..acec85d 100644 (file)
@@ -63,7 +63,7 @@ static int get_exclusive(struct ubi_volume_desc *desc)
        users = vol->readers + vol->writers + vol->exclusive;
        ubi_assert(users > 0);
        if (users > 1) {
-               dbg_err("%d users for volume %d", users, vol->vol_id);
+               ubi_err("%d users for volume %d", users, vol->vol_id);
                err = -EBUSY;
        } else {
                vol->readers = vol->writers = 0;
@@ -159,7 +159,7 @@ static loff_t vol_cdev_llseek(struct file *file, loff_t offset, int origin)
 
        if (vol->updating) {
                /* Update is in progress, seeking is prohibited */
-               dbg_err("updating");
+               ubi_err("updating");
                return -EBUSY;
        }
 
@@ -178,7 +178,7 @@ static loff_t vol_cdev_llseek(struct file *file, loff_t offset, int origin)
        }
 
        if (new_offset < 0 || new_offset > vol->used_bytes) {
-               dbg_err("bad seek %lld", new_offset);
+               ubi_err("bad seek %lld", new_offset);
                return -EINVAL;
        }
 
@@ -216,11 +216,11 @@ static ssize_t vol_cdev_read(struct file *file, __user char *buf, size_t count,
                count, *offp, vol->vol_id);
 
        if (vol->updating) {
-               dbg_err("updating");
+               ubi_err("updating");
                return -EBUSY;
        }
        if (vol->upd_marker) {
-               dbg_err("damaged volume, update marker is set");
+               ubi_err("damaged volume, update marker is set");
                return -EBADF;
        }
        if (*offp == vol->used_bytes || count == 0)
@@ -300,7 +300,7 @@ static ssize_t vol_cdev_direct_write(struct file *file, const char __user *buf,
 
        lnum = div_u64_rem(*offp, vol->usable_leb_size, &off);
        if (off & (ubi->min_io_size - 1)) {
-               dbg_err("unaligned position");
+               ubi_err("unaligned position");
                return -EINVAL;
        }
 
@@ -309,7 +309,7 @@ static ssize_t vol_cdev_direct_write(struct file *file, const char __user *buf,
 
        /* We can write only in fractions of the minimum I/O unit */
        if (count & (ubi->min_io_size - 1)) {
-               dbg_err("unaligned write length");
+               ubi_err("unaligned write length");
                return -EINVAL;
        }
 
@@ -334,8 +334,7 @@ static ssize_t vol_cdev_direct_write(struct file *file, const char __user *buf,
                        break;
                }
 
-               err = ubi_eba_write_leb(ubi, vol, lnum, tbuf, off, len,
-                                       UBI_UNKNOWN);
+               err = ubi_eba_write_leb(ubi, vol, lnum, tbuf, off, len);
                if (err)
                        break;
 
@@ -477,9 +476,6 @@ static long vol_cdev_ioctl(struct file *file, unsigned int cmd,
                if (req.lnum < 0 || req.lnum >= vol->reserved_pebs ||
                    req.bytes < 0 || req.lnum >= vol->usable_leb_size)
                        break;
-               if (req.dtype != UBI_LONGTERM && req.dtype != UBI_SHORTTERM &&
-                   req.dtype != UBI_UNKNOWN)
-                       break;
 
                err = get_exclusive(desc);
                if (err < 0)
@@ -518,7 +514,7 @@ static long vol_cdev_ioctl(struct file *file, unsigned int cmd,
                if (err)
                        break;
 
-               err = ubi_wl_flush(ubi);
+               err = ubi_wl_flush(ubi, UBI_ALL, UBI_ALL);
                break;
        }
 
@@ -532,7 +528,7 @@ static long vol_cdev_ioctl(struct file *file, unsigned int cmd,
                        err = -EFAULT;
                        break;
                }
-               err = ubi_leb_map(desc, req.lnum, req.dtype);
+               err = ubi_leb_map(desc, req.lnum);
                break;
        }
 
@@ -647,8 +643,8 @@ static int verify_mkvol_req(const struct ubi_device *ubi,
        return 0;
 
 bad:
-       dbg_err("bad volume creation request");
-       ubi_dbg_dump_mkvol_req(req);
+       ubi_err("bad volume creation request");
+       ubi_dump_mkvol_req(req);
        return err;
 }
 
@@ -713,12 +709,12 @@ static int rename_volumes(struct ubi_device *ubi,
        for (i = 0; i < req->count - 1; i++) {
                for (n = i + 1; n < req->count; n++) {
                        if (req->ents[i].vol_id == req->ents[n].vol_id) {
-                               dbg_err("duplicated volume id %d",
+                               ubi_err("duplicated volume id %d",
                                        req->ents[i].vol_id);
                                return -EINVAL;
                        }
                        if (!strcmp(req->ents[i].name, req->ents[n].name)) {
-                               dbg_err("duplicated volume name \"%s\"",
+                               ubi_err("duplicated volume name \"%s\"",
                                        req->ents[i].name);
                                return -EINVAL;
                        }
@@ -741,7 +737,7 @@ static int rename_volumes(struct ubi_device *ubi,
                re->desc = ubi_open_volume(ubi->ubi_num, vol_id, UBI_EXCLUSIVE);
                if (IS_ERR(re->desc)) {
                        err = PTR_ERR(re->desc);
-                       dbg_err("cannot open volume %d, error %d", vol_id, err);
+                       ubi_err("cannot open volume %d, error %d", vol_id, err);
                        kfree(re);
                        goto out_free;
                }
@@ -800,7 +796,7 @@ static int rename_volumes(struct ubi_device *ubi,
                                continue;
 
                        /* The volume exists but busy, or an error occurred */
-                       dbg_err("cannot open volume \"%s\", error %d",
+                       ubi_err("cannot open volume \"%s\", error %d",
                                re->new_name, err);
                        goto out_free;
                }