Loading drivers/mtd/ubi/build.c +1 −1 Original line number Diff line number Diff line Loading @@ -806,7 +806,7 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, int vid_hdr_offset) mutex_init(&ubi->buf_mutex); mutex_init(&ubi->ckvol_mutex); mutex_init(&ubi->volumes_mutex); mutex_init(&ubi->device_mutex); spin_lock_init(&ubi->volumes_lock); ubi_msg("attaching mtd%d to ubi%d", mtd->index, ubi_num); Loading drivers/mtd/ubi/cdev.c +11 −11 Original line number Diff line number Diff line Loading @@ -571,9 +571,9 @@ static long vol_cdev_ioctl(struct file *file, unsigned int cmd, } switch (req.property) { case UBI_PROP_DIRECT_WRITE: mutex_lock(&ubi->volumes_mutex); mutex_lock(&ubi->device_mutex); desc->vol->direct_writes = !!req.value; mutex_unlock(&ubi->volumes_mutex); mutex_unlock(&ubi->device_mutex); break; default: err = -EINVAL; Loading Loading @@ -810,7 +810,9 @@ static int rename_volumes(struct ubi_device *ubi, re->desc->vol->vol_id, re->desc->vol->name); } mutex_lock(&ubi->device_mutex); err = ubi_rename_volumes(ubi, &rename_list); mutex_unlock(&ubi->device_mutex); out_free: list_for_each_entry_safe(re, re1, &rename_list, list) { Loading Loading @@ -854,9 +856,9 @@ static long ubi_cdev_ioctl(struct file *file, unsigned int cmd, if (err) break; mutex_lock(&ubi->volumes_mutex); mutex_lock(&ubi->device_mutex); err = ubi_create_volume(ubi, &req); mutex_unlock(&ubi->volumes_mutex); mutex_unlock(&ubi->device_mutex); if (err) break; Loading Loading @@ -885,9 +887,9 @@ static long ubi_cdev_ioctl(struct file *file, unsigned int cmd, break; } mutex_lock(&ubi->volumes_mutex); mutex_lock(&ubi->device_mutex); err = ubi_remove_volume(desc, 0); mutex_unlock(&ubi->volumes_mutex); mutex_unlock(&ubi->device_mutex); /* * The volume is deleted (unless an error occurred), and the Loading Loading @@ -924,9 +926,9 @@ static long ubi_cdev_ioctl(struct file *file, unsigned int cmd, pebs = div_u64(req.bytes + desc->vol->usable_leb_size - 1, desc->vol->usable_leb_size); mutex_lock(&ubi->volumes_mutex); mutex_lock(&ubi->device_mutex); err = ubi_resize_volume(desc, pebs); mutex_unlock(&ubi->volumes_mutex); mutex_unlock(&ubi->device_mutex); ubi_close_volume(desc); break; } Loading @@ -950,9 +952,7 @@ static long ubi_cdev_ioctl(struct file *file, unsigned int cmd, break; } mutex_lock(&ubi->volumes_mutex); err = rename_volumes(ubi, req); mutex_unlock(&ubi->volumes_mutex); kfree(req); break; } Loading drivers/mtd/ubi/ubi.h +4 −4 Original line number Diff line number Diff line Loading @@ -305,9 +305,9 @@ struct ubi_wl_entry; * @vtbl_slots: how many slots are available in the volume table * @vtbl_size: size of the volume table in bytes * @vtbl: in-RAM volume table copy * @volumes_mutex: protects on-flash volume table and serializes volume * changes, like creation, deletion, update, re-size, * re-name and set property * @device_mutex: protects on-flash volume table and serializes volume * creation, deletion, update, re-size, re-name and set * property * * @max_ec: current highest erase counter value * @mean_ec: current mean erase counter value Loading Loading @@ -388,7 +388,7 @@ struct ubi_device { int vtbl_slots; int vtbl_size; struct ubi_vtbl_record *vtbl; struct mutex volumes_mutex; struct mutex device_mutex; int max_ec; /* Note, mean_ec is not updated run-time - should be fixed */ Loading drivers/mtd/ubi/upd.c +4 −4 Original line number Diff line number Diff line Loading @@ -68,9 +68,9 @@ static int set_update_marker(struct ubi_device *ubi, struct ubi_volume *vol) sizeof(struct ubi_vtbl_record)); vtbl_rec.upd_marker = 1; mutex_lock(&ubi->volumes_mutex); mutex_lock(&ubi->device_mutex); err = ubi_change_vtbl_record(ubi, vol->vol_id, &vtbl_rec); mutex_unlock(&ubi->volumes_mutex); mutex_unlock(&ubi->device_mutex); vol->upd_marker = 1; return err; } Loading Loading @@ -109,9 +109,9 @@ static int clear_update_marker(struct ubi_device *ubi, struct ubi_volume *vol, vol->last_eb_bytes = vol->usable_leb_size; } mutex_lock(&ubi->volumes_mutex); mutex_lock(&ubi->device_mutex); err = ubi_change_vtbl_record(ubi, vol->vol_id, &vtbl_rec); mutex_unlock(&ubi->volumes_mutex); mutex_unlock(&ubi->device_mutex); vol->upd_marker = 0; return err; } Loading drivers/mtd/ubi/vmt.c +3 −3 Original line number Diff line number Diff line Loading @@ -198,7 +198,7 @@ static void volume_sysfs_close(struct ubi_volume *vol) * %UBI_VOL_NUM_AUTO, this function automatically assign ID to the new volume * and saves it in @req->vol_id. Returns zero in case of success and a negative * error code in case of failure. Note, the caller has to have the * @ubi->volumes_mutex locked. * @ubi->device_mutex locked. */ int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req) { Loading Loading @@ -403,7 +403,7 @@ int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req) * * This function removes volume described by @desc. The volume has to be opened * in "exclusive" mode. Returns zero in case of success and a negative error * code in case of failure. The caller has to have the @ubi->volumes_mutex * code in case of failure. The caller has to have the @ubi->device_mutex * locked. */ int ubi_remove_volume(struct ubi_volume_desc *desc, int no_vtbl) Loading Loading @@ -485,7 +485,7 @@ int ubi_remove_volume(struct ubi_volume_desc *desc, int no_vtbl) * * This function re-sizes the volume and returns zero in case of success, and a * negative error code in case of failure. The caller has to have the * @ubi->volumes_mutex locked. * @ubi->device_mutex locked. */ int ubi_resize_volume(struct ubi_volume_desc *desc, int reserved_pebs) { Loading Loading
drivers/mtd/ubi/build.c +1 −1 Original line number Diff line number Diff line Loading @@ -806,7 +806,7 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, int vid_hdr_offset) mutex_init(&ubi->buf_mutex); mutex_init(&ubi->ckvol_mutex); mutex_init(&ubi->volumes_mutex); mutex_init(&ubi->device_mutex); spin_lock_init(&ubi->volumes_lock); ubi_msg("attaching mtd%d to ubi%d", mtd->index, ubi_num); Loading
drivers/mtd/ubi/cdev.c +11 −11 Original line number Diff line number Diff line Loading @@ -571,9 +571,9 @@ static long vol_cdev_ioctl(struct file *file, unsigned int cmd, } switch (req.property) { case UBI_PROP_DIRECT_WRITE: mutex_lock(&ubi->volumes_mutex); mutex_lock(&ubi->device_mutex); desc->vol->direct_writes = !!req.value; mutex_unlock(&ubi->volumes_mutex); mutex_unlock(&ubi->device_mutex); break; default: err = -EINVAL; Loading Loading @@ -810,7 +810,9 @@ static int rename_volumes(struct ubi_device *ubi, re->desc->vol->vol_id, re->desc->vol->name); } mutex_lock(&ubi->device_mutex); err = ubi_rename_volumes(ubi, &rename_list); mutex_unlock(&ubi->device_mutex); out_free: list_for_each_entry_safe(re, re1, &rename_list, list) { Loading Loading @@ -854,9 +856,9 @@ static long ubi_cdev_ioctl(struct file *file, unsigned int cmd, if (err) break; mutex_lock(&ubi->volumes_mutex); mutex_lock(&ubi->device_mutex); err = ubi_create_volume(ubi, &req); mutex_unlock(&ubi->volumes_mutex); mutex_unlock(&ubi->device_mutex); if (err) break; Loading Loading @@ -885,9 +887,9 @@ static long ubi_cdev_ioctl(struct file *file, unsigned int cmd, break; } mutex_lock(&ubi->volumes_mutex); mutex_lock(&ubi->device_mutex); err = ubi_remove_volume(desc, 0); mutex_unlock(&ubi->volumes_mutex); mutex_unlock(&ubi->device_mutex); /* * The volume is deleted (unless an error occurred), and the Loading Loading @@ -924,9 +926,9 @@ static long ubi_cdev_ioctl(struct file *file, unsigned int cmd, pebs = div_u64(req.bytes + desc->vol->usable_leb_size - 1, desc->vol->usable_leb_size); mutex_lock(&ubi->volumes_mutex); mutex_lock(&ubi->device_mutex); err = ubi_resize_volume(desc, pebs); mutex_unlock(&ubi->volumes_mutex); mutex_unlock(&ubi->device_mutex); ubi_close_volume(desc); break; } Loading @@ -950,9 +952,7 @@ static long ubi_cdev_ioctl(struct file *file, unsigned int cmd, break; } mutex_lock(&ubi->volumes_mutex); err = rename_volumes(ubi, req); mutex_unlock(&ubi->volumes_mutex); kfree(req); break; } Loading
drivers/mtd/ubi/ubi.h +4 −4 Original line number Diff line number Diff line Loading @@ -305,9 +305,9 @@ struct ubi_wl_entry; * @vtbl_slots: how many slots are available in the volume table * @vtbl_size: size of the volume table in bytes * @vtbl: in-RAM volume table copy * @volumes_mutex: protects on-flash volume table and serializes volume * changes, like creation, deletion, update, re-size, * re-name and set property * @device_mutex: protects on-flash volume table and serializes volume * creation, deletion, update, re-size, re-name and set * property * * @max_ec: current highest erase counter value * @mean_ec: current mean erase counter value Loading Loading @@ -388,7 +388,7 @@ struct ubi_device { int vtbl_slots; int vtbl_size; struct ubi_vtbl_record *vtbl; struct mutex volumes_mutex; struct mutex device_mutex; int max_ec; /* Note, mean_ec is not updated run-time - should be fixed */ Loading
drivers/mtd/ubi/upd.c +4 −4 Original line number Diff line number Diff line Loading @@ -68,9 +68,9 @@ static int set_update_marker(struct ubi_device *ubi, struct ubi_volume *vol) sizeof(struct ubi_vtbl_record)); vtbl_rec.upd_marker = 1; mutex_lock(&ubi->volumes_mutex); mutex_lock(&ubi->device_mutex); err = ubi_change_vtbl_record(ubi, vol->vol_id, &vtbl_rec); mutex_unlock(&ubi->volumes_mutex); mutex_unlock(&ubi->device_mutex); vol->upd_marker = 1; return err; } Loading Loading @@ -109,9 +109,9 @@ static int clear_update_marker(struct ubi_device *ubi, struct ubi_volume *vol, vol->last_eb_bytes = vol->usable_leb_size; } mutex_lock(&ubi->volumes_mutex); mutex_lock(&ubi->device_mutex); err = ubi_change_vtbl_record(ubi, vol->vol_id, &vtbl_rec); mutex_unlock(&ubi->volumes_mutex); mutex_unlock(&ubi->device_mutex); vol->upd_marker = 0; return err; } Loading
drivers/mtd/ubi/vmt.c +3 −3 Original line number Diff line number Diff line Loading @@ -198,7 +198,7 @@ static void volume_sysfs_close(struct ubi_volume *vol) * %UBI_VOL_NUM_AUTO, this function automatically assign ID to the new volume * and saves it in @req->vol_id. Returns zero in case of success and a negative * error code in case of failure. Note, the caller has to have the * @ubi->volumes_mutex locked. * @ubi->device_mutex locked. */ int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req) { Loading Loading @@ -403,7 +403,7 @@ int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req) * * This function removes volume described by @desc. The volume has to be opened * in "exclusive" mode. Returns zero in case of success and a negative error * code in case of failure. The caller has to have the @ubi->volumes_mutex * code in case of failure. The caller has to have the @ubi->device_mutex * locked. */ int ubi_remove_volume(struct ubi_volume_desc *desc, int no_vtbl) Loading Loading @@ -485,7 +485,7 @@ int ubi_remove_volume(struct ubi_volume_desc *desc, int no_vtbl) * * This function re-sizes the volume and returns zero in case of success, and a * negative error code in case of failure. The caller has to have the * @ubi->volumes_mutex locked. * @ubi->device_mutex locked. */ int ubi_resize_volume(struct ubi_volume_desc *desc, int reserved_pebs) { Loading