aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2009-05-07 04:46:49 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2009-05-18 05:28:24 -0400
commitf089c0b28cdba1076aa8335dcaaaacc3dafc7d36 (patch)
treeae9ca55c15a379d20856c56c1ff30ad712c4839e
parent383d08e045faddd89797959786233d4c0e1ace80 (diff)
UBI: re-name volumes_mutex to device_mutex
The mutex essencially protects the entire UBI device, so the old @volumes_mutex name is a little misleading. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
-rw-r--r--drivers/mtd/ubi/build.c2
-rw-r--r--drivers/mtd/ubi/cdev.c22
-rw-r--r--drivers/mtd/ubi/ubi.h8
-rw-r--r--drivers/mtd/ubi/upd.c8
-rw-r--r--drivers/mtd/ubi/vmt.c6
5 files changed, 23 insertions, 23 deletions
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index e0e8f47f1674..5d8fda1bda7f 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -806,7 +806,7 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, int vid_hdr_offset)
806 806
807 mutex_init(&ubi->buf_mutex); 807 mutex_init(&ubi->buf_mutex);
808 mutex_init(&ubi->ckvol_mutex); 808 mutex_init(&ubi->ckvol_mutex);
809 mutex_init(&ubi->volumes_mutex); 809 mutex_init(&ubi->device_mutex);
810 spin_lock_init(&ubi->volumes_lock); 810 spin_lock_init(&ubi->volumes_lock);
811 811
812 ubi_msg("attaching mtd%d to ubi%d", mtd->index, ubi_num); 812 ubi_msg("attaching mtd%d to ubi%d", mtd->index, ubi_num);
diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c
index 8087b0462771..1024c106c899 100644
--- a/drivers/mtd/ubi/cdev.c
+++ b/drivers/mtd/ubi/cdev.c
@@ -558,7 +558,7 @@ static long vol_cdev_ioctl(struct file *file, unsigned int cmd,
558 break; 558 break;
559 } 559 }
560 560
561 /* Set volume property command*/ 561 /* Set volume property command */
562 case UBI_IOCSETPROP: 562 case UBI_IOCSETPROP:
563 { 563 {
564 struct ubi_set_prop_req req; 564 struct ubi_set_prop_req req;
@@ -571,9 +571,9 @@ static long vol_cdev_ioctl(struct file *file, unsigned int cmd,
571 } 571 }
572 switch (req.property) { 572 switch (req.property) {
573 case UBI_PROP_DIRECT_WRITE: 573 case UBI_PROP_DIRECT_WRITE:
574 mutex_lock(&ubi->volumes_mutex); 574 mutex_lock(&ubi->device_mutex);
575 desc->vol->direct_writes = !!req.value; 575 desc->vol->direct_writes = !!req.value;
576 mutex_unlock(&ubi->volumes_mutex); 576 mutex_unlock(&ubi->device_mutex);
577 break; 577 break;
578 default: 578 default:
579 err = -EINVAL; 579 err = -EINVAL;
@@ -810,7 +810,9 @@ static int rename_volumes(struct ubi_device *ubi,
810 re->desc->vol->vol_id, re->desc->vol->name); 810 re->desc->vol->vol_id, re->desc->vol->name);
811 } 811 }
812 812
813 mutex_lock(&ubi->device_mutex);
813 err = ubi_rename_volumes(ubi, &rename_list); 814 err = ubi_rename_volumes(ubi, &rename_list);
815 mutex_unlock(&ubi->device_mutex);
814 816
815out_free: 817out_free:
816 list_for_each_entry_safe(re, re1, &rename_list, list) { 818 list_for_each_entry_safe(re, re1, &rename_list, list) {
@@ -854,9 +856,9 @@ static long ubi_cdev_ioctl(struct file *file, unsigned int cmd,
854 if (err) 856 if (err)
855 break; 857 break;
856 858
857 mutex_lock(&ubi->volumes_mutex); 859 mutex_lock(&ubi->device_mutex);
858 err = ubi_create_volume(ubi, &req); 860 err = ubi_create_volume(ubi, &req);
859 mutex_unlock(&ubi->volumes_mutex); 861 mutex_unlock(&ubi->device_mutex);
860 if (err) 862 if (err)
861 break; 863 break;
862 864
@@ -885,9 +887,9 @@ static long ubi_cdev_ioctl(struct file *file, unsigned int cmd,
885 break; 887 break;
886 } 888 }
887 889
888 mutex_lock(&ubi->volumes_mutex); 890 mutex_lock(&ubi->device_mutex);
889 err = ubi_remove_volume(desc, 0); 891 err = ubi_remove_volume(desc, 0);
890 mutex_unlock(&ubi->volumes_mutex); 892 mutex_unlock(&ubi->device_mutex);
891 893
892 /* 894 /*
893 * The volume is deleted (unless an error occurred), and the 895 * The volume is deleted (unless an error occurred), and the
@@ -924,9 +926,9 @@ static long ubi_cdev_ioctl(struct file *file, unsigned int cmd,
924 pebs = div_u64(req.bytes + desc->vol->usable_leb_size - 1, 926 pebs = div_u64(req.bytes + desc->vol->usable_leb_size - 1,
925 desc->vol->usable_leb_size); 927 desc->vol->usable_leb_size);
926 928
927 mutex_lock(&ubi->volumes_mutex); 929 mutex_lock(&ubi->device_mutex);
928 err = ubi_resize_volume(desc, pebs); 930 err = ubi_resize_volume(desc, pebs);
929 mutex_unlock(&ubi->volumes_mutex); 931 mutex_unlock(&ubi->device_mutex);
930 ubi_close_volume(desc); 932 ubi_close_volume(desc);
931 break; 933 break;
932 } 934 }
@@ -950,9 +952,7 @@ static long ubi_cdev_ioctl(struct file *file, unsigned int cmd,
950 break; 952 break;
951 } 953 }
952 954
953 mutex_lock(&ubi->volumes_mutex);
954 err = rename_volumes(ubi, req); 955 err = rename_volumes(ubi, req);
955 mutex_unlock(&ubi->volumes_mutex);
956 kfree(req); 956 kfree(req);
957 break; 957 break;
958 } 958 }
diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h
index 485c73f850c1..76ec79b156a1 100644
--- a/drivers/mtd/ubi/ubi.h
+++ b/drivers/mtd/ubi/ubi.h
@@ -305,9 +305,9 @@ struct ubi_wl_entry;
305 * @vtbl_slots: how many slots are available in the volume table 305 * @vtbl_slots: how many slots are available in the volume table
306 * @vtbl_size: size of the volume table in bytes 306 * @vtbl_size: size of the volume table in bytes
307 * @vtbl: in-RAM volume table copy 307 * @vtbl: in-RAM volume table copy
308 * @volumes_mutex: protects on-flash volume table and serializes volume 308 * @device_mutex: protects on-flash volume table and serializes volume
309 * changes, like creation, deletion, update, re-size, 309 * creation, deletion, update, re-size, re-name and set
310 * re-name and set property 310 * property
311 * 311 *
312 * @max_ec: current highest erase counter value 312 * @max_ec: current highest erase counter value
313 * @mean_ec: current mean erase counter value 313 * @mean_ec: current mean erase counter value
@@ -388,7 +388,7 @@ struct ubi_device {
388 int vtbl_slots; 388 int vtbl_slots;
389 int vtbl_size; 389 int vtbl_size;
390 struct ubi_vtbl_record *vtbl; 390 struct ubi_vtbl_record *vtbl;
391 struct mutex volumes_mutex; 391 struct mutex device_mutex;
392 392
393 int max_ec; 393 int max_ec;
394 /* Note, mean_ec is not updated run-time - should be fixed */ 394 /* Note, mean_ec is not updated run-time - should be fixed */
diff --git a/drivers/mtd/ubi/upd.c b/drivers/mtd/ubi/upd.c
index 6b4d1ae891ae..dce1d92d8e9d 100644
--- a/drivers/mtd/ubi/upd.c
+++ b/drivers/mtd/ubi/upd.c
@@ -68,9 +68,9 @@ static int set_update_marker(struct ubi_device *ubi, struct ubi_volume *vol)
68 sizeof(struct ubi_vtbl_record)); 68 sizeof(struct ubi_vtbl_record));
69 vtbl_rec.upd_marker = 1; 69 vtbl_rec.upd_marker = 1;
70 70
71 mutex_lock(&ubi->volumes_mutex); 71 mutex_lock(&ubi->device_mutex);
72 err = ubi_change_vtbl_record(ubi, vol->vol_id, &vtbl_rec); 72 err = ubi_change_vtbl_record(ubi, vol->vol_id, &vtbl_rec);
73 mutex_unlock(&ubi->volumes_mutex); 73 mutex_unlock(&ubi->device_mutex);
74 vol->upd_marker = 1; 74 vol->upd_marker = 1;
75 return err; 75 return err;
76} 76}
@@ -109,9 +109,9 @@ static int clear_update_marker(struct ubi_device *ubi, struct ubi_volume *vol,
109 vol->last_eb_bytes = vol->usable_leb_size; 109 vol->last_eb_bytes = vol->usable_leb_size;
110 } 110 }
111 111
112 mutex_lock(&ubi->volumes_mutex); 112 mutex_lock(&ubi->device_mutex);
113 err = ubi_change_vtbl_record(ubi, vol->vol_id, &vtbl_rec); 113 err = ubi_change_vtbl_record(ubi, vol->vol_id, &vtbl_rec);
114 mutex_unlock(&ubi->volumes_mutex); 114 mutex_unlock(&ubi->device_mutex);
115 vol->upd_marker = 0; 115 vol->upd_marker = 0;
116 return err; 116 return err;
117} 117}
diff --git a/drivers/mtd/ubi/vmt.c b/drivers/mtd/ubi/vmt.c
index df5483562b7a..328c1242920e 100644
--- a/drivers/mtd/ubi/vmt.c
+++ b/drivers/mtd/ubi/vmt.c
@@ -198,7 +198,7 @@ static void volume_sysfs_close(struct ubi_volume *vol)
198 * %UBI_VOL_NUM_AUTO, this function automatically assign ID to the new volume 198 * %UBI_VOL_NUM_AUTO, this function automatically assign ID to the new volume
199 * and saves it in @req->vol_id. Returns zero in case of success and a negative 199 * and saves it in @req->vol_id. Returns zero in case of success and a negative
200 * error code in case of failure. Note, the caller has to have the 200 * error code in case of failure. Note, the caller has to have the
201 * @ubi->volumes_mutex locked. 201 * @ubi->device_mutex locked.
202 */ 202 */
203int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req) 203int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req)
204{ 204{
@@ -403,7 +403,7 @@ out_unlock:
403 * 403 *
404 * This function removes volume described by @desc. The volume has to be opened 404 * This function removes volume described by @desc. The volume has to be opened
405 * in "exclusive" mode. Returns zero in case of success and a negative error 405 * in "exclusive" mode. Returns zero in case of success and a negative error
406 * code in case of failure. The caller has to have the @ubi->volumes_mutex 406 * code in case of failure. The caller has to have the @ubi->device_mutex
407 * locked. 407 * locked.
408 */ 408 */
409int ubi_remove_volume(struct ubi_volume_desc *desc, int no_vtbl) 409int ubi_remove_volume(struct ubi_volume_desc *desc, int no_vtbl)
@@ -485,7 +485,7 @@ out_unlock:
485 * 485 *
486 * This function re-sizes the volume and returns zero in case of success, and a 486 * This function re-sizes the volume and returns zero in case of success, and a
487 * negative error code in case of failure. The caller has to have the 487 * negative error code in case of failure. The caller has to have the
488 * @ubi->volumes_mutex locked. 488 * @ubi->device_mutex locked.
489 */ 489 */
490int ubi_resize_volume(struct ubi_volume_desc *desc, int reserved_pebs) 490int ubi_resize_volume(struct ubi_volume_desc *desc, int reserved_pebs)
491{ 491{