diff options
author | Jes Sorensen <jes@sgi.com> | 2006-01-09 18:59:24 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@hera.kernel.org> | 2006-01-09 18:59:24 -0500 |
commit | 1b1dcc1b57a49136f118a0f16367256ff9994a69 (patch) | |
tree | b0b36d4f41d28c9d6514fb309d33c1a084d6309b /drivers | |
parent | 794ee1baee1c26be40410233e6c20bceb2b03c08 (diff) |
[PATCH] mutex subsystem, semaphore to mutex: VFS, ->i_sem
This patch converts the inode semaphore to a mutex. I have tested it on
XFS and compiled as much as one can consider on an ia64. Anyway your
luck with it might be different.
Modified-by: Ingo Molnar <mingo@elte.hu>
(finished the conversion)
Signed-off-by: Jes Sorensen <jes@sgi.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/block/loop.c | 4 | ||||
-rw-r--r-- | drivers/char/mem.c | 4 | ||||
-rw-r--r-- | drivers/isdn/capi/capifs.c | 6 | ||||
-rw-r--r-- | drivers/md/dm.c | 4 | ||||
-rw-r--r-- | drivers/md/md.c | 8 | ||||
-rw-r--r-- | drivers/pci/proc.c | 4 | ||||
-rw-r--r-- | drivers/usb/core/inode.c | 28 | ||||
-rw-r--r-- | drivers/usb/gadget/file_storage.c | 4 | ||||
-rw-r--r-- | drivers/usb/gadget/inode.c | 4 |
9 files changed, 33 insertions, 33 deletions
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index a452b13620a2..bed9ad76c04c 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c | |||
@@ -215,7 +215,7 @@ static int do_lo_send_aops(struct loop_device *lo, struct bio_vec *bvec, | |||
215 | unsigned offset, bv_offs; | 215 | unsigned offset, bv_offs; |
216 | int len, ret; | 216 | int len, ret; |
217 | 217 | ||
218 | down(&mapping->host->i_sem); | 218 | mutex_lock(&mapping->host->i_mutex); |
219 | index = pos >> PAGE_CACHE_SHIFT; | 219 | index = pos >> PAGE_CACHE_SHIFT; |
220 | offset = pos & ((pgoff_t)PAGE_CACHE_SIZE - 1); | 220 | offset = pos & ((pgoff_t)PAGE_CACHE_SIZE - 1); |
221 | bv_offs = bvec->bv_offset; | 221 | bv_offs = bvec->bv_offset; |
@@ -278,7 +278,7 @@ static int do_lo_send_aops(struct loop_device *lo, struct bio_vec *bvec, | |||
278 | } | 278 | } |
279 | ret = 0; | 279 | ret = 0; |
280 | out: | 280 | out: |
281 | up(&mapping->host->i_sem); | 281 | mutex_unlock(&mapping->host->i_mutex); |
282 | return ret; | 282 | return ret; |
283 | unlock: | 283 | unlock: |
284 | unlock_page(page); | 284 | unlock_page(page); |
diff --git a/drivers/char/mem.c b/drivers/char/mem.c index 5b2d18035073..704c3c07f0ab 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c | |||
@@ -741,7 +741,7 @@ static loff_t memory_lseek(struct file * file, loff_t offset, int orig) | |||
741 | { | 741 | { |
742 | loff_t ret; | 742 | loff_t ret; |
743 | 743 | ||
744 | down(&file->f_dentry->d_inode->i_sem); | 744 | mutex_lock(&file->f_dentry->d_inode->i_mutex); |
745 | switch (orig) { | 745 | switch (orig) { |
746 | case 0: | 746 | case 0: |
747 | file->f_pos = offset; | 747 | file->f_pos = offset; |
@@ -756,7 +756,7 @@ static loff_t memory_lseek(struct file * file, loff_t offset, int orig) | |||
756 | default: | 756 | default: |
757 | ret = -EINVAL; | 757 | ret = -EINVAL; |
758 | } | 758 | } |
759 | up(&file->f_dentry->d_inode->i_sem); | 759 | mutex_unlock(&file->f_dentry->d_inode->i_mutex); |
760 | return ret; | 760 | return ret; |
761 | } | 761 | } |
762 | 762 | ||
diff --git a/drivers/isdn/capi/capifs.c b/drivers/isdn/capi/capifs.c index 207cae366256..0a37aded4b54 100644 --- a/drivers/isdn/capi/capifs.c +++ b/drivers/isdn/capi/capifs.c | |||
@@ -138,7 +138,7 @@ static struct dentry *get_node(int num) | |||
138 | { | 138 | { |
139 | char s[10]; | 139 | char s[10]; |
140 | struct dentry *root = capifs_root; | 140 | struct dentry *root = capifs_root; |
141 | down(&root->d_inode->i_sem); | 141 | mutex_lock(&root->d_inode->i_mutex); |
142 | return lookup_one_len(s, root, sprintf(s, "%d", num)); | 142 | return lookup_one_len(s, root, sprintf(s, "%d", num)); |
143 | } | 143 | } |
144 | 144 | ||
@@ -159,7 +159,7 @@ void capifs_new_ncci(unsigned int number, dev_t device) | |||
159 | dentry = get_node(number); | 159 | dentry = get_node(number); |
160 | if (!IS_ERR(dentry) && !dentry->d_inode) | 160 | if (!IS_ERR(dentry) && !dentry->d_inode) |
161 | d_instantiate(dentry, inode); | 161 | d_instantiate(dentry, inode); |
162 | up(&capifs_root->d_inode->i_sem); | 162 | mutex_unlock(&capifs_root->d_inode->i_mutex); |
163 | } | 163 | } |
164 | 164 | ||
165 | void capifs_free_ncci(unsigned int number) | 165 | void capifs_free_ncci(unsigned int number) |
@@ -175,7 +175,7 @@ void capifs_free_ncci(unsigned int number) | |||
175 | } | 175 | } |
176 | dput(dentry); | 176 | dput(dentry); |
177 | } | 177 | } |
178 | up(&capifs_root->d_inode->i_sem); | 178 | mutex_unlock(&capifs_root->d_inode->i_mutex); |
179 | } | 179 | } |
180 | 180 | ||
181 | static int __init capifs_init(void) | 181 | static int __init capifs_init(void) |
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 0e481512f918..5c210b0a4cb0 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
@@ -837,9 +837,9 @@ static void __set_size(struct mapped_device *md, sector_t size) | |||
837 | { | 837 | { |
838 | set_capacity(md->disk, size); | 838 | set_capacity(md->disk, size); |
839 | 839 | ||
840 | down(&md->suspended_bdev->bd_inode->i_sem); | 840 | mutex_lock(&md->suspended_bdev->bd_inode->i_mutex); |
841 | i_size_write(md->suspended_bdev->bd_inode, (loff_t)size << SECTOR_SHIFT); | 841 | i_size_write(md->suspended_bdev->bd_inode, (loff_t)size << SECTOR_SHIFT); |
842 | up(&md->suspended_bdev->bd_inode->i_sem); | 842 | mutex_unlock(&md->suspended_bdev->bd_inode->i_mutex); |
843 | } | 843 | } |
844 | 844 | ||
845 | static int __bind(struct mapped_device *md, struct dm_table *t) | 845 | static int __bind(struct mapped_device *md, struct dm_table *t) |
diff --git a/drivers/md/md.c b/drivers/md/md.c index e423a16ba3c9..0302723fa21f 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -3460,9 +3460,9 @@ static int update_size(mddev_t *mddev, unsigned long size) | |||
3460 | 3460 | ||
3461 | bdev = bdget_disk(mddev->gendisk, 0); | 3461 | bdev = bdget_disk(mddev->gendisk, 0); |
3462 | if (bdev) { | 3462 | if (bdev) { |
3463 | down(&bdev->bd_inode->i_sem); | 3463 | mutex_lock(&bdev->bd_inode->i_mutex); |
3464 | i_size_write(bdev->bd_inode, mddev->array_size << 10); | 3464 | i_size_write(bdev->bd_inode, mddev->array_size << 10); |
3465 | up(&bdev->bd_inode->i_sem); | 3465 | mutex_unlock(&bdev->bd_inode->i_mutex); |
3466 | bdput(bdev); | 3466 | bdput(bdev); |
3467 | } | 3467 | } |
3468 | } | 3468 | } |
@@ -3486,9 +3486,9 @@ static int update_raid_disks(mddev_t *mddev, int raid_disks) | |||
3486 | 3486 | ||
3487 | bdev = bdget_disk(mddev->gendisk, 0); | 3487 | bdev = bdget_disk(mddev->gendisk, 0); |
3488 | if (bdev) { | 3488 | if (bdev) { |
3489 | down(&bdev->bd_inode->i_sem); | 3489 | mutex_lock(&bdev->bd_inode->i_mutex); |
3490 | i_size_write(bdev->bd_inode, mddev->array_size << 10); | 3490 | i_size_write(bdev->bd_inode, mddev->array_size << 10); |
3491 | up(&bdev->bd_inode->i_sem); | 3491 | mutex_unlock(&bdev->bd_inode->i_mutex); |
3492 | bdput(bdev); | 3492 | bdput(bdev); |
3493 | } | 3493 | } |
3494 | } | 3494 | } |
diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c index 9eb465727fce..9cb6dd0834be 100644 --- a/drivers/pci/proc.c +++ b/drivers/pci/proc.c | |||
@@ -25,7 +25,7 @@ proc_bus_pci_lseek(struct file *file, loff_t off, int whence) | |||
25 | loff_t new = -1; | 25 | loff_t new = -1; |
26 | struct inode *inode = file->f_dentry->d_inode; | 26 | struct inode *inode = file->f_dentry->d_inode; |
27 | 27 | ||
28 | down(&inode->i_sem); | 28 | mutex_lock(&inode->i_mutex); |
29 | switch (whence) { | 29 | switch (whence) { |
30 | case 0: | 30 | case 0: |
31 | new = off; | 31 | new = off; |
@@ -41,7 +41,7 @@ proc_bus_pci_lseek(struct file *file, loff_t off, int whence) | |||
41 | new = -EINVAL; | 41 | new = -EINVAL; |
42 | else | 42 | else |
43 | file->f_pos = new; | 43 | file->f_pos = new; |
44 | up(&inode->i_sem); | 44 | mutex_unlock(&inode->i_mutex); |
45 | return new; | 45 | return new; |
46 | } | 46 | } |
47 | 47 | ||
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c index 4ddc453023a2..3cf945cc5b9a 100644 --- a/drivers/usb/core/inode.c +++ b/drivers/usb/core/inode.c | |||
@@ -184,13 +184,13 @@ static void update_bus(struct dentry *bus) | |||
184 | bus->d_inode->i_gid = busgid; | 184 | bus->d_inode->i_gid = busgid; |
185 | bus->d_inode->i_mode = S_IFDIR | busmode; | 185 | bus->d_inode->i_mode = S_IFDIR | busmode; |
186 | 186 | ||
187 | down(&bus->d_inode->i_sem); | 187 | mutex_lock(&bus->d_inode->i_mutex); |
188 | 188 | ||
189 | list_for_each_entry(dev, &bus->d_subdirs, d_u.d_child) | 189 | list_for_each_entry(dev, &bus->d_subdirs, d_u.d_child) |
190 | if (dev->d_inode) | 190 | if (dev->d_inode) |
191 | update_dev(dev); | 191 | update_dev(dev); |
192 | 192 | ||
193 | up(&bus->d_inode->i_sem); | 193 | mutex_unlock(&bus->d_inode->i_mutex); |
194 | } | 194 | } |
195 | 195 | ||
196 | static void update_sb(struct super_block *sb) | 196 | static void update_sb(struct super_block *sb) |
@@ -201,7 +201,7 @@ static void update_sb(struct super_block *sb) | |||
201 | if (!root) | 201 | if (!root) |
202 | return; | 202 | return; |
203 | 203 | ||
204 | down(&root->d_inode->i_sem); | 204 | mutex_lock(&root->d_inode->i_mutex); |
205 | 205 | ||
206 | list_for_each_entry(bus, &root->d_subdirs, d_u.d_child) { | 206 | list_for_each_entry(bus, &root->d_subdirs, d_u.d_child) { |
207 | if (bus->d_inode) { | 207 | if (bus->d_inode) { |
@@ -219,7 +219,7 @@ static void update_sb(struct super_block *sb) | |||
219 | } | 219 | } |
220 | } | 220 | } |
221 | 221 | ||
222 | up(&root->d_inode->i_sem); | 222 | mutex_unlock(&root->d_inode->i_mutex); |
223 | } | 223 | } |
224 | 224 | ||
225 | static int remount(struct super_block *sb, int *flags, char *data) | 225 | static int remount(struct super_block *sb, int *flags, char *data) |
@@ -333,10 +333,10 @@ static int usbfs_empty (struct dentry *dentry) | |||
333 | static int usbfs_unlink (struct inode *dir, struct dentry *dentry) | 333 | static int usbfs_unlink (struct inode *dir, struct dentry *dentry) |
334 | { | 334 | { |
335 | struct inode *inode = dentry->d_inode; | 335 | struct inode *inode = dentry->d_inode; |
336 | down(&inode->i_sem); | 336 | mutex_lock(&inode->i_mutex); |
337 | dentry->d_inode->i_nlink--; | 337 | dentry->d_inode->i_nlink--; |
338 | dput(dentry); | 338 | dput(dentry); |
339 | up(&inode->i_sem); | 339 | mutex_unlock(&inode->i_mutex); |
340 | d_delete(dentry); | 340 | d_delete(dentry); |
341 | return 0; | 341 | return 0; |
342 | } | 342 | } |
@@ -346,7 +346,7 @@ static int usbfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
346 | int error = -ENOTEMPTY; | 346 | int error = -ENOTEMPTY; |
347 | struct inode * inode = dentry->d_inode; | 347 | struct inode * inode = dentry->d_inode; |
348 | 348 | ||
349 | down(&inode->i_sem); | 349 | mutex_lock(&inode->i_mutex); |
350 | dentry_unhash(dentry); | 350 | dentry_unhash(dentry); |
351 | if (usbfs_empty(dentry)) { | 351 | if (usbfs_empty(dentry)) { |
352 | dentry->d_inode->i_nlink -= 2; | 352 | dentry->d_inode->i_nlink -= 2; |
@@ -355,7 +355,7 @@ static int usbfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
355 | dir->i_nlink--; | 355 | dir->i_nlink--; |
356 | error = 0; | 356 | error = 0; |
357 | } | 357 | } |
358 | up(&inode->i_sem); | 358 | mutex_unlock(&inode->i_mutex); |
359 | if (!error) | 359 | if (!error) |
360 | d_delete(dentry); | 360 | d_delete(dentry); |
361 | dput(dentry); | 361 | dput(dentry); |
@@ -380,7 +380,7 @@ static loff_t default_file_lseek (struct file *file, loff_t offset, int orig) | |||
380 | { | 380 | { |
381 | loff_t retval = -EINVAL; | 381 | loff_t retval = -EINVAL; |
382 | 382 | ||
383 | down(&file->f_dentry->d_inode->i_sem); | 383 | mutex_lock(&file->f_dentry->d_inode->i_mutex); |
384 | switch(orig) { | 384 | switch(orig) { |
385 | case 0: | 385 | case 0: |
386 | if (offset > 0) { | 386 | if (offset > 0) { |
@@ -397,7 +397,7 @@ static loff_t default_file_lseek (struct file *file, loff_t offset, int orig) | |||
397 | default: | 397 | default: |
398 | break; | 398 | break; |
399 | } | 399 | } |
400 | up(&file->f_dentry->d_inode->i_sem); | 400 | mutex_unlock(&file->f_dentry->d_inode->i_mutex); |
401 | return retval; | 401 | return retval; |
402 | } | 402 | } |
403 | 403 | ||
@@ -480,7 +480,7 @@ static int fs_create_by_name (const char *name, mode_t mode, | |||
480 | } | 480 | } |
481 | 481 | ||
482 | *dentry = NULL; | 482 | *dentry = NULL; |
483 | down(&parent->d_inode->i_sem); | 483 | mutex_lock(&parent->d_inode->i_mutex); |
484 | *dentry = lookup_one_len(name, parent, strlen(name)); | 484 | *dentry = lookup_one_len(name, parent, strlen(name)); |
485 | if (!IS_ERR(dentry)) { | 485 | if (!IS_ERR(dentry)) { |
486 | if ((mode & S_IFMT) == S_IFDIR) | 486 | if ((mode & S_IFMT) == S_IFDIR) |
@@ -489,7 +489,7 @@ static int fs_create_by_name (const char *name, mode_t mode, | |||
489 | error = usbfs_create (parent->d_inode, *dentry, mode); | 489 | error = usbfs_create (parent->d_inode, *dentry, mode); |
490 | } else | 490 | } else |
491 | error = PTR_ERR(dentry); | 491 | error = PTR_ERR(dentry); |
492 | up(&parent->d_inode->i_sem); | 492 | mutex_unlock(&parent->d_inode->i_mutex); |
493 | 493 | ||
494 | return error; | 494 | return error; |
495 | } | 495 | } |
@@ -528,7 +528,7 @@ static void fs_remove_file (struct dentry *dentry) | |||
528 | if (!parent || !parent->d_inode) | 528 | if (!parent || !parent->d_inode) |
529 | return; | 529 | return; |
530 | 530 | ||
531 | down(&parent->d_inode->i_sem); | 531 | mutex_lock(&parent->d_inode->i_mutex); |
532 | if (usbfs_positive(dentry)) { | 532 | if (usbfs_positive(dentry)) { |
533 | if (dentry->d_inode) { | 533 | if (dentry->d_inode) { |
534 | if (S_ISDIR(dentry->d_inode->i_mode)) | 534 | if (S_ISDIR(dentry->d_inode->i_mode)) |
@@ -538,7 +538,7 @@ static void fs_remove_file (struct dentry *dentry) | |||
538 | dput(dentry); | 538 | dput(dentry); |
539 | } | 539 | } |
540 | } | 540 | } |
541 | up(&parent->d_inode->i_sem); | 541 | mutex_unlock(&parent->d_inode->i_mutex); |
542 | } | 542 | } |
543 | 543 | ||
544 | /* --------------------------------------------------------------------- */ | 544 | /* --------------------------------------------------------------------- */ |
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c index 0cea9782d7d4..de59c58896d6 100644 --- a/drivers/usb/gadget/file_storage.c +++ b/drivers/usb/gadget/file_storage.c | |||
@@ -1891,7 +1891,7 @@ static int fsync_sub(struct lun *curlun) | |||
1891 | return -EINVAL; | 1891 | return -EINVAL; |
1892 | 1892 | ||
1893 | inode = filp->f_dentry->d_inode; | 1893 | inode = filp->f_dentry->d_inode; |
1894 | down(&inode->i_sem); | 1894 | mutex_lock(&inode->i_mutex); |
1895 | current->flags |= PF_SYNCWRITE; | 1895 | current->flags |= PF_SYNCWRITE; |
1896 | rc = filemap_fdatawrite(inode->i_mapping); | 1896 | rc = filemap_fdatawrite(inode->i_mapping); |
1897 | err = filp->f_op->fsync(filp, filp->f_dentry, 1); | 1897 | err = filp->f_op->fsync(filp, filp->f_dentry, 1); |
@@ -1901,7 +1901,7 @@ static int fsync_sub(struct lun *curlun) | |||
1901 | if (!rc) | 1901 | if (!rc) |
1902 | rc = err; | 1902 | rc = err; |
1903 | current->flags &= ~PF_SYNCWRITE; | 1903 | current->flags &= ~PF_SYNCWRITE; |
1904 | up(&inode->i_sem); | 1904 | mutex_unlock(&inode->i_mutex); |
1905 | VLDBG(curlun, "fdatasync -> %d\n", rc); | 1905 | VLDBG(curlun, "fdatasync -> %d\n", rc); |
1906 | return rc; | 1906 | return rc; |
1907 | } | 1907 | } |
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index 5c40980a5bd9..c6c279de832e 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c | |||
@@ -1562,10 +1562,10 @@ restart: | |||
1562 | spin_unlock_irq (&dev->lock); | 1562 | spin_unlock_irq (&dev->lock); |
1563 | 1563 | ||
1564 | /* break link to dcache */ | 1564 | /* break link to dcache */ |
1565 | down (&parent->i_sem); | 1565 | mutex_lock (&parent->i_mutex); |
1566 | d_delete (dentry); | 1566 | d_delete (dentry); |
1567 | dput (dentry); | 1567 | dput (dentry); |
1568 | up (&parent->i_sem); | 1568 | mutex_unlock (&parent->i_mutex); |
1569 | 1569 | ||
1570 | /* fds may still be open */ | 1570 | /* fds may still be open */ |
1571 | goto restart; | 1571 | goto restart; |