From: Alex Elder <elder@dreamhost.com>
To: ceph-devel@vger.kernel.org
Subject: [PATCH 4/4] rbd: use a single value of snap_name to mean no snap
Date: Tue, 28 Feb 2012 19:35:13 -0800 [thread overview]
Message-ID: <4F4D9CF1.1020101@dreamhost.com> (raw)
In-Reply-To: <4F4D9BF6.5070102@dreamhost.com>
From Josh Durgin <josh.durgin@dreamhost.com>
There's already a constant for this anyway.
(I changed Josh's code to use memcmp() and memcpy() instead. -Alex)
Signed-off-by: Alex Elder <elder@dreamhost.com>
---
drivers/block/rbd.c | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 3d0f8cf..25ed3c0 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -563,10 +563,7 @@ static int rbd_header_set_snap(struct rbd_device *dev,
down_write(&header->snap_rwsem);
- if (!snap_name ||
- !*snap_name ||
- strcmp(snap_name, "-") == 0 ||
- strcmp(snap_name, RBD_SNAP_HEAD_NAME) == 0) {
+ if (!memcmp(snap_name, RBD_SNAP_HEAD_NAME, sizeof RBD_SNAP_HEAD_NAME)) {
if (header->total_snaps)
snapc->seq = header->snap_seq;
else
@@ -2213,7 +2210,8 @@ static ssize_t rbd_add(struct bus_type *bus,
}
if (rbd_dev->snap_name[0] == 0)
- rbd_dev->snap_name[0] = '-';
+ memcpy(rbd_dev->snap_name, RBD_SNAP_HEAD_NAME,
+ sizeof RBD_SNAP_HEAD_NAME);
rbd_dev->obj_len = strlen(rbd_dev->obj);
snprintf(rbd_dev->obj_md_name, sizeof(rbd_dev->obj_md_name), "%s%s",
--
1.7.5.4
next prev parent reply other threads:[~2012-02-29 3:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-29 3:31 [PATCH 0/4] rbd: miscellaneous cleanups Alex Elder
2012-02-29 3:35 ` [PATCH 1/4] rbd: a few small cleanups Alex Elder
2012-03-02 19:44 ` Sage Weil
2012-03-02 23:22 ` Alex Elder
2012-02-29 3:35 ` [PATCH 2/4] rbd: make ceph_parse_options() return a pointer Alex Elder
2012-02-29 3:35 ` [PATCH 3/4] rbd: do not duplicate ceph_client pointer in rbd_device Alex Elder
2012-02-29 3:35 ` Alex Elder [this message]
2012-02-29 4:53 ` [PATCH 4/4] rbd: use a single value of snap_name to mean no snap Yehuda Sadeh Weinraub
2012-02-29 5:35 ` Alex Elder
2012-03-02 19:46 ` [PATCH 0/4] rbd: miscellaneous cleanups Sage Weil
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=4F4D9CF1.1020101@dreamhost.com \
--to=elder@dreamhost.com \
--cc=ceph-devel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.