]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/ocfs2/slot_map.c
ocfs2: Readpages support
[linux-2.6-omap-h63xx.git] / fs / ocfs2 / slot_map.c
index d8b79067dc14778a5d67556c20c62fec9a5e4de7..3a50ce555e641f339c72b820a52eae07b047343b 100644 (file)
@@ -48,25 +48,6 @@ static void __ocfs2_fill_slot(struct ocfs2_slot_info *si,
                              s16 slot_num,
                              s16 node_num);
 
-/* Use the slot information we've collected to create a map of mounted
- * nodes. Should be holding an EX on super block. assumes slot info is
- * up to date. Note that we call this *after* we find a slot, so our
- * own node should be set in the map too... */
-void ocfs2_populate_mounted_map(struct ocfs2_super *osb)
-{
-       int i;
-       struct ocfs2_slot_info *si = osb->slot_info;
-
-       spin_lock(&si->si_lock);
-
-       for (i = 0; i < si->si_size; i++)
-               if (si->si_global_node_nums[i] != OCFS2_INVALID_SLOT)
-                       ocfs2_node_map_set_bit(osb, &osb->mounted_map,
-                                             si->si_global_node_nums[i]);
-
-       spin_unlock(&si->si_lock);
-}
-
 /* post the slot information on disk into our slot_info struct. */
 void ocfs2_update_slot_info(struct ocfs2_slot_info *si)
 {
@@ -121,17 +102,25 @@ static s16 __ocfs2_node_num_to_slot(struct ocfs2_slot_info *si,
        return ret;
 }
 
-static s16 __ocfs2_find_empty_slot(struct ocfs2_slot_info *si)
+static s16 __ocfs2_find_empty_slot(struct ocfs2_slot_info *si, s16 preferred)
 {
        int i;
        s16 ret = OCFS2_INVALID_SLOT;
 
+       if (preferred >= 0 && preferred < si->si_num_slots) {
+               if (OCFS2_INVALID_SLOT == si->si_global_node_nums[preferred]) {
+                       ret = preferred;
+                       goto out;
+               }
+       }
+
        for(i = 0; i < si->si_num_slots; i++) {
                if (OCFS2_INVALID_SLOT == si->si_global_node_nums[i]) {
                        ret = (s16) i;
                        break;
                }
        }
+out:
        return ret;
 }
 
@@ -248,7 +237,7 @@ int ocfs2_find_slot(struct ocfs2_super *osb)
        if (slot == OCFS2_INVALID_SLOT) {
                /* if no slot yet, then just take 1st available
                 * one. */
-               slot = __ocfs2_find_empty_slot(si);
+               slot = __ocfs2_find_empty_slot(si, osb->preferred_slot);
                if (slot == OCFS2_INVALID_SLOT) {
                        spin_unlock(&si->si_lock);
                        mlog(ML_ERROR, "no free slots available!\n");