From: Josh Durgin <josh.durgin@inktank.com>
To: Alex Elder <elder@inktank.com>
Cc: "ceph-devel@vger.kernel.org" <ceph-devel@vger.kernel.org>
Subject: Re: [PATCH REPOST] libceph: reformat __reset_osd()
Date: Tue, 15 Jan 2013 15:10:49 -0800 [thread overview]
Message-ID: <50F5E1F9.2080405@inktank.com> (raw)
In-Reply-To: <50E5D5E3.1080306@inktank.com>
On 01/03/2013 11:02 AM, Alex Elder wrote:
> Reformat __reset_osd() into three distinct blocks of code
> handling the three return cases.
>
> Signed-off-by: Alex Elder <elder@inktank.com>
> ---
Looks good. With one small duplication removed,
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
> net/ceph/osd_client.c | 33 +++++++++++++++++++--------------
> 1 file changed, 19 insertions(+), 14 deletions(-)
>
> diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
> index eb9a444..5f9f65a 100644
> --- a/net/ceph/osd_client.c
> +++ b/net/ceph/osd_client.c
> @@ -739,31 +739,36 @@ static void remove_old_osds(struct ceph_osd_client
> *osdc)
> */
> static int __reset_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd)
> {
> - struct ceph_osd_request *req;
> - int ret = 0;
> + struct ceph_entity_addr *peer_addr;
>
> dout("__reset_osd %p osd%d\n", osd, osd->o_osd);
> if (list_empty(&osd->o_requests) &&
> list_empty(&osd->o_linger_requests)) {
> __remove_osd(osdc, osd);
> - ret = -ENODEV;
> - } else if (memcmp(&osdc->osdmap->osd_addr[osd->o_osd],
> - &osd->o_con.peer_addr,
> - sizeof(osd->o_con.peer_addr)) == 0 &&
> - !ceph_con_opened(&osd->o_con)) {
> +
> + return -ENODEV;
> + }
> +
> + peer_addr = &osdc->osdmap->osd_addr[osd->o_osd];
> + if (!memcmp(peer_addr, &osd->o_con.peer_addr, sizeof (*peer_addr)) &&
> + !ceph_con_opened(&osd->o_con)) {
> + struct ceph_osd_request *req;
> +
> dout(" osd addr hasn't changed and connection never opened,"
> " letting msgr retry");
> /* touch each r_stamp for handle_timeout()'s benfit */
> list_for_each_entry(req, &osd->o_requests, r_osd_item)
> req->r_stamp = jiffies;
> - ret = -EAGAIN;
> - } else {
> - ceph_con_close(&osd->o_con);
> - ceph_con_open(&osd->o_con, CEPH_ENTITY_TYPE_OSD, osd->o_osd,
> - &osdc->osdmap->osd_addr[osd->o_osd]);
> - osd->o_incarnation++;
> +
> + return -EAGAIN;
> }
> - return ret;
> +
> + ceph_con_close(&osd->o_con);
> + ceph_con_open(&osd->o_con, CEPH_ENTITY_TYPE_OSD, osd->o_osd,
> + &osdc->osdmap->osd_addr[osd->o_osd]);
This is peer_addr again.
> + osd->o_incarnation++;
> +
> + return 0;
> }
>
> static void __insert_osd(struct ceph_osd_client *osdc, struct ceph_osd
> *new)
>
prev parent reply other threads:[~2013-01-15 23:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-03 19:02 [PATCH REPOST] libceph: reformat __reset_osd() Alex Elder
2013-01-15 23:10 ` Josh Durgin [this message]
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=50F5E1F9.2080405@inktank.com \
--to=josh.durgin@inktank.com \
--cc=ceph-devel@vger.kernel.org \
--cc=elder@inktank.com \
/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