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 /fs/sysfs/file.c | |
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 'fs/sysfs/file.c')
-rw-r--r-- | fs/sysfs/file.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index 4013d7905e84..d0e3d8495165 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c | |||
@@ -364,9 +364,9 @@ int sysfs_add_file(struct dentry * dir, const struct attribute * attr, int type) | |||
364 | umode_t mode = (attr->mode & S_IALLUGO) | S_IFREG; | 364 | umode_t mode = (attr->mode & S_IALLUGO) | S_IFREG; |
365 | int error = 0; | 365 | int error = 0; |
366 | 366 | ||
367 | down(&dir->d_inode->i_sem); | 367 | mutex_lock(&dir->d_inode->i_mutex); |
368 | error = sysfs_make_dirent(parent_sd, NULL, (void *) attr, mode, type); | 368 | error = sysfs_make_dirent(parent_sd, NULL, (void *) attr, mode, type); |
369 | up(&dir->d_inode->i_sem); | 369 | mutex_unlock(&dir->d_inode->i_mutex); |
370 | 370 | ||
371 | return error; | 371 | return error; |
372 | } | 372 | } |
@@ -398,7 +398,7 @@ int sysfs_update_file(struct kobject * kobj, const struct attribute * attr) | |||
398 | struct dentry * victim; | 398 | struct dentry * victim; |
399 | int res = -ENOENT; | 399 | int res = -ENOENT; |
400 | 400 | ||
401 | down(&dir->d_inode->i_sem); | 401 | mutex_lock(&dir->d_inode->i_mutex); |
402 | victim = lookup_one_len(attr->name, dir, strlen(attr->name)); | 402 | victim = lookup_one_len(attr->name, dir, strlen(attr->name)); |
403 | if (!IS_ERR(victim)) { | 403 | if (!IS_ERR(victim)) { |
404 | /* make sure dentry is really there */ | 404 | /* make sure dentry is really there */ |
@@ -420,7 +420,7 @@ int sysfs_update_file(struct kobject * kobj, const struct attribute * attr) | |||
420 | */ | 420 | */ |
421 | dput(victim); | 421 | dput(victim); |
422 | } | 422 | } |
423 | up(&dir->d_inode->i_sem); | 423 | mutex_unlock(&dir->d_inode->i_mutex); |
424 | 424 | ||
425 | return res; | 425 | return res; |
426 | } | 426 | } |
@@ -441,22 +441,22 @@ int sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode) | |||
441 | struct iattr newattrs; | 441 | struct iattr newattrs; |
442 | int res = -ENOENT; | 442 | int res = -ENOENT; |
443 | 443 | ||
444 | down(&dir->d_inode->i_sem); | 444 | mutex_lock(&dir->d_inode->i_mutex); |
445 | victim = lookup_one_len(attr->name, dir, strlen(attr->name)); | 445 | victim = lookup_one_len(attr->name, dir, strlen(attr->name)); |
446 | if (!IS_ERR(victim)) { | 446 | if (!IS_ERR(victim)) { |
447 | if (victim->d_inode && | 447 | if (victim->d_inode && |
448 | (victim->d_parent->d_inode == dir->d_inode)) { | 448 | (victim->d_parent->d_inode == dir->d_inode)) { |
449 | inode = victim->d_inode; | 449 | inode = victim->d_inode; |
450 | down(&inode->i_sem); | 450 | mutex_lock(&inode->i_mutex); |
451 | newattrs.ia_mode = (mode & S_IALLUGO) | | 451 | newattrs.ia_mode = (mode & S_IALLUGO) | |
452 | (inode->i_mode & ~S_IALLUGO); | 452 | (inode->i_mode & ~S_IALLUGO); |
453 | newattrs.ia_valid = ATTR_MODE | ATTR_CTIME; | 453 | newattrs.ia_valid = ATTR_MODE | ATTR_CTIME; |
454 | res = notify_change(victim, &newattrs); | 454 | res = notify_change(victim, &newattrs); |
455 | up(&inode->i_sem); | 455 | mutex_unlock(&inode->i_mutex); |
456 | } | 456 | } |
457 | dput(victim); | 457 | dput(victim); |
458 | } | 458 | } |
459 | up(&dir->d_inode->i_sem); | 459 | mutex_unlock(&dir->d_inode->i_mutex); |
460 | 460 | ||
461 | return res; | 461 | return res; |
462 | } | 462 | } |
@@ -480,4 +480,3 @@ void sysfs_remove_file(struct kobject * kobj, const struct attribute * attr) | |||
480 | EXPORT_SYMBOL_GPL(sysfs_create_file); | 480 | EXPORT_SYMBOL_GPL(sysfs_create_file); |
481 | EXPORT_SYMBOL_GPL(sysfs_remove_file); | 481 | EXPORT_SYMBOL_GPL(sysfs_remove_file); |
482 | EXPORT_SYMBOL_GPL(sysfs_update_file); | 482 | EXPORT_SYMBOL_GPL(sysfs_update_file); |
483 | |||