Lines Matching refs:alloc

20 #include "alloc.h"
35 static u32 ocfs2_local_alloc_count_bits(struct ocfs2_dinode *alloc);
38 struct ocfs2_dinode *alloc,
42 static void ocfs2_clear_local_alloc(struct ocfs2_dinode *alloc);
46 struct ocfs2_dinode *alloc,
64 * the local alloc.
66 * Generally, we'd like to pick as large a local alloc as
72 * Some things work against us when trying to choose a large local alloc:
87 * alloc maximums at various cluster sizes (4k blocksize)
142 * local alloc size down to 256 however, would give us
236 * Tell us whether a given allocation should use the local alloc
239 * This function does semi-dirty reads of local alloc size and state!
255 * allocations go through the local alloc, so allow an
271 struct ocfs2_dinode *alloc = NULL;
281 mlog(ML_NOTICE, "Requested local alloc window %d is larger "
289 /* read the alloc off disk */
305 alloc = (struct ocfs2_dinode *) alloc_bh->b_data;
306 la = OCFS2_LOCAL_ALLOC(alloc);
308 if (!(le32_to_cpu(alloc->i_flags) &
310 mlog(ML_ERROR, "Invalid local alloc inode, %llu\n",
318 mlog(ML_ERROR, "Local alloc size is invalid (la_size = %u)\n",
325 num_used = ocfs2_local_alloc_count_bits(alloc);
327 /* hopefully the local alloc has always been recovered before
330 || alloc->id1.bitmap1.i_used
331 || alloc->id1.bitmap1.i_total
334 " unrecovered local alloc, please run fsck.ocfs2!\n"
336 num_used, le32_to_cpu(alloc->id1.bitmap1.i_used),
337 le32_to_cpu(alloc->id1.bitmap1.i_total),
338 OCFS2_LOCAL_ALLOC(alloc)->la_bm_off);
375 struct ocfs2_dinode *alloc = NULL;
424 alloc = (struct ocfs2_dinode *) bh->b_data;
426 alloc_copy = kmemdup(alloc, bh->b_size, GFP_NOFS);
439 ocfs2_clear_local_alloc(alloc);
472 * alloc before giving up the recovered nodes journal. To solve this,
473 * we kmalloc a copy of the local alloc before it's change for the
483 struct ocfs2_dinode *alloc;
514 alloc = (struct ocfs2_dinode *) alloc_bh->b_data;
515 ocfs2_clear_local_alloc(alloc);
517 ocfs2_compute_meta_ecc(osb->sb, alloc_bh->b_data, &alloc->i_check);
542 * a clean local alloc on disk and dropped the node out of the
547 struct ocfs2_dinode *alloc)
582 status = ocfs2_sync_local_to_main(osb, handle, alloc,
609 * local alloc. You lose them when you drop i_rwsem.
619 struct ocfs2_dinode *alloc;
650 alloc = (struct ocfs2_dinode *) osb->local_alloc_bh->b_data;
653 if (le32_to_cpu(alloc->id1.bitmap1.i_used) !=
654 ocfs2_local_alloc_count_bits(alloc)) {
655 status = ocfs2_error(osb->sb, "local alloc inode %llu says it has %u used bits, but a count shows %u\n",
656 (unsigned long long)le64_to_cpu(alloc->i_blkno),
657 le32_to_cpu(alloc->id1.bitmap1.i_used),
658 ocfs2_local_alloc_count_bits(alloc));
663 free_bits = le32_to_cpu(alloc->id1.bitmap1.i_total) -
664 le32_to_cpu(alloc->id1.bitmap1.i_used);
678 * disabled the local alloc entirely. Re-check
685 free_bits = le32_to_cpu(alloc->id1.bitmap1.i_total) -
686 le32_to_cpu(alloc->id1.bitmap1.i_used);
723 struct ocfs2_dinode *alloc;
729 alloc = (struct ocfs2_dinode *) osb->local_alloc_bh->b_data;
730 la = OCFS2_LOCAL_ALLOC(alloc);
732 start = ocfs2_local_alloc_find_clear_bits(osb, alloc, &bits_wanted,
760 le32_add_cpu(&alloc->id1.bitmap1.i_used, *num_bits);
779 struct ocfs2_dinode *alloc;
785 alloc = (struct ocfs2_dinode *) osb->local_alloc_bh->b_data;
786 la = OCFS2_LOCAL_ALLOC(alloc);
804 le32_add_cpu(&alloc->id1.bitmap1.i_used, -num_bits);
811 static u32 ocfs2_local_alloc_count_bits(struct ocfs2_dinode *alloc)
814 struct ocfs2_local_alloc *la = OCFS2_LOCAL_ALLOC(alloc);
823 struct ocfs2_dinode *alloc,
833 if (!alloc->id1.bitmap1.i_total) {
862 bitmap = OCFS2_LOCAL_ALLOC(alloc)->la_bitmap;
865 left = le32_to_cpu(alloc->id1.bitmap1.i_total);
904 le32_to_cpu(alloc->id1.bitmap1.i_total),
910 static void ocfs2_clear_local_alloc(struct ocfs2_dinode *alloc)
912 struct ocfs2_local_alloc *la = OCFS2_LOCAL_ALLOC(alloc);
915 alloc->id1.bitmap1.i_total = 0;
916 alloc->id1.bitmap1.i_used = 0;
942 * sync the local alloc to main bitmap.
949 struct ocfs2_dinode *alloc,
958 struct ocfs2_local_alloc *la = OCFS2_LOCAL_ALLOC(alloc);
961 le32_to_cpu(alloc->id1.bitmap1.i_total),
962 le32_to_cpu(alloc->id1.bitmap1.i_used));
964 if (!alloc->id1.bitmap1.i_total) {
968 if (le32_to_cpu(alloc->id1.bitmap1.i_used) ==
969 le32_to_cpu(alloc->id1.bitmap1.i_total)) {
977 left = le32_to_cpu(alloc->id1.bitmap1.i_total);
1030 * Given an event, calculate the size of our next local alloc window.
1032 * This should always be called under i_rwsem of the local alloc inode
1033 * so that local alloc disabling doesn't race with processes trying to
1036 * Returns the state which the local alloc was left in. This value can
1059 * by local alloc until we have to disable it.
1065 * the number of local alloc bits used down
1081 * Don't increase the size of the local alloc window until we
1152 struct ocfs2_dinode *alloc = NULL;
1155 alloc = (struct ocfs2_dinode *) osb->local_alloc_bh->b_data;
1156 la = OCFS2_LOCAL_ALLOC(alloc);
1159 le32_to_cpu(alloc->id1.bitmap1.i_total),
1210 alloc->id1.bitmap1.i_total = cpu_to_le32(cluster_count);
1215 alloc->id1.bitmap1.i_used = 0;
1216 memset(OCFS2_LOCAL_ALLOC(alloc)->la_bitmap, 0,
1220 OCFS2_LOCAL_ALLOC(alloc)->la_bitmap);
1223 OCFS2_LOCAL_ALLOC(alloc)->la_bm_off,
1224 le32_to_cpu(alloc->id1.bitmap1.i_total));
1232 /* Note that we do *NOT* lock the local alloc inode here as
1241 struct ocfs2_dinode *alloc;
1266 alloc = (struct ocfs2_dinode *) osb->local_alloc_bh->b_data;
1268 /* We want to clear the local alloc before doing anything
1270 * local alloc shutdown won't try to double free main bitmap
1273 alloc_copy = kmemdup(alloc, osb->local_alloc_bh->b_size, GFP_NOFS);
1289 ocfs2_clear_local_alloc(alloc);