aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2
diff options
context:
space:
mode:
authorJoel Becker <joel.becker@oracle.com>2008-02-01 14:59:05 -0500
committerMark Fasheh <mfasheh@suse.com>2008-04-18 11:56:03 -0400
commitfb86b1f07120b66769a39c445da5c4300069dd44 (patch)
tree4d97d78e2c703b289801a91e3a480fa1620914a8 /fs/ocfs2
parentfc881fa0d59596c02f8707b5572567c369d4789a (diff)
ocfs2: Define the contents of the slot_map file.
The slot map file is merely an array of __le16. Wrap it in a structure for cleaner reference. Signed-off-by: Joel Becker <joel.becker@oracle.com> Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs/ocfs2')
-rw-r--r--fs/ocfs2/ocfs2_fs.h12
-rw-r--r--fs/ocfs2/slot_map.c15
2 files changed, 20 insertions, 7 deletions
diff --git a/fs/ocfs2/ocfs2_fs.h b/fs/ocfs2/ocfs2_fs.h
index 3633edd3982f..3299116b8021 100644
--- a/fs/ocfs2/ocfs2_fs.h
+++ b/fs/ocfs2/ocfs2_fs.h
@@ -475,6 +475,18 @@ struct ocfs2_extent_block
475}; 475};
476 476
477/* 477/*
478 * On disk slot map for OCFS2. This defines the contents of the "slot_map"
479 * system file.
480 */
481struct ocfs2_slot_map {
482/*00*/ __le16 sm_slots[0];
483/*
484 * Actual on-disk size is one block. OCFS2_MAX_SLOTS is 255,
485 * 255 * sizeof(__le16) == 512B, within the 512B block minimum blocksize.
486 */
487};
488
489/*
478 * On disk superblock for OCFS2 490 * On disk superblock for OCFS2
479 * Note that it is contained inside an ocfs2_dinode, so all offsets 491 * Note that it is contained inside an ocfs2_dinode, so all offsets
480 * are relative to the start of ocfs2_dinode.id2. 492 * are relative to the start of ocfs2_dinode.id2.
diff --git a/fs/ocfs2/slot_map.c b/fs/ocfs2/slot_map.c
index 65a61bfa3f2e..e7e7a74156b1 100644
--- a/fs/ocfs2/slot_map.c
+++ b/fs/ocfs2/slot_map.c
@@ -85,17 +85,17 @@ static void ocfs2_set_slot(struct ocfs2_slot_info *si,
85static void ocfs2_update_slot_info(struct ocfs2_slot_info *si) 85static void ocfs2_update_slot_info(struct ocfs2_slot_info *si)
86{ 86{
87 int i; 87 int i;
88 __le16 *disk_info; 88 struct ocfs2_slot_map *sm;
89 89
90 /* we don't read the slot block here as ocfs2_super_lock 90 /* we don't read the slot block here as ocfs2_super_lock
91 * should've made sure we have the most recent copy. */ 91 * should've made sure we have the most recent copy. */
92 disk_info = (__le16 *) si->si_bh[0]->b_data; 92 sm = (struct ocfs2_slot_map *)si->si_bh[0]->b_data;
93 93
94 for (i = 0; i < si->si_num_slots; i++) { 94 for (i = 0; i < si->si_num_slots; i++) {
95 if (le16_to_cpu(disk_info[i]) == (u16)OCFS2_INVALID_SLOT) 95 if (le16_to_cpu(sm->sm_slots[i]) == (u16)OCFS2_INVALID_SLOT)
96 ocfs2_invalidate_slot(si, i); 96 ocfs2_invalidate_slot(si, i);
97 else 97 else
98 ocfs2_set_slot(si, i, le16_to_cpu(disk_info[i])); 98 ocfs2_set_slot(si, i, le16_to_cpu(sm->sm_slots[i]));
99 } 99 }
100} 100}
101 101
@@ -135,15 +135,16 @@ static int ocfs2_update_disk_slots(struct ocfs2_super *osb,
135 struct ocfs2_slot_info *si) 135 struct ocfs2_slot_info *si)
136{ 136{
137 int status, i; 137 int status, i;
138 __le16 *disk_info = (__le16 *) si->si_bh[0]->b_data; 138 struct ocfs2_slot_map *sm;
139 139
140 spin_lock(&osb->osb_lock); 140 spin_lock(&osb->osb_lock);
141 sm = (struct ocfs2_slot_map *)si->si_bh[0]->b_data;
141 for (i = 0; i < si->si_num_slots; i++) { 142 for (i = 0; i < si->si_num_slots; i++) {
142 if (si->si_slots[i].sl_valid) 143 if (si->si_slots[i].sl_valid)
143 disk_info[i] = 144 sm->sm_slots[i] =
144 cpu_to_le16(si->si_slots[i].sl_node_num); 145 cpu_to_le16(si->si_slots[i].sl_node_num);
145 else 146 else
146 disk_info[i] = cpu_to_le16(OCFS2_INVALID_SLOT); 147 sm->sm_slots[i] = cpu_to_le16(OCFS2_INVALID_SLOT);
147 } 148 }
148 spin_unlock(&osb->osb_lock); 149 spin_unlock(&osb->osb_lock);
149 150