osd_client.c (144cba1493fdd6e3e1980e439a31df877831ebcd) osd_client.c (a319bf56a617354e62cf5f774d2ca4e1a8a3bff3)
1
2#include <linux/ceph/ceph_debug.h>
3
4#include <linux/module.h>
5#include <linux/err.h>
6#include <linux/highmem.h>
7#include <linux/mm.h>
8#include <linux/pagemap.h>

--- 1083 unchanged lines hidden (view full) ---

1092
1093static void __move_osd_to_lru(struct ceph_osd_client *osdc,
1094 struct ceph_osd *osd)
1095{
1096 dout("%s %p\n", __func__, osd);
1097 BUG_ON(!list_empty(&osd->o_osd_lru));
1098
1099 list_add_tail(&osd->o_osd_lru, &osdc->osd_lru);
1
2#include <linux/ceph/ceph_debug.h>
3
4#include <linux/module.h>
5#include <linux/err.h>
6#include <linux/highmem.h>
7#include <linux/mm.h>
8#include <linux/pagemap.h>

--- 1083 unchanged lines hidden (view full) ---

1092
1093static void __move_osd_to_lru(struct ceph_osd_client *osdc,
1094 struct ceph_osd *osd)
1095{
1096 dout("%s %p\n", __func__, osd);
1097 BUG_ON(!list_empty(&osd->o_osd_lru));
1098
1099 list_add_tail(&osd->o_osd_lru, &osdc->osd_lru);
1100 osd->lru_ttl = jiffies + osdc->client->options->osd_idle_ttl * HZ;
1100 osd->lru_ttl = jiffies + osdc->client->options->osd_idle_ttl;
1101}
1102
1103static void maybe_move_osd_to_lru(struct ceph_osd_client *osdc,
1104 struct ceph_osd *osd)
1105{
1106 dout("%s %p\n", __func__, osd);
1107
1108 if (list_empty(&osd->o_requests) &&

--- 94 unchanged lines hidden (view full) ---

1203 return osd;
1204 }
1205 return NULL;
1206}
1207
1208static void __schedule_osd_timeout(struct ceph_osd_client *osdc)
1209{
1210 schedule_delayed_work(&osdc->timeout_work,
1101}
1102
1103static void maybe_move_osd_to_lru(struct ceph_osd_client *osdc,
1104 struct ceph_osd *osd)
1105{
1106 dout("%s %p\n", __func__, osd);
1107
1108 if (list_empty(&osd->o_requests) &&

--- 94 unchanged lines hidden (view full) ---

1203 return osd;
1204 }
1205 return NULL;
1206}
1207
1208static void __schedule_osd_timeout(struct ceph_osd_client *osdc)
1209{
1210 schedule_delayed_work(&osdc->timeout_work,
1211 osdc->client->options->osd_keepalive_timeout * HZ);
1211 osdc->client->options->osd_keepalive_timeout);
1212}
1213
1214static void __cancel_osd_timeout(struct ceph_osd_client *osdc)
1215{
1216 cancel_delayed_work(&osdc->timeout_work);
1217}
1218
1219/*

--- 351 unchanged lines hidden (view full) ---

1571 * request timeouts another N seconds in the future as we go.
1572 * Reschedule the timeout event another N seconds in future (unless
1573 * there are no open requests).
1574 */
1575static void handle_timeout(struct work_struct *work)
1576{
1577 struct ceph_osd_client *osdc =
1578 container_of(work, struct ceph_osd_client, timeout_work.work);
1212}
1213
1214static void __cancel_osd_timeout(struct ceph_osd_client *osdc)
1215{
1216 cancel_delayed_work(&osdc->timeout_work);
1217}
1218
1219/*

--- 351 unchanged lines hidden (view full) ---

1571 * request timeouts another N seconds in the future as we go.
1572 * Reschedule the timeout event another N seconds in future (unless
1573 * there are no open requests).
1574 */
1575static void handle_timeout(struct work_struct *work)
1576{
1577 struct ceph_osd_client *osdc =
1578 container_of(work, struct ceph_osd_client, timeout_work.work);
1579 struct ceph_options *opts = osdc->client->options;
1579 struct ceph_osd_request *req;
1580 struct ceph_osd *osd;
1580 struct ceph_osd_request *req;
1581 struct ceph_osd *osd;
1581 unsigned long keepalive =
1582 osdc->client->options->osd_keepalive_timeout * HZ;
1583 struct list_head slow_osds;
1584 dout("timeout\n");
1585 down_read(&osdc->map_sem);
1586
1587 ceph_monc_request_next_osdmap(&osdc->client->monc);
1588
1589 mutex_lock(&osdc->request_mutex);
1590
1591 /*
1592 * ping osds that are a bit slow. this ensures that if there
1593 * is a break in the TCP connection we will notice, and reopen
1594 * a connection with that osd (from the fault callback).
1595 */
1596 INIT_LIST_HEAD(&slow_osds);
1597 list_for_each_entry(req, &osdc->req_lru, r_req_lru_item) {
1582 struct list_head slow_osds;
1583 dout("timeout\n");
1584 down_read(&osdc->map_sem);
1585
1586 ceph_monc_request_next_osdmap(&osdc->client->monc);
1587
1588 mutex_lock(&osdc->request_mutex);
1589
1590 /*
1591 * ping osds that are a bit slow. this ensures that if there
1592 * is a break in the TCP connection we will notice, and reopen
1593 * a connection with that osd (from the fault callback).
1594 */
1595 INIT_LIST_HEAD(&slow_osds);
1596 list_for_each_entry(req, &osdc->req_lru, r_req_lru_item) {
1598 if (time_before(jiffies, req->r_stamp + keepalive))
1597 if (time_before(jiffies,
1598 req->r_stamp + opts->osd_keepalive_timeout))
1599 break;
1600
1601 osd = req->r_osd;
1602 BUG_ON(!osd);
1603 dout(" tid %llu is slow, will send keepalive on osd%d\n",
1604 req->r_tid, osd->o_osd);
1605 list_move_tail(&osd->o_keepalive_item, &slow_osds);
1606 }

--- 10 unchanged lines hidden (view full) ---

1617 up_read(&osdc->map_sem);
1618}
1619
1620static void handle_osds_timeout(struct work_struct *work)
1621{
1622 struct ceph_osd_client *osdc =
1623 container_of(work, struct ceph_osd_client,
1624 osds_timeout_work.work);
1599 break;
1600
1601 osd = req->r_osd;
1602 BUG_ON(!osd);
1603 dout(" tid %llu is slow, will send keepalive on osd%d\n",
1604 req->r_tid, osd->o_osd);
1605 list_move_tail(&osd->o_keepalive_item, &slow_osds);
1606 }

--- 10 unchanged lines hidden (view full) ---

1617 up_read(&osdc->map_sem);
1618}
1619
1620static void handle_osds_timeout(struct work_struct *work)
1621{
1622 struct ceph_osd_client *osdc =
1623 container_of(work, struct ceph_osd_client,
1624 osds_timeout_work.work);
1625 unsigned long delay =
1626 osdc->client->options->osd_idle_ttl * HZ >> 2;
1625 unsigned long delay = osdc->client->options->osd_idle_ttl / 4;
1627
1628 dout("osds timeout\n");
1629 down_read(&osdc->map_sem);
1630 remove_old_osds(osdc);
1631 up_read(&osdc->map_sem);
1632
1633 schedule_delayed_work(&osdc->osds_timeout_work,
1634 round_jiffies_relative(delay));

--- 988 unchanged lines hidden (view full) ---

2623 osdc->num_requests = 0;
2624 INIT_DELAYED_WORK(&osdc->timeout_work, handle_timeout);
2625 INIT_DELAYED_WORK(&osdc->osds_timeout_work, handle_osds_timeout);
2626 spin_lock_init(&osdc->event_lock);
2627 osdc->event_tree = RB_ROOT;
2628 osdc->event_count = 0;
2629
2630 schedule_delayed_work(&osdc->osds_timeout_work,
1626
1627 dout("osds timeout\n");
1628 down_read(&osdc->map_sem);
1629 remove_old_osds(osdc);
1630 up_read(&osdc->map_sem);
1631
1632 schedule_delayed_work(&osdc->osds_timeout_work,
1633 round_jiffies_relative(delay));

--- 988 unchanged lines hidden (view full) ---

2622 osdc->num_requests = 0;
2623 INIT_DELAYED_WORK(&osdc->timeout_work, handle_timeout);
2624 INIT_DELAYED_WORK(&osdc->osds_timeout_work, handle_osds_timeout);
2625 spin_lock_init(&osdc->event_lock);
2626 osdc->event_tree = RB_ROOT;
2627 osdc->event_count = 0;
2628
2629 schedule_delayed_work(&osdc->osds_timeout_work,
2631 round_jiffies_relative(osdc->client->options->osd_idle_ttl * HZ));
2630 round_jiffies_relative(osdc->client->options->osd_idle_ttl));
2632
2633 err = -ENOMEM;
2634 osdc->req_mempool = mempool_create_kmalloc_pool(10,
2635 sizeof(struct ceph_osd_request));
2636 if (!osdc->req_mempool)
2637 goto out;
2638
2639 err = ceph_msgpool_init(&osdc->msgpool_op, CEPH_MSG_OSD_OP,

--- 378 unchanged lines hidden ---
2631
2632 err = -ENOMEM;
2633 osdc->req_mempool = mempool_create_kmalloc_pool(10,
2634 sizeof(struct ceph_osd_request));
2635 if (!osdc->req_mempool)
2636 goto out;
2637
2638 err = ceph_msgpool_init(&osdc->msgpool_op, CEPH_MSG_OSD_OP,

--- 378 unchanged lines hidden ---