aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/filesystems
diff options
context:
space:
mode:
authorJoel Becker <joel.becker@oracle.com>2007-07-07 02:33:17 -0400
committerMark Fasheh <mark.fasheh@oracle.com>2007-07-10 20:10:56 -0400
commite6bd07aee739566803425acdbf5cdb29919164e1 (patch)
treee085a5065d06af2b7c0cab8bcd8fb4eb289344be /Documentation/filesystems
parent3fe6c5ce1176cf661dbe71fc43b627c1a742a89a (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')
-rw-r--r--Documentation/filesystems/configfs/configfs.txt18
-rw-r--r--Documentation/filesystems/configfs/configfs_example.c2
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.
290The group is where child config_items are created. For a subsystem, 290The group is where child config_items are created. For a subsystem,
291this group is usually defined statically. Before calling 291this group is usually defined statically. Before calling
292configfs_register_subsystem(), the subsystem must have initialized the 292configfs_register_subsystem(), the subsystem must have initialized the
293group via the usual group _init() functions, and it must also have 293group via the usual group _init() functions, and it must also have
294initialized the semaphore. 294initialized 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
296will be visible via configfs. At that point, mkdir(2) can be called and 296will be visible via configfs. At that point, mkdir(2) can be called and
297the subsystem must be ready for it. 297the subsystem must be ready for it.
@@ -303,7 +303,7 @@ subsystem/group and the simple_child item in configfs_example.c It
303shows a trivial object displaying and storing an attribute, and a simple 303shows a trivial object displaying and storing an attribute, and a simple
304group creating and destroying these children. 304group creating and destroying these children.
305 305
306[Hierarchy Navigation and the Subsystem Semaphore] 306[Hierarchy Navigation and the Subsystem Mutex]
307 307
308There is an extra bonus that configfs provides. The config_groups and 308There is an extra bonus that configfs provides. The config_groups and
309config_items are arranged in a hierarchy due to the fact that they 309config_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
315A subsystem can navigate the cg_children list and the ci_parent pointer 315A subsystem can navigate the cg_children list and the ci_parent pointer
316to see the tree created by the subsystem. This can race with configfs' 316to see the tree created by the subsystem. This can race with configfs'
317management of the hierarchy, so configfs uses the subsystem semaphore to 317management of the hierarchy, so configfs uses the subsystem mutex to
318protect modifications. Whenever a subsystem wants to navigate the 318protect modifications. Whenever a subsystem wants to navigate the
319hierarchy, it must do so under the protection of the subsystem 319hierarchy, it must do so under the protection of the subsystem
320semaphore. 320mutex.
321 321
322A subsystem will be prevented from acquiring the semaphore while a newly 322A subsystem will be prevented from acquiring the mutex while a newly
323allocated item has not been linked into this hierarchy. Similarly, it 323allocated item has not been linked into this hierarchy. Similarly, it
324will not be able to acquire the semaphore while a dropping item has not 324will not be able to acquire the mutex while a dropping item has not
325yet been unlinked. This means that an item's ci_parent pointer will 325yet been unlinked. This means that an item's ci_parent pointer will
326never be NULL while the item is in configfs, and that an item will only 326never be NULL while the item is in configfs, and that an item will only
327be in its parent's cg_children list for the same duration. This allows 327be in its parent's cg_children list for the same duration. This allows
328a subsystem to trust ci_parent and cg_children while they hold the 328a subsystem to trust ci_parent and cg_children while they hold the
329semaphore. 329mutex.
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",