From: Philipp Reisner <philipp.reisner@linbit.com>
To: linux-kernel@vger.kernel.org, Jens Axboe <axboe@kernel.dk>
Cc: drbd-dev@lists.linbit.com
Subject: [PATCH 5/8] drbd: Get rid of the __no_warn and __cond_lock macros
Date: Mon, 25 Aug 2014 15:16:35 +0200 [thread overview]
Message-ID: <1408972598-16650-6-git-send-email-philipp.reisner@linbit.com> (raw)
In-Reply-To: <1408972598-16650-1-git-send-email-philipp.reisner@linbit.com>
From: Andreas Gruenbacher <andreas.gruenbacher@gmail.com>
These macros can easily be replaced with its definition.
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
---
drivers/block/drbd/drbd_int.h | 11 ++++++-----
drivers/block/drbd/drbd_worker.c | 9 ++++++---
2 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h
index f424dc0..9b22f8f 100644
--- a/drivers/block/drbd/drbd_int.h
+++ b/drivers/block/drbd/drbd_int.h
@@ -61,8 +61,6 @@
# define __must_hold(x)
#endif
-#define __no_warn(lock, stmt) do { __acquire(lock); stmt; __release(lock); } while (0)
-
/* module parameter, defined in drbd_main.c */
extern unsigned int minor_count;
extern bool disable_sendpage;
@@ -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
- * @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.
*/
-#define get_ldev(M) __cond_lock(local, _get_ldev_if_state(M,D_INCONSISTENT))
-#define get_ldev_if_state(M,MINS) __cond_lock(local, _get_ldev_if_state(M,MINS))
+#define get_ldev_if_state(_device, _min_state) \
+ (_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)
{
diff --git a/drivers/block/drbd/drbd_worker.c b/drivers/block/drbd/drbd_worker.c
index 6e01e62..b20cd21 100644
--- a/drivers/block/drbd/drbd_worker.c
+++ b/drivers/block/drbd/drbd_worker.c
@@ -1853,9 +1853,12 @@ static void drbd_ldev_destroy(struct drbd_device *device)
device->resync = NULL;
lc_destroy(device->act_log);
device->act_log = NULL;
- __no_warn(local,
- drbd_free_ldev(device->ldev);
- device->ldev = NULL;);
+
+ __acquire(local);
+ drbd_free_ldev(device->ldev);
+ device->ldev = NULL;
+ __release(local);
+
clear_bit(GOING_DISKLESS, &device->flags);
wake_up(&device->misc_wait);
}
--
1.9.1
next prev parent reply other threads:[~2014-08-25 13:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-25 13:16 [PATCH 0/8] RFC DRBD cleanups and performance work Philipp Reisner
2014-08-25 13:16 ` [PATCH 1/8] drbd: Use better variable names Philipp Reisner
2014-08-25 13:16 ` [PATCH 2/8] drbd: Use consistent names for all the bi_end_io callbacks Philipp Reisner
2014-08-25 13:16 ` [PATCH 3/8] drbd: Remove superfluous newline from "resync_extents" debugfs entry Philipp Reisner
2014-08-25 13:16 ` [PATCH 4/8] drbd: Avoid inconsistent locking warning Philipp Reisner
2014-08-25 13:16 ` Philipp Reisner [this message]
2014-08-25 13:16 ` [PATCH 6/8] drbd: Get rid of the WORK_PENDING macro Philipp Reisner
2014-08-25 13:16 ` [PATCH 7/8] drbd: Improve asender performance Philipp Reisner
2014-08-25 13:16 ` [PATCH 8/8] drbd: reduce lock contention in drbd_worker Philipp Reisner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1408972598-16650-6-git-send-email-philipp.reisner@linbit.com \
--to=philipp.reisner@linbit.com \
--cc=axboe@kernel.dk \
--cc=drbd-dev@lists.linbit.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®