.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* -*- mode: c; c-basic-offset: 8; -*- |
---|
2 | 3 | * vim: noexpandtab sw=8 ts=8 sts=0: |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (C) 2004, 2005 Oracle. All rights reserved. |
---|
5 | | - * |
---|
6 | | - * This program is free software; you can redistribute it and/or |
---|
7 | | - * modify it under the terms of the GNU General Public |
---|
8 | | - * License as published by the Free Software Foundation; either |
---|
9 | | - * version 2 of the License, or (at your option) any later version. |
---|
10 | | - * |
---|
11 | | - * This program is distributed in the hope that it will be useful, |
---|
12 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
14 | | - * General Public License for more details. |
---|
15 | | - * |
---|
16 | | - * You should have received a copy of the GNU General Public |
---|
17 | | - * License along with this program; if not, write to the |
---|
18 | | - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
---|
19 | | - * Boston, MA 021110-1307, USA. |
---|
20 | 6 | */ |
---|
21 | 7 | |
---|
22 | 8 | #include <linux/kernel.h> |
---|
.. | .. |
---|
106 | 92 | #define O2HB_DEBUG_REGION_PINNED "pinned" |
---|
107 | 93 | |
---|
108 | 94 | static struct dentry *o2hb_debug_dir; |
---|
109 | | -static struct dentry *o2hb_debug_livenodes; |
---|
110 | | -static struct dentry *o2hb_debug_liveregions; |
---|
111 | | -static struct dentry *o2hb_debug_quorumregions; |
---|
112 | | -static struct dentry *o2hb_debug_failedregions; |
---|
113 | 95 | |
---|
114 | 96 | static LIST_HEAD(o2hb_all_regions); |
---|
115 | 97 | |
---|
.. | .. |
---|
118 | 100 | } o2hb_callbacks[O2HB_NUM_CB]; |
---|
119 | 101 | |
---|
120 | 102 | static struct o2hb_callback *hbcall_from_type(enum o2hb_callback_type type); |
---|
121 | | - |
---|
122 | | -#define O2HB_DEFAULT_BLOCK_BITS 9 |
---|
123 | 103 | |
---|
124 | 104 | enum o2hb_heartbeat_modes { |
---|
125 | 105 | O2HB_HEARTBEAT_LOCAL = 0, |
---|
.. | .. |
---|
243 | 223 | unsigned int hr_region_num; |
---|
244 | 224 | |
---|
245 | 225 | struct dentry *hr_debug_dir; |
---|
246 | | - struct dentry *hr_debug_livenodes; |
---|
247 | | - struct dentry *hr_debug_regnum; |
---|
248 | | - struct dentry *hr_debug_elapsed_time; |
---|
249 | | - struct dentry *hr_debug_pinned; |
---|
250 | 226 | struct o2hb_debug_buf *hr_db_livenodes; |
---|
251 | 227 | struct o2hb_debug_buf *hr_db_regnum; |
---|
252 | 228 | struct o2hb_debug_buf *hr_db_elapsed_time; |
---|
.. | .. |
---|
582 | 558 | } |
---|
583 | 559 | |
---|
584 | 560 | static int o2hb_read_slots(struct o2hb_region *reg, |
---|
| 561 | + unsigned int begin_slot, |
---|
585 | 562 | unsigned int max_slots) |
---|
586 | 563 | { |
---|
587 | | - unsigned int current_slot=0; |
---|
| 564 | + unsigned int current_slot = begin_slot; |
---|
588 | 565 | int status; |
---|
589 | 566 | struct o2hb_bio_wait_ctxt wc; |
---|
590 | 567 | struct bio *bio; |
---|
.. | .. |
---|
1093 | 1070 | return find_last_bit(nodes, numbits); |
---|
1094 | 1071 | } |
---|
1095 | 1072 | |
---|
| 1073 | +static int o2hb_lowest_node(unsigned long *nodes, int numbits) |
---|
| 1074 | +{ |
---|
| 1075 | + return find_first_bit(nodes, numbits); |
---|
| 1076 | +} |
---|
| 1077 | + |
---|
1096 | 1078 | static int o2hb_do_disk_heartbeat(struct o2hb_region *reg) |
---|
1097 | 1079 | { |
---|
1098 | | - int i, ret, highest_node; |
---|
| 1080 | + int i, ret, highest_node, lowest_node; |
---|
1099 | 1081 | int membership_change = 0, own_slot_ok = 0; |
---|
1100 | 1082 | unsigned long configured_nodes[BITS_TO_LONGS(O2NM_MAX_NODES)]; |
---|
1101 | 1083 | unsigned long live_node_bitmap[BITS_TO_LONGS(O2NM_MAX_NODES)]; |
---|
.. | .. |
---|
1120 | 1102 | } |
---|
1121 | 1103 | |
---|
1122 | 1104 | highest_node = o2hb_highest_node(configured_nodes, O2NM_MAX_NODES); |
---|
1123 | | - if (highest_node >= O2NM_MAX_NODES) { |
---|
| 1105 | + lowest_node = o2hb_lowest_node(configured_nodes, O2NM_MAX_NODES); |
---|
| 1106 | + if (highest_node >= O2NM_MAX_NODES || lowest_node >= O2NM_MAX_NODES) { |
---|
1124 | 1107 | mlog(ML_NOTICE, "o2hb: No configured nodes found!\n"); |
---|
1125 | 1108 | ret = -EINVAL; |
---|
1126 | 1109 | goto bail; |
---|
.. | .. |
---|
1130 | 1113 | * yet. Of course, if the node definitions have holes in them |
---|
1131 | 1114 | * then we're reading an empty slot anyway... Consider this |
---|
1132 | 1115 | * best-effort. */ |
---|
1133 | | - ret = o2hb_read_slots(reg, highest_node + 1); |
---|
| 1116 | + ret = o2hb_read_slots(reg, lowest_node, highest_node + 1); |
---|
1134 | 1117 | if (ret < 0) { |
---|
1135 | 1118 | mlog_errno(ret); |
---|
1136 | 1119 | goto bail; |
---|
.. | .. |
---|
1191 | 1174 | if (atomic_read(®->hr_steady_iterations) != 0) { |
---|
1192 | 1175 | if (atomic_dec_and_test(®->hr_unsteady_iterations)) { |
---|
1193 | 1176 | printk(KERN_NOTICE "o2hb: Unable to stabilize " |
---|
1194 | | - "heartbeart on region %s (%s)\n", |
---|
| 1177 | + "heartbeat on region %s (%s)\n", |
---|
1195 | 1178 | config_item_name(®->hr_item), |
---|
1196 | 1179 | reg->hr_dev_name); |
---|
1197 | 1180 | atomic_set(®->hr_steady_iterations, 0); |
---|
.. | .. |
---|
1324 | 1307 | |
---|
1325 | 1308 | case O2HB_DB_TYPE_REGION_NUMBER: |
---|
1326 | 1309 | reg = (struct o2hb_region *)db->db_data; |
---|
1327 | | - out += snprintf(buf + out, PAGE_SIZE - out, "%d\n", |
---|
| 1310 | + out += scnprintf(buf + out, PAGE_SIZE - out, "%d\n", |
---|
1328 | 1311 | reg->hr_region_num); |
---|
1329 | 1312 | goto done; |
---|
1330 | 1313 | |
---|
.. | .. |
---|
1334 | 1317 | /* If 0, it has never been set before */ |
---|
1335 | 1318 | if (lts) |
---|
1336 | 1319 | lts = jiffies_to_msecs(jiffies - lts); |
---|
1337 | | - out += snprintf(buf + out, PAGE_SIZE - out, "%lu\n", lts); |
---|
| 1320 | + out += scnprintf(buf + out, PAGE_SIZE - out, "%lu\n", lts); |
---|
1338 | 1321 | goto done; |
---|
1339 | 1322 | |
---|
1340 | 1323 | case O2HB_DB_TYPE_REGION_PINNED: |
---|
1341 | 1324 | reg = (struct o2hb_region *)db->db_data; |
---|
1342 | | - out += snprintf(buf + out, PAGE_SIZE - out, "%u\n", |
---|
| 1325 | + out += scnprintf(buf + out, PAGE_SIZE - out, "%u\n", |
---|
1343 | 1326 | !!reg->hr_item_pinned); |
---|
1344 | 1327 | goto done; |
---|
1345 | 1328 | |
---|
.. | .. |
---|
1348 | 1331 | } |
---|
1349 | 1332 | |
---|
1350 | 1333 | while ((i = find_next_bit(map, db->db_len, i + 1)) < db->db_len) |
---|
1351 | | - out += snprintf(buf + out, PAGE_SIZE - out, "%d ", i); |
---|
1352 | | - out += snprintf(buf + out, PAGE_SIZE - out, "\n"); |
---|
| 1334 | + out += scnprintf(buf + out, PAGE_SIZE - out, "%d ", i); |
---|
| 1335 | + out += scnprintf(buf + out, PAGE_SIZE - out, "\n"); |
---|
1353 | 1336 | |
---|
1354 | 1337 | done: |
---|
1355 | 1338 | i_size_write(inode, out); |
---|
.. | .. |
---|
1398 | 1381 | |
---|
1399 | 1382 | void o2hb_exit(void) |
---|
1400 | 1383 | { |
---|
1401 | | - debugfs_remove(o2hb_debug_failedregions); |
---|
1402 | | - debugfs_remove(o2hb_debug_quorumregions); |
---|
1403 | | - debugfs_remove(o2hb_debug_liveregions); |
---|
1404 | | - debugfs_remove(o2hb_debug_livenodes); |
---|
1405 | | - debugfs_remove(o2hb_debug_dir); |
---|
| 1384 | + debugfs_remove_recursive(o2hb_debug_dir); |
---|
1406 | 1385 | kfree(o2hb_db_livenodes); |
---|
1407 | 1386 | kfree(o2hb_db_liveregions); |
---|
1408 | 1387 | kfree(o2hb_db_quorumregions); |
---|
1409 | 1388 | kfree(o2hb_db_failedregions); |
---|
1410 | 1389 | } |
---|
1411 | 1390 | |
---|
1412 | | -static struct dentry *o2hb_debug_create(const char *name, struct dentry *dir, |
---|
1413 | | - struct o2hb_debug_buf **db, int db_len, |
---|
1414 | | - int type, int size, int len, void *data) |
---|
| 1391 | +static void o2hb_debug_create(const char *name, struct dentry *dir, |
---|
| 1392 | + struct o2hb_debug_buf **db, int db_len, int type, |
---|
| 1393 | + int size, int len, void *data) |
---|
1415 | 1394 | { |
---|
1416 | 1395 | *db = kmalloc(db_len, GFP_KERNEL); |
---|
1417 | 1396 | if (!*db) |
---|
1418 | | - return NULL; |
---|
| 1397 | + return; |
---|
1419 | 1398 | |
---|
1420 | 1399 | (*db)->db_type = type; |
---|
1421 | 1400 | (*db)->db_size = size; |
---|
1422 | 1401 | (*db)->db_len = len; |
---|
1423 | 1402 | (*db)->db_data = data; |
---|
1424 | 1403 | |
---|
1425 | | - return debugfs_create_file(name, S_IFREG|S_IRUSR, dir, *db, |
---|
1426 | | - &o2hb_debug_fops); |
---|
| 1404 | + debugfs_create_file(name, S_IFREG|S_IRUSR, dir, *db, &o2hb_debug_fops); |
---|
1427 | 1405 | } |
---|
1428 | 1406 | |
---|
1429 | | -static int o2hb_debug_init(void) |
---|
| 1407 | +static void o2hb_debug_init(void) |
---|
1430 | 1408 | { |
---|
1431 | | - int ret = -ENOMEM; |
---|
1432 | | - |
---|
1433 | 1409 | o2hb_debug_dir = debugfs_create_dir(O2HB_DEBUG_DIR, NULL); |
---|
1434 | | - if (!o2hb_debug_dir) { |
---|
1435 | | - mlog_errno(ret); |
---|
1436 | | - goto bail; |
---|
1437 | | - } |
---|
1438 | 1410 | |
---|
1439 | | - o2hb_debug_livenodes = o2hb_debug_create(O2HB_DEBUG_LIVENODES, |
---|
1440 | | - o2hb_debug_dir, |
---|
1441 | | - &o2hb_db_livenodes, |
---|
1442 | | - sizeof(*o2hb_db_livenodes), |
---|
1443 | | - O2HB_DB_TYPE_LIVENODES, |
---|
1444 | | - sizeof(o2hb_live_node_bitmap), |
---|
1445 | | - O2NM_MAX_NODES, |
---|
1446 | | - o2hb_live_node_bitmap); |
---|
1447 | | - if (!o2hb_debug_livenodes) { |
---|
1448 | | - mlog_errno(ret); |
---|
1449 | | - goto bail; |
---|
1450 | | - } |
---|
| 1411 | + o2hb_debug_create(O2HB_DEBUG_LIVENODES, o2hb_debug_dir, |
---|
| 1412 | + &o2hb_db_livenodes, sizeof(*o2hb_db_livenodes), |
---|
| 1413 | + O2HB_DB_TYPE_LIVENODES, sizeof(o2hb_live_node_bitmap), |
---|
| 1414 | + O2NM_MAX_NODES, o2hb_live_node_bitmap); |
---|
1451 | 1415 | |
---|
1452 | | - o2hb_debug_liveregions = o2hb_debug_create(O2HB_DEBUG_LIVEREGIONS, |
---|
1453 | | - o2hb_debug_dir, |
---|
1454 | | - &o2hb_db_liveregions, |
---|
1455 | | - sizeof(*o2hb_db_liveregions), |
---|
1456 | | - O2HB_DB_TYPE_LIVEREGIONS, |
---|
1457 | | - sizeof(o2hb_live_region_bitmap), |
---|
1458 | | - O2NM_MAX_REGIONS, |
---|
1459 | | - o2hb_live_region_bitmap); |
---|
1460 | | - if (!o2hb_debug_liveregions) { |
---|
1461 | | - mlog_errno(ret); |
---|
1462 | | - goto bail; |
---|
1463 | | - } |
---|
| 1416 | + o2hb_debug_create(O2HB_DEBUG_LIVEREGIONS, o2hb_debug_dir, |
---|
| 1417 | + &o2hb_db_liveregions, sizeof(*o2hb_db_liveregions), |
---|
| 1418 | + O2HB_DB_TYPE_LIVEREGIONS, |
---|
| 1419 | + sizeof(o2hb_live_region_bitmap), O2NM_MAX_REGIONS, |
---|
| 1420 | + o2hb_live_region_bitmap); |
---|
1464 | 1421 | |
---|
1465 | | - o2hb_debug_quorumregions = |
---|
1466 | | - o2hb_debug_create(O2HB_DEBUG_QUORUMREGIONS, |
---|
1467 | | - o2hb_debug_dir, |
---|
1468 | | - &o2hb_db_quorumregions, |
---|
1469 | | - sizeof(*o2hb_db_quorumregions), |
---|
1470 | | - O2HB_DB_TYPE_QUORUMREGIONS, |
---|
1471 | | - sizeof(o2hb_quorum_region_bitmap), |
---|
1472 | | - O2NM_MAX_REGIONS, |
---|
1473 | | - o2hb_quorum_region_bitmap); |
---|
1474 | | - if (!o2hb_debug_quorumregions) { |
---|
1475 | | - mlog_errno(ret); |
---|
1476 | | - goto bail; |
---|
1477 | | - } |
---|
| 1422 | + o2hb_debug_create(O2HB_DEBUG_QUORUMREGIONS, o2hb_debug_dir, |
---|
| 1423 | + &o2hb_db_quorumregions, |
---|
| 1424 | + sizeof(*o2hb_db_quorumregions), |
---|
| 1425 | + O2HB_DB_TYPE_QUORUMREGIONS, |
---|
| 1426 | + sizeof(o2hb_quorum_region_bitmap), O2NM_MAX_REGIONS, |
---|
| 1427 | + o2hb_quorum_region_bitmap); |
---|
1478 | 1428 | |
---|
1479 | | - o2hb_debug_failedregions = |
---|
1480 | | - o2hb_debug_create(O2HB_DEBUG_FAILEDREGIONS, |
---|
1481 | | - o2hb_debug_dir, |
---|
1482 | | - &o2hb_db_failedregions, |
---|
1483 | | - sizeof(*o2hb_db_failedregions), |
---|
1484 | | - O2HB_DB_TYPE_FAILEDREGIONS, |
---|
1485 | | - sizeof(o2hb_failed_region_bitmap), |
---|
1486 | | - O2NM_MAX_REGIONS, |
---|
1487 | | - o2hb_failed_region_bitmap); |
---|
1488 | | - if (!o2hb_debug_failedregions) { |
---|
1489 | | - mlog_errno(ret); |
---|
1490 | | - goto bail; |
---|
1491 | | - } |
---|
1492 | | - |
---|
1493 | | - ret = 0; |
---|
1494 | | -bail: |
---|
1495 | | - if (ret) |
---|
1496 | | - o2hb_exit(); |
---|
1497 | | - |
---|
1498 | | - return ret; |
---|
| 1429 | + o2hb_debug_create(O2HB_DEBUG_FAILEDREGIONS, o2hb_debug_dir, |
---|
| 1430 | + &o2hb_db_failedregions, |
---|
| 1431 | + sizeof(*o2hb_db_failedregions), |
---|
| 1432 | + O2HB_DB_TYPE_FAILEDREGIONS, |
---|
| 1433 | + sizeof(o2hb_failed_region_bitmap), O2NM_MAX_REGIONS, |
---|
| 1434 | + o2hb_failed_region_bitmap); |
---|
1499 | 1435 | } |
---|
1500 | 1436 | |
---|
1501 | | -int o2hb_init(void) |
---|
| 1437 | +void o2hb_init(void) |
---|
1502 | 1438 | { |
---|
1503 | 1439 | int i; |
---|
1504 | 1440 | |
---|
.. | .. |
---|
1518 | 1454 | |
---|
1519 | 1455 | o2hb_dependent_users = 0; |
---|
1520 | 1456 | |
---|
1521 | | - return o2hb_debug_init(); |
---|
| 1457 | + o2hb_debug_init(); |
---|
1522 | 1458 | } |
---|
1523 | 1459 | |
---|
1524 | 1460 | /* if we're already in a callback then we're already serialized by the sem */ |
---|
.. | .. |
---|
1582 | 1518 | |
---|
1583 | 1519 | kfree(reg->hr_slots); |
---|
1584 | 1520 | |
---|
1585 | | - debugfs_remove(reg->hr_debug_livenodes); |
---|
1586 | | - debugfs_remove(reg->hr_debug_regnum); |
---|
1587 | | - debugfs_remove(reg->hr_debug_elapsed_time); |
---|
1588 | | - debugfs_remove(reg->hr_debug_pinned); |
---|
1589 | | - debugfs_remove(reg->hr_debug_dir); |
---|
| 1521 | + debugfs_remove_recursive(reg->hr_debug_dir); |
---|
1590 | 1522 | kfree(reg->hr_db_livenodes); |
---|
1591 | 1523 | kfree(reg->hr_db_regnum); |
---|
1592 | 1524 | kfree(reg->hr_db_elapsed_time); |
---|
.. | .. |
---|
1801 | 1733 | struct o2hb_disk_slot *slot; |
---|
1802 | 1734 | struct o2hb_disk_heartbeat_block *hb_block; |
---|
1803 | 1735 | |
---|
1804 | | - ret = o2hb_read_slots(reg, reg->hr_blocks); |
---|
| 1736 | + ret = o2hb_read_slots(reg, 0, reg->hr_blocks); |
---|
1805 | 1737 | if (ret) |
---|
1806 | 1738 | goto out; |
---|
1807 | 1739 | |
---|
.. | .. |
---|
1834 | 1766 | int sectsize; |
---|
1835 | 1767 | char *p = (char *)page; |
---|
1836 | 1768 | struct fd f; |
---|
1837 | | - struct inode *inode; |
---|
1838 | 1769 | ssize_t ret = -EINVAL; |
---|
1839 | 1770 | int live_threshold; |
---|
1840 | 1771 | |
---|
.. | .. |
---|
1861 | 1792 | reg->hr_block_bytes == 0) |
---|
1862 | 1793 | goto out2; |
---|
1863 | 1794 | |
---|
1864 | | - inode = igrab(f.file->f_mapping->host); |
---|
1865 | | - if (inode == NULL) |
---|
| 1795 | + if (!S_ISBLK(f.file->f_mapping->host->i_mode)) |
---|
1866 | 1796 | goto out2; |
---|
1867 | 1797 | |
---|
1868 | | - if (!S_ISBLK(inode->i_mode)) |
---|
1869 | | - goto out3; |
---|
1870 | | - |
---|
1871 | | - reg->hr_bdev = I_BDEV(f.file->f_mapping->host); |
---|
1872 | | - ret = blkdev_get(reg->hr_bdev, FMODE_WRITE | FMODE_READ, NULL); |
---|
1873 | | - if (ret) { |
---|
| 1798 | + reg->hr_bdev = blkdev_get_by_dev(f.file->f_mapping->host->i_rdev, |
---|
| 1799 | + FMODE_WRITE | FMODE_READ, NULL); |
---|
| 1800 | + if (IS_ERR(reg->hr_bdev)) { |
---|
| 1801 | + ret = PTR_ERR(reg->hr_bdev); |
---|
1874 | 1802 | reg->hr_bdev = NULL; |
---|
1875 | | - goto out3; |
---|
| 1803 | + goto out2; |
---|
1876 | 1804 | } |
---|
1877 | | - inode = NULL; |
---|
1878 | 1805 | |
---|
1879 | 1806 | bdevname(reg->hr_bdev, reg->hr_dev_name); |
---|
1880 | 1807 | |
---|
.. | .. |
---|
1977 | 1904 | config_item_name(®->hr_item), reg->hr_dev_name); |
---|
1978 | 1905 | |
---|
1979 | 1906 | out3: |
---|
1980 | | - iput(inode); |
---|
| 1907 | + if (ret < 0) { |
---|
| 1908 | + blkdev_put(reg->hr_bdev, FMODE_READ | FMODE_WRITE); |
---|
| 1909 | + reg->hr_bdev = NULL; |
---|
| 1910 | + } |
---|
1981 | 1911 | out2: |
---|
1982 | 1912 | fdput(f); |
---|
1983 | 1913 | out: |
---|
1984 | | - if (ret < 0) { |
---|
1985 | | - if (reg->hr_bdev) { |
---|
1986 | | - blkdev_put(reg->hr_bdev, FMODE_READ|FMODE_WRITE); |
---|
1987 | | - reg->hr_bdev = NULL; |
---|
1988 | | - } |
---|
1989 | | - } |
---|
1990 | 1914 | return ret; |
---|
1991 | 1915 | } |
---|
1992 | 1916 | |
---|
.. | .. |
---|
2045 | 1969 | : NULL; |
---|
2046 | 1970 | } |
---|
2047 | 1971 | |
---|
2048 | | -static int o2hb_debug_region_init(struct o2hb_region *reg, struct dentry *dir) |
---|
| 1972 | +static void o2hb_debug_region_init(struct o2hb_region *reg, |
---|
| 1973 | + struct dentry *parent) |
---|
2049 | 1974 | { |
---|
2050 | | - int ret = -ENOMEM; |
---|
| 1975 | + struct dentry *dir; |
---|
2051 | 1976 | |
---|
2052 | | - reg->hr_debug_dir = |
---|
2053 | | - debugfs_create_dir(config_item_name(®->hr_item), dir); |
---|
2054 | | - if (!reg->hr_debug_dir) { |
---|
2055 | | - mlog_errno(ret); |
---|
2056 | | - goto bail; |
---|
2057 | | - } |
---|
| 1977 | + dir = debugfs_create_dir(config_item_name(®->hr_item), parent); |
---|
| 1978 | + reg->hr_debug_dir = dir; |
---|
2058 | 1979 | |
---|
2059 | | - reg->hr_debug_livenodes = |
---|
2060 | | - o2hb_debug_create(O2HB_DEBUG_LIVENODES, |
---|
2061 | | - reg->hr_debug_dir, |
---|
2062 | | - &(reg->hr_db_livenodes), |
---|
2063 | | - sizeof(*(reg->hr_db_livenodes)), |
---|
2064 | | - O2HB_DB_TYPE_REGION_LIVENODES, |
---|
2065 | | - sizeof(reg->hr_live_node_bitmap), |
---|
2066 | | - O2NM_MAX_NODES, reg); |
---|
2067 | | - if (!reg->hr_debug_livenodes) { |
---|
2068 | | - mlog_errno(ret); |
---|
2069 | | - goto bail; |
---|
2070 | | - } |
---|
| 1980 | + o2hb_debug_create(O2HB_DEBUG_LIVENODES, dir, &(reg->hr_db_livenodes), |
---|
| 1981 | + sizeof(*(reg->hr_db_livenodes)), |
---|
| 1982 | + O2HB_DB_TYPE_REGION_LIVENODES, |
---|
| 1983 | + sizeof(reg->hr_live_node_bitmap), O2NM_MAX_NODES, |
---|
| 1984 | + reg); |
---|
2071 | 1985 | |
---|
2072 | | - reg->hr_debug_regnum = |
---|
2073 | | - o2hb_debug_create(O2HB_DEBUG_REGION_NUMBER, |
---|
2074 | | - reg->hr_debug_dir, |
---|
2075 | | - &(reg->hr_db_regnum), |
---|
2076 | | - sizeof(*(reg->hr_db_regnum)), |
---|
2077 | | - O2HB_DB_TYPE_REGION_NUMBER, |
---|
2078 | | - 0, O2NM_MAX_NODES, reg); |
---|
2079 | | - if (!reg->hr_debug_regnum) { |
---|
2080 | | - mlog_errno(ret); |
---|
2081 | | - goto bail; |
---|
2082 | | - } |
---|
| 1986 | + o2hb_debug_create(O2HB_DEBUG_REGION_NUMBER, dir, &(reg->hr_db_regnum), |
---|
| 1987 | + sizeof(*(reg->hr_db_regnum)), |
---|
| 1988 | + O2HB_DB_TYPE_REGION_NUMBER, 0, O2NM_MAX_NODES, reg); |
---|
2083 | 1989 | |
---|
2084 | | - reg->hr_debug_elapsed_time = |
---|
2085 | | - o2hb_debug_create(O2HB_DEBUG_REGION_ELAPSED_TIME, |
---|
2086 | | - reg->hr_debug_dir, |
---|
2087 | | - &(reg->hr_db_elapsed_time), |
---|
2088 | | - sizeof(*(reg->hr_db_elapsed_time)), |
---|
2089 | | - O2HB_DB_TYPE_REGION_ELAPSED_TIME, |
---|
2090 | | - 0, 0, reg); |
---|
2091 | | - if (!reg->hr_debug_elapsed_time) { |
---|
2092 | | - mlog_errno(ret); |
---|
2093 | | - goto bail; |
---|
2094 | | - } |
---|
| 1990 | + o2hb_debug_create(O2HB_DEBUG_REGION_ELAPSED_TIME, dir, |
---|
| 1991 | + &(reg->hr_db_elapsed_time), |
---|
| 1992 | + sizeof(*(reg->hr_db_elapsed_time)), |
---|
| 1993 | + O2HB_DB_TYPE_REGION_ELAPSED_TIME, 0, 0, reg); |
---|
2095 | 1994 | |
---|
2096 | | - reg->hr_debug_pinned = |
---|
2097 | | - o2hb_debug_create(O2HB_DEBUG_REGION_PINNED, |
---|
2098 | | - reg->hr_debug_dir, |
---|
2099 | | - &(reg->hr_db_pinned), |
---|
2100 | | - sizeof(*(reg->hr_db_pinned)), |
---|
2101 | | - O2HB_DB_TYPE_REGION_PINNED, |
---|
2102 | | - 0, 0, reg); |
---|
2103 | | - if (!reg->hr_debug_pinned) { |
---|
2104 | | - mlog_errno(ret); |
---|
2105 | | - goto bail; |
---|
2106 | | - } |
---|
| 1995 | + o2hb_debug_create(O2HB_DEBUG_REGION_PINNED, dir, &(reg->hr_db_pinned), |
---|
| 1996 | + sizeof(*(reg->hr_db_pinned)), |
---|
| 1997 | + O2HB_DB_TYPE_REGION_PINNED, 0, 0, reg); |
---|
2107 | 1998 | |
---|
2108 | | - ret = 0; |
---|
2109 | | -bail: |
---|
2110 | | - return ret; |
---|
2111 | 1999 | } |
---|
2112 | 2000 | |
---|
2113 | 2001 | static struct config_item *o2hb_heartbeat_group_make_item(struct config_group *group, |
---|
.. | .. |
---|
2163 | 2051 | if (ret) |
---|
2164 | 2052 | goto unregister_handler; |
---|
2165 | 2053 | |
---|
2166 | | - ret = o2hb_debug_region_init(reg, o2hb_debug_dir); |
---|
2167 | | - if (ret) { |
---|
2168 | | - config_item_put(®->hr_item); |
---|
2169 | | - goto unregister_handler; |
---|
2170 | | - } |
---|
| 2054 | + o2hb_debug_region_init(reg, o2hb_debug_dir); |
---|
2171 | 2055 | |
---|
2172 | 2056 | return ®->hr_item; |
---|
2173 | 2057 | |
---|