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 02/16] drbd: Replace atomic_add_return with atomic_inc_return
Date: Wed, 31 Aug 2011 17:10:54 +0200 [thread overview]
Message-ID: <1314803468-1201-3-git-send-email-philipp.reisner@linbit.com> (raw)
In-Reply-To: <1314803468-1201-1-git-send-email-philipp.reisner@linbit.com>
From: Andreas Gruenbacher <agruen@linbit.com>
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
---
drivers/block/drbd/drbd_main.c | 4 ++--
drivers/block/drbd/drbd_nl.c | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 47c4bae..e9e60d8 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -1242,7 +1242,7 @@ static int _drbd_send_ack(struct drbd_conf *mdev, enum drbd_packet cmd,
p.sector = sector;
p.block_id = block_id;
p.blksize = blksize;
- p.seq_num = cpu_to_be32(atomic_add_return(1, &mdev->packet_seq));
+ p.seq_num = cpu_to_be32(atomic_inc_return(&mdev->packet_seq));
if (!mdev->tconn->meta.socket || mdev->state.conn < C_CONNECTED)
return false;
@@ -1530,7 +1530,7 @@ int drbd_send_dblock(struct drbd_conf *mdev, struct drbd_request *req)
prepare_header(mdev, &p.head, P_DATA, sizeof(p) - sizeof(struct p_header) + dgs + req->i.size);
p.sector = cpu_to_be64(req->i.sector);
p.block_id = (unsigned long)req;
- p.seq_num = cpu_to_be32(req->seq_num = atomic_add_return(1, &mdev->packet_seq));
+ p.seq_num = cpu_to_be32(req->seq_num = atomic_inc_return(&mdev->packet_seq));
dp_flags = bio_flags_to_wire(mdev, req->master_bio->bi_rw);
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
index 90d7317..0168587 100644
--- a/drivers/block/drbd/drbd_nl.c
+++ b/drivers/block/drbd/drbd_nl.c
@@ -2374,7 +2374,7 @@ void drbd_bcast_state(struct drbd_conf *mdev, union drbd_state state)
cn_reply->id.idx = CN_IDX_DRBD;
cn_reply->id.val = CN_VAL_DRBD;
- cn_reply->seq = atomic_add_return(1, &drbd_nl_seq);
+ cn_reply->seq = atomic_inc_return(&drbd_nl_seq);
cn_reply->ack = 0; /* not used here. */
cn_reply->len = sizeof(struct drbd_nl_cfg_reply) +
(int)((char *)tl - (char *)reply->tag_list);
@@ -2406,7 +2406,7 @@ void drbd_bcast_ev_helper(struct drbd_conf *mdev, char *helper_name)
cn_reply->id.idx = CN_IDX_DRBD;
cn_reply->id.val = CN_VAL_DRBD;
- cn_reply->seq = atomic_add_return(1, &drbd_nl_seq);
+ cn_reply->seq = atomic_inc_return(&drbd_nl_seq);
cn_reply->ack = 0; /* not used here. */
cn_reply->len = sizeof(struct drbd_nl_cfg_reply) +
(int)((char *)tl - (char *)reply->tag_list);
@@ -2485,7 +2485,7 @@ void drbd_bcast_ee(struct drbd_conf *mdev, const char *reason, const int dgs,
cn_reply->id.idx = CN_IDX_DRBD;
cn_reply->id.val = CN_VAL_DRBD;
- cn_reply->seq = atomic_add_return(1,&drbd_nl_seq);
+ cn_reply->seq = atomic_inc_return(&drbd_nl_seq);
cn_reply->ack = 0; // not used here.
cn_reply->len = sizeof(struct drbd_nl_cfg_reply) +
(int)((char*)tl - (char*)reply->tag_list);
@@ -2524,7 +2524,7 @@ void drbd_bcast_sync_progress(struct drbd_conf *mdev)
cn_reply->id.idx = CN_IDX_DRBD;
cn_reply->id.val = CN_VAL_DRBD;
- cn_reply->seq = atomic_add_return(1, &drbd_nl_seq);
+ cn_reply->seq = atomic_inc_return(&drbd_nl_seq);
cn_reply->ack = 0; /* not used here. */
cn_reply->len = sizeof(struct drbd_nl_cfg_reply) +
(int)((char *)tl - (char *)reply->tag_list);
--
1.7.4.1
next prev parent reply other threads:[~2011-08-31 15:11 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-31 15:10 [RFC 00/16] drbd: part 3 of adding multiple volume support to drbd Philipp Reisner
2011-08-31 15:10 ` [PATCH 01/16] drbd: Concurrent write detection fix Philipp Reisner
2011-08-31 15:10 ` Philipp Reisner [this message]
2011-08-31 15:10 ` [PATCH 03/16] drbd: Use ping-timeout when waiting for missing ack packets Philipp Reisner
2011-08-31 15:10 ` [PATCH 04/16] drbd: Improve how conflicting writes are handled Philipp Reisner
2011-08-31 15:10 ` [PATCH 05/16] drbd: Remove redundant check Philipp Reisner
2011-08-31 15:10 ` [PATCH 06/16] drbd: Get rid of P_MAX_CMD Philipp Reisner
2011-08-31 15:10 ` [PATCH 07/16] drbd: Replace get_asender_cmd() with its implementation Philipp Reisner
2011-08-31 15:11 ` [PATCH 08/16] drbd: Remove left-over function prototypes Philipp Reisner
2011-08-31 15:11 ` [PATCH 09/16] drbd: Reworked the unconfiguring and thread stopping code Philipp Reisner
2011-08-31 15:11 ` [PATCH 10/16] drbd: Removed the mdev parameter from the ..to_tags() and ...from_tags() functions Philipp Reisner
2011-08-31 15:11 ` [PATCH 11/16] drbd: Improved the dec_*() macros Philipp Reisner
2011-08-31 15:11 ` [PATCH 12/16] drbd: Converted the transfer log from mdev to tconn Philipp Reisner
2011-08-31 15:11 ` [PATCH 13/16] drbd: Preparing the connector interface to operator on connections Philipp Reisner
2011-08-31 15:11 ` [PATCH 14/16] drbd: Converted drbd_nl_(net_conf|disconnect)() from mdev to tconn Philipp Reisner
2011-08-31 15:11 ` [PATCH 15/16] drbd: Implemented new commands to create/delete connections/minors Philipp Reisner
2011-08-31 15:11 ` [PATCH 16/16] drbd: Replaced the minor_table array by an idr 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=1314803468-1201-3-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®