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/usb/core | |
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/usb/core')
-rw-r--r-- | drivers/usb/core/inode.c | 28 |
1 files changed, 14 insertions, 14 deletions
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 | /* --------------------------------------------------------------------- */ |