Commit d1b80853 authored by Andreas Gruenbacher's avatar Andreas Gruenbacher Committed by Jens Axboe

drbd: Get rid of the __no_warn and __cond_lock macros

These macros can easily be replaced with its definition.
Signed-off-by: default avatarPhilipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: default avatarLars Ellenberg <lars.ellenberg@linbit.com>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent 8d4ba3f0
...@@ -61,8 +61,6 @@ ...@@ -61,8 +61,6 @@
# define __must_hold(x) # define __must_hold(x)
#endif #endif
#define __no_warn(lock, stmt) do { __acquire(lock); stmt; __release(lock); } while (0)
/* module parameter, defined in drbd_main.c */ /* module parameter, defined in drbd_main.c */
extern unsigned int minor_count; extern unsigned int minor_count;
extern bool disable_sendpage; extern bool disable_sendpage;
...@@ -2100,12 +2098,15 @@ static inline bool is_sync_state(enum drbd_conns connection_state) ...@@ -2100,12 +2098,15 @@ static inline bool is_sync_state(enum drbd_conns connection_state)
/** /**
* get_ldev() - Increase the ref count on device->ldev. Returns 0 if there is no ldev * get_ldev() - Increase the ref count on device->ldev. Returns 0 if there is no ldev
* @M: DRBD device. * @_device: DRBD device.
* @_min_state: Minimum device state required for success.
* *
* You have to call put_ldev() when finished working with device->ldev. * You have to call put_ldev() when finished working with device->ldev.
*/ */
#define get_ldev(M) __cond_lock(local, _get_ldev_if_state(M,D_INCONSISTENT)) #define get_ldev_if_state(_device, _min_state) \
#define get_ldev_if_state(M,MINS) __cond_lock(local, _get_ldev_if_state(M,MINS)) (_get_ldev_if_state((_device), (_min_state)) ? \
({ __acquire(x); true; }) : false)
#define get_ldev(_device) get_ldev_if_state(_device, D_INCONSISTENT)
static inline void put_ldev(struct drbd_device *device) static inline void put_ldev(struct drbd_device *device)
{ {
......
...@@ -1853,9 +1853,12 @@ static void drbd_ldev_destroy(struct drbd_device *device) ...@@ -1853,9 +1853,12 @@ static void drbd_ldev_destroy(struct drbd_device *device)
device->resync = NULL; device->resync = NULL;
lc_destroy(device->act_log); lc_destroy(device->act_log);
device->act_log = NULL; device->act_log = NULL;
__no_warn(local,
drbd_free_ldev(device->ldev); __acquire(local);
device->ldev = NULL;); drbd_free_ldev(device->ldev);
device->ldev = NULL;
__release(local);
clear_bit(GOING_DISKLESS, &device->flags); clear_bit(GOING_DISKLESS, &device->flags);
wake_up(&device->misc_wait); wake_up(&device->misc_wait);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment