[PATCH 4/10] dm: rwlock_t -> rw_semaphore (fluff)

From: Joe Thornber (joe@fib011235813.fsnet.co.uk)
Date: Wed Jan 08 2003 - 04:56:23 EST


Use a rw_semaphore in dm_target.c rather than a rwlock_t, just to keep
in line with dm.c
--- diff/drivers/md/dm-target.c 2003-01-02 11:16:16.000000000 +0000
+++ source/drivers/md/dm-target.c 2003-01-02 11:26:27.000000000 +0000
@@ -19,7 +19,7 @@
 };
 
 static LIST_HEAD(_targets);
-static rwlock_t _lock = RW_LOCK_UNLOCKED;
+static DECLARE_RWSEM(_lock);
 
 #define DM_MOD_NAME_SIZE 32
 
@@ -42,7 +42,7 @@
 {
         struct tt_internal *ti;
 
- read_lock(&_lock);
+ down_read(&_lock);
 
         ti = __find_target_type(name);
         if (ti) {
@@ -52,7 +52,7 @@
                         ti->use++;
         }
 
- read_unlock(&_lock);
+ up_read(&_lock);
         return ti;
 }
 
@@ -86,13 +86,13 @@
 {
         struct tt_internal *ti = (struct tt_internal *) t;
 
- read_lock(&_lock);
+ down_read(&_lock);
         if (--ti->use == 0)
                 module_put(ti->tt.module);
 
         if (ti->use < 0)
                 BUG();
- read_unlock(&_lock);
+ up_read(&_lock);
 
         return;
 }
@@ -117,13 +117,13 @@
         if (!ti)
                 return -ENOMEM;
 
- write_lock(&_lock);
+ down_write(&_lock);
         if (__find_target_type(t->name))
                 rv = -EEXIST;
         else
                 list_add(&ti->list, &_targets);
 
- write_unlock(&_lock);
+ up_write(&_lock);
         return rv;
 }
 
@@ -131,21 +131,21 @@
 {
         struct tt_internal *ti;
 
- write_lock(&_lock);
+ down_write(&_lock);
         if (!(ti = __find_target_type(t->name))) {
- write_unlock(&_lock);
+ up_write(&_lock);
                 return -EINVAL;
         }
 
         if (ti->use) {
- write_unlock(&_lock);
+ up_write(&_lock);
                 return -ETXTBSY;
         }
 
         list_del(&ti->list);
         kfree(ti);
 
- write_unlock(&_lock);
+ up_write(&_lock);
         return 0;
 }
 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Jan 15 2003 - 22:00:22 EST