~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/fs/ocfs2/heartbeat.c

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0-or-later
  2 /*
  3  * heartbeat.c
  4  *
  5  * Register ourselves with the heartbeat service, keep our node maps
  6  * up to date, and fire off recovery when needed.
  7  *
  8  * Copyright (C) 2002, 2004 Oracle.  All rights reserved.
  9  */
 10 
 11 #include <linux/bitmap.h>
 12 #include <linux/fs.h>
 13 #include <linux/types.h>
 14 #include <linux/highmem.h>
 15 
 16 #include <cluster/masklog.h>
 17 
 18 #include "ocfs2.h"
 19 
 20 #include "alloc.h"
 21 #include "heartbeat.h"
 22 #include "inode.h"
 23 #include "journal.h"
 24 #include "ocfs2_trace.h"
 25 
 26 #include "buffer_head_io.h"
 27 
 28 /* special case -1 for now
 29  * TODO: should *really* make sure the calling func never passes -1!!  */
 30 static void ocfs2_node_map_init(struct ocfs2_node_map *map)
 31 {
 32         map->num_nodes = OCFS2_NODE_MAP_MAX_NODES;
 33         bitmap_zero(map->map, OCFS2_NODE_MAP_MAX_NODES);
 34 }
 35 
 36 void ocfs2_init_node_maps(struct ocfs2_super *osb)
 37 {
 38         spin_lock_init(&osb->node_map_lock);
 39         ocfs2_node_map_init(&osb->osb_recovering_orphan_dirs);
 40 }
 41 
 42 void ocfs2_do_node_down(int node_num, void *data)
 43 {
 44         struct ocfs2_super *osb = data;
 45 
 46         BUG_ON(osb->node_num == node_num);
 47 
 48         trace_ocfs2_do_node_down(node_num);
 49 
 50         if (!osb->cconn) {
 51                 /*
 52                  * No cluster connection means we're not even ready to
 53                  * participate yet.  We check the slots after the cluster
 54                  * comes up, so we will notice the node death then.  We
 55                  * can safely ignore it here.
 56                  */
 57                 return;
 58         }
 59 
 60         ocfs2_recovery_thread(osb, node_num);
 61 }
 62 
 63 void ocfs2_node_map_set_bit(struct ocfs2_super *osb,
 64                             struct ocfs2_node_map *map,
 65                             int bit)
 66 {
 67         if (bit==-1)
 68                 return;
 69         BUG_ON(bit >= map->num_nodes);
 70         spin_lock(&osb->node_map_lock);
 71         set_bit(bit, map->map);
 72         spin_unlock(&osb->node_map_lock);
 73 }
 74 
 75 void ocfs2_node_map_clear_bit(struct ocfs2_super *osb,
 76                               struct ocfs2_node_map *map,
 77                               int bit)
 78 {
 79         if (bit==-1)
 80                 return;
 81         BUG_ON(bit >= map->num_nodes);
 82         spin_lock(&osb->node_map_lock);
 83         clear_bit(bit, map->map);
 84         spin_unlock(&osb->node_map_lock);
 85 }
 86 
 87 int ocfs2_node_map_test_bit(struct ocfs2_super *osb,
 88                             struct ocfs2_node_map *map,
 89                             int bit)
 90 {
 91         int ret;
 92         if (bit >= map->num_nodes) {
 93                 mlog(ML_ERROR, "bit=%d map->num_nodes=%d\n", bit, map->num_nodes);
 94                 BUG();
 95         }
 96         spin_lock(&osb->node_map_lock);
 97         ret = test_bit(bit, map->map);
 98         spin_unlock(&osb->node_map_lock);
 99         return ret;
100 }
101 
102 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php