diff options
author | Joel Becker <joel.becker@oracle.com> | 2007-07-07 02:33:17 -0400 |
---|---|---|
committer | Mark Fasheh <mark.fasheh@oracle.com> | 2007-07-10 20:10:56 -0400 |
commit | e6bd07aee739566803425acdbf5cdb29919164e1 (patch) | |
tree | e085a5065d06af2b7c0cab8bcd8fb4eb289344be /Documentation/filesystems/configfs | |
parent | 3fe6c5ce1176cf661dbe71fc43b627c1a742a89a (diff) |
configfs: Convert subsystem semaphore to mutex
Convert the su_sem member of struct configfs_subsystem to a struct
mutex, as that's what it is. Also convert all the users and update
Documentation/configfs.txt and Documentation/configfs_example.c
accordingly.
[ Conflict in fs/dlm/config.c with commit
3168b0780d06ace875696f8a648d04d6089654e5 manually resolved. --Mark ]
Inspired-by: Satyam Sharma <ssatyam@cse.iitk.ac.in>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'Documentation/filesystems/configfs')
-rw-r--r-- | Documentation/filesystems/configfs/configfs.txt | 18 | ||||
-rw-r--r-- | Documentation/filesystems/configfs/configfs_example.c | 2 |
2 files changed, 10 insertions, 10 deletions
diff --git a/Documentation/filesystems/configfs/configfs.txt b/Documentation/filesystems/configfs/configfs.txt index b34cdb50eab4..21f038e66724 100644 --- a/Documentation/filesystems/configfs/configfs.txt +++ b/Documentation/filesystems/configfs/configfs.txt | |||
@@ -280,18 +280,18 @@ tells configfs to make the subsystem appear in the file tree. | |||
280 | 280 | ||
281 | struct configfs_subsystem { | 281 | struct configfs_subsystem { |
282 | struct config_group su_group; | 282 | struct config_group su_group; |
283 | struct semaphore su_sem; | 283 | struct mutex su_mutex; |
284 | }; | 284 | }; |
285 | 285 | ||
286 | int configfs_register_subsystem(struct configfs_subsystem *subsys); | 286 | int configfs_register_subsystem(struct configfs_subsystem *subsys); |
287 | void configfs_unregister_subsystem(struct configfs_subsystem *subsys); | 287 | void configfs_unregister_subsystem(struct configfs_subsystem *subsys); |
288 | 288 | ||
289 | A subsystem consists of a toplevel config_group and a semaphore. | 289 | A subsystem consists of a toplevel config_group and a mutex. |
290 | The group is where child config_items are created. For a subsystem, | 290 | The group is where child config_items are created. For a subsystem, |
291 | this group is usually defined statically. Before calling | 291 | this group is usually defined statically. Before calling |
292 | configfs_register_subsystem(), the subsystem must have initialized the | 292 | configfs_register_subsystem(), the subsystem must have initialized the |
293 | group via the usual group _init() functions, and it must also have | 293 | group via the usual group _init() functions, and it must also have |
294 | initialized the semaphore. | 294 | initialized the mutex. |
295 | When the register call returns, the subsystem is live, and it | 295 | When the register call returns, the subsystem is live, and it |
296 | will be visible via configfs. At that point, mkdir(2) can be called and | 296 | will be visible via configfs. At that point, mkdir(2) can be called and |
297 | the subsystem must be ready for it. | 297 | the subsystem must be ready for it. |
@@ -303,7 +303,7 @@ subsystem/group and the simple_child item in configfs_example.c It | |||
303 | shows a trivial object displaying and storing an attribute, and a simple | 303 | shows a trivial object displaying and storing an attribute, and a simple |
304 | group creating and destroying these children. | 304 | group creating and destroying these children. |
305 | 305 | ||
306 | [Hierarchy Navigation and the Subsystem Semaphore] | 306 | [Hierarchy Navigation and the Subsystem Mutex] |
307 | 307 | ||
308 | There is an extra bonus that configfs provides. The config_groups and | 308 | There is an extra bonus that configfs provides. The config_groups and |
309 | config_items are arranged in a hierarchy due to the fact that they | 309 | config_items are arranged in a hierarchy due to the fact that they |
@@ -314,19 +314,19 @@ and config_item->ci_parent structure members. | |||
314 | 314 | ||
315 | A subsystem can navigate the cg_children list and the ci_parent pointer | 315 | A subsystem can navigate the cg_children list and the ci_parent pointer |
316 | to see the tree created by the subsystem. This can race with configfs' | 316 | to see the tree created by the subsystem. This can race with configfs' |
317 | management of the hierarchy, so configfs uses the subsystem semaphore to | 317 | management of the hierarchy, so configfs uses the subsystem mutex to |
318 | protect modifications. Whenever a subsystem wants to navigate the | 318 | protect modifications. Whenever a subsystem wants to navigate the |
319 | hierarchy, it must do so under the protection of the subsystem | 319 | hierarchy, it must do so under the protection of the subsystem |
320 | semaphore. | 320 | mutex. |
321 | 321 | ||
322 | A subsystem will be prevented from acquiring the semaphore while a newly | 322 | A subsystem will be prevented from acquiring the mutex while a newly |
323 | allocated item has not been linked into this hierarchy. Similarly, it | 323 | allocated item has not been linked into this hierarchy. Similarly, it |
324 | will not be able to acquire the semaphore while a dropping item has not | 324 | will not be able to acquire the mutex while a dropping item has not |
325 | yet been unlinked. This means that an item's ci_parent pointer will | 325 | yet been unlinked. This means that an item's ci_parent pointer will |
326 | never be NULL while the item is in configfs, and that an item will only | 326 | never be NULL while the item is in configfs, and that an item will only |
327 | be in its parent's cg_children list for the same duration. This allows | 327 | be in its parent's cg_children list for the same duration. This allows |
328 | a subsystem to trust ci_parent and cg_children while they hold the | 328 | a subsystem to trust ci_parent and cg_children while they hold the |
329 | semaphore. | 329 | mutex. |
330 | 330 | ||
331 | [Item Aggregation Via symlink(2)] | 331 | [Item Aggregation Via symlink(2)] |
332 | 332 | ||
diff --git a/Documentation/filesystems/configfs/configfs_example.c b/Documentation/filesystems/configfs/configfs_example.c index 2d6a14a463e0..e56d49264b39 100644 --- a/Documentation/filesystems/configfs/configfs_example.c +++ b/Documentation/filesystems/configfs/configfs_example.c | |||
@@ -453,7 +453,7 @@ static int __init configfs_example_init(void) | |||
453 | subsys = example_subsys[i]; | 453 | subsys = example_subsys[i]; |
454 | 454 | ||
455 | config_group_init(&subsys->su_group); | 455 | config_group_init(&subsys->su_group); |
456 | init_MUTEX(&subsys->su_sem); | 456 | mutex_init(&subsys->su_mutex); |
457 | ret = configfs_register_subsystem(subsys); | 457 | ret = configfs_register_subsystem(subsys); |
458 | if (ret) { | 458 | if (ret) { |
459 | printk(KERN_ERR "Error %d while registering subsystem %s\n", | 459 | printk(KERN_ERR "Error %d while registering subsystem %s\n", |