Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 89544
b: refs/heads/master
c: fb86b1f
h: refs/heads/master
v: v3
  • Loading branch information
Joel Becker authored and Mark Fasheh committed Apr 18, 2008
1 parent a8a867f commit aebe961
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fc881fa0d59596c02f8707b5572567c369d4789a
refs/heads/master: fb86b1f07120b66769a39c445da5c4300069dd44
12 changes: 12 additions & 0 deletions trunk/fs/ocfs2/ocfs2_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,18 @@ struct ocfs2_extent_block
/* Actual on-disk size is one block */
};

/*
* On disk slot map for OCFS2. This defines the contents of the "slot_map"
* system file.
*/
struct ocfs2_slot_map {
/*00*/ __le16 sm_slots[0];
/*
* Actual on-disk size is one block. OCFS2_MAX_SLOTS is 255,
* 255 * sizeof(__le16) == 512B, within the 512B block minimum blocksize.
*/
};

/*
* On disk superblock for OCFS2
* Note that it is contained inside an ocfs2_dinode, so all offsets
Expand Down
15 changes: 8 additions & 7 deletions trunk/fs/ocfs2/slot_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,17 @@ static void ocfs2_set_slot(struct ocfs2_slot_info *si,
static void ocfs2_update_slot_info(struct ocfs2_slot_info *si)
{
int i;
__le16 *disk_info;
struct ocfs2_slot_map *sm;

/* we don't read the slot block here as ocfs2_super_lock
* should've made sure we have the most recent copy. */
disk_info = (__le16 *) si->si_bh[0]->b_data;
sm = (struct ocfs2_slot_map *)si->si_bh[0]->b_data;

for (i = 0; i < si->si_num_slots; i++) {
if (le16_to_cpu(disk_info[i]) == (u16)OCFS2_INVALID_SLOT)
if (le16_to_cpu(sm->sm_slots[i]) == (u16)OCFS2_INVALID_SLOT)
ocfs2_invalidate_slot(si, i);
else
ocfs2_set_slot(si, i, le16_to_cpu(disk_info[i]));
ocfs2_set_slot(si, i, le16_to_cpu(sm->sm_slots[i]));
}
}

Expand Down Expand Up @@ -135,15 +135,16 @@ static int ocfs2_update_disk_slots(struct ocfs2_super *osb,
struct ocfs2_slot_info *si)
{
int status, i;
__le16 *disk_info = (__le16 *) si->si_bh[0]->b_data;
struct ocfs2_slot_map *sm;

spin_lock(&osb->osb_lock);
sm = (struct ocfs2_slot_map *)si->si_bh[0]->b_data;
for (i = 0; i < si->si_num_slots; i++) {
if (si->si_slots[i].sl_valid)
disk_info[i] =
sm->sm_slots[i] =
cpu_to_le16(si->si_slots[i].sl_node_num);
else
disk_info[i] = cpu_to_le16(OCFS2_INVALID_SLOT);
sm->sm_slots[i] = cpu_to_le16(OCFS2_INVALID_SLOT);
}
spin_unlock(&osb->osb_lock);

Expand Down

0 comments on commit aebe961

Please sign in to comment.