aboutsummaryrefslogtreecommitdiffstats
path: root/net/ceph
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2012-12-07 10:57:58 -0500
committerAlex Elder <elder@inktank.com>2013-01-17 15:07:44 -0500
commitc3acb18196cf3d7d3db6a5121c1bc674c3fba31f (patch)
tree556debd1c2aafe234743166e7c591c35bbe1176e /net/ceph
parent7d7c1f6136bac00174842f845babe7fb3483724e (diff)
libceph: reformat __reset_osd()
Reformat __reset_osd() into three distinct blocks of code handling the three return cases. Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'net/ceph')
-rw-r--r--net/ceph/osd_client.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 267f183b801a..eade41bb7102 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -747,31 +747,35 @@ static void remove_old_osds(struct ceph_osd_client *osdc)
747 */ 747 */
748static int __reset_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd) 748static int __reset_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd)
749{ 749{
750 struct ceph_osd_request *req; 750 struct ceph_entity_addr *peer_addr;
751 int ret = 0;
752 751
753 dout("__reset_osd %p osd%d\n", osd, osd->o_osd); 752 dout("__reset_osd %p osd%d\n", osd, osd->o_osd);
754 if (list_empty(&osd->o_requests) && 753 if (list_empty(&osd->o_requests) &&
755 list_empty(&osd->o_linger_requests)) { 754 list_empty(&osd->o_linger_requests)) {
756 __remove_osd(osdc, osd); 755 __remove_osd(osdc, osd);
757 ret = -ENODEV; 756
758 } else if (memcmp(&osdc->osdmap->osd_addr[osd->o_osd], 757 return -ENODEV;
759 &osd->o_con.peer_addr, 758 }
760 sizeof(osd->o_con.peer_addr)) == 0 && 759
761 !ceph_con_opened(&osd->o_con)) { 760 peer_addr = &osdc->osdmap->osd_addr[osd->o_osd];
761 if (!memcmp(peer_addr, &osd->o_con.peer_addr, sizeof (*peer_addr)) &&
762 !ceph_con_opened(&osd->o_con)) {
763 struct ceph_osd_request *req;
764
762 dout(" osd addr hasn't changed and connection never opened," 765 dout(" osd addr hasn't changed and connection never opened,"
763 " letting msgr retry"); 766 " letting msgr retry");
764 /* touch each r_stamp for handle_timeout()'s benfit */ 767 /* touch each r_stamp for handle_timeout()'s benfit */
765 list_for_each_entry(req, &osd->o_requests, r_osd_item) 768 list_for_each_entry(req, &osd->o_requests, r_osd_item)
766 req->r_stamp = jiffies; 769 req->r_stamp = jiffies;
767 ret = -EAGAIN; 770
768 } else { 771 return -EAGAIN;
769 ceph_con_close(&osd->o_con);
770 ceph_con_open(&osd->o_con, CEPH_ENTITY_TYPE_OSD, osd->o_osd,
771 &osdc->osdmap->osd_addr[osd->o_osd]);
772 osd->o_incarnation++;
773 } 772 }
774 return ret; 773
774 ceph_con_close(&osd->o_con);
775 ceph_con_open(&osd->o_con, CEPH_ENTITY_TYPE_OSD, osd->o_osd, peer_addr);
776 osd->o_incarnation++;
777
778 return 0;
775} 779}
776 780
777static void __insert_osd(struct ceph_osd_client *osdc, struct ceph_osd *new) 781static void __insert_osd(struct ceph_osd_client *osdc, struct ceph_osd *new)