Lines Matching refs:alloc
22 #include "alloc.h"
37 static u32 ocfs2_local_alloc_count_bits(struct ocfs2_dinode *alloc);
40 struct ocfs2_dinode *alloc,
44 static void ocfs2_clear_local_alloc(struct ocfs2_dinode *alloc);
48 struct ocfs2_dinode *alloc,
66 * the local alloc.
68 * Generally, we'd like to pick as large a local alloc as
74 * Some things work against us when trying to choose a large local alloc:
89 * alloc maximums at various cluster sizes (4k blocksize)
144 * local alloc size down to 256 however, would give us
238 * Tell us whether a given allocation should use the local alloc
241 * This function does semi-dirty reads of local alloc size and state!
257 * allocations go through the local alloc, so allow an
273 struct ocfs2_dinode *alloc = NULL;
283 mlog(ML_NOTICE, "Requested local alloc window %d is larger "
291 /* read the alloc off disk */
307 alloc = (struct ocfs2_dinode *) alloc_bh->b_data;
308 la = OCFS2_LOCAL_ALLOC(alloc);
310 if (!(le32_to_cpu(alloc->i_flags) &
312 mlog(ML_ERROR, "Invalid local alloc inode, %llu\n",
320 mlog(ML_ERROR, "Local alloc size is invalid (la_size = %u)\n",
327 num_used = ocfs2_local_alloc_count_bits(alloc);
329 /* hopefully the local alloc has always been recovered before
332 || alloc->id1.bitmap1.i_used
333 || alloc->id1.bitmap1.i_total
336 " unrecovered local alloc, please run fsck.ocfs2!\n"
338 num_used, le32_to_cpu(alloc->id1.bitmap1.i_used),
339 le32_to_cpu(alloc->id1.bitmap1.i_total),
340 OCFS2_LOCAL_ALLOC(alloc)->la_bm_off);
377 struct ocfs2_dinode *alloc = NULL;
426 alloc = (struct ocfs2_dinode *) bh->b_data;
428 alloc_copy = kmemdup(alloc, bh->b_size, GFP_NOFS);
441 ocfs2_clear_local_alloc(alloc);
474 * alloc before giving up the recovered nodes journal. To solve this,
475 * we kmalloc a copy of the local alloc before it's change for the
485 struct ocfs2_dinode *alloc;
516 alloc = (struct ocfs2_dinode *) alloc_bh->b_data;
517 ocfs2_clear_local_alloc(alloc);
519 ocfs2_compute_meta_ecc(osb->sb, alloc_bh->b_data, &alloc->i_check);
544 * a clean local alloc on disk and dropped the node out of the
549 struct ocfs2_dinode *alloc)
584 status = ocfs2_sync_local_to_main(osb, handle, alloc,
611 * local alloc. You lose them when you drop i_mutex.
621 struct ocfs2_dinode *alloc;
652 alloc = (struct ocfs2_dinode *) osb->local_alloc_bh->b_data;
655 if (le32_to_cpu(alloc->id1.bitmap1.i_used) !=
656 ocfs2_local_alloc_count_bits(alloc)) {
657 status = ocfs2_error(osb->sb, "local alloc inode %llu says it has %u used bits, but a count shows %u\n",
658 (unsigned long long)le64_to_cpu(alloc->i_blkno),
659 le32_to_cpu(alloc->id1.bitmap1.i_used),
660 ocfs2_local_alloc_count_bits(alloc));
665 free_bits = le32_to_cpu(alloc->id1.bitmap1.i_total) -
666 le32_to_cpu(alloc->id1.bitmap1.i_used);
680 * disabled the local alloc entirely. Re-check
687 free_bits = le32_to_cpu(alloc->id1.bitmap1.i_total) -
688 le32_to_cpu(alloc->id1.bitmap1.i_used);
725 struct ocfs2_dinode *alloc;
731 alloc = (struct ocfs2_dinode *) osb->local_alloc_bh->b_data;
732 la = OCFS2_LOCAL_ALLOC(alloc);
734 start = ocfs2_local_alloc_find_clear_bits(osb, alloc, &bits_wanted,
762 le32_add_cpu(&alloc->id1.bitmap1.i_used, *num_bits);
781 struct ocfs2_dinode *alloc;
787 alloc = (struct ocfs2_dinode *) osb->local_alloc_bh->b_data;
788 la = OCFS2_LOCAL_ALLOC(alloc);
806 le32_add_cpu(&alloc->id1.bitmap1.i_used, -num_bits);
813 static u32 ocfs2_local_alloc_count_bits(struct ocfs2_dinode *alloc)
816 struct ocfs2_local_alloc *la = OCFS2_LOCAL_ALLOC(alloc);
825 struct ocfs2_dinode *alloc,
835 if (!alloc->id1.bitmap1.i_total) {
864 bitmap = OCFS2_LOCAL_ALLOC(alloc)->la_bitmap;
867 left = le32_to_cpu(alloc->id1.bitmap1.i_total);
906 le32_to_cpu(alloc->id1.bitmap1.i_total),
912 static void ocfs2_clear_local_alloc(struct ocfs2_dinode *alloc)
914 struct ocfs2_local_alloc *la = OCFS2_LOCAL_ALLOC(alloc);
917 alloc->id1.bitmap1.i_total = 0;
918 alloc->id1.bitmap1.i_used = 0;
944 * sync the local alloc to main bitmap.
951 struct ocfs2_dinode *alloc,
960 struct ocfs2_local_alloc *la = OCFS2_LOCAL_ALLOC(alloc);
963 le32_to_cpu(alloc->id1.bitmap1.i_total),
964 le32_to_cpu(alloc->id1.bitmap1.i_used));
966 if (!alloc->id1.bitmap1.i_total) {
970 if (le32_to_cpu(alloc->id1.bitmap1.i_used) ==
971 le32_to_cpu(alloc->id1.bitmap1.i_total)) {
979 left = le32_to_cpu(alloc->id1.bitmap1.i_total);
1032 * Given an event, calculate the size of our next local alloc window.
1034 * This should always be called under i_mutex of the local alloc inode
1035 * so that local alloc disabling doesn't race with processes trying to
1038 * Returns the state which the local alloc was left in. This value can
1061 * by local alloc until we have to disable it.
1067 * the number of local alloc bits used down
1083 * Don't increase the size of the local alloc window until we
1154 struct ocfs2_dinode *alloc = NULL;
1157 alloc = (struct ocfs2_dinode *) osb->local_alloc_bh->b_data;
1158 la = OCFS2_LOCAL_ALLOC(alloc);
1161 le32_to_cpu(alloc->id1.bitmap1.i_total),
1212 alloc->id1.bitmap1.i_total = cpu_to_le32(cluster_count);
1217 alloc->id1.bitmap1.i_used = 0;
1218 memset(OCFS2_LOCAL_ALLOC(alloc)->la_bitmap, 0,
1222 OCFS2_LOCAL_ALLOC(alloc)->la_bitmap);
1225 OCFS2_LOCAL_ALLOC(alloc)->la_bm_off,
1226 le32_to_cpu(alloc->id1.bitmap1.i_total));
1234 /* Note that we do *NOT* lock the local alloc inode here as
1243 struct ocfs2_dinode *alloc;
1268 alloc = (struct ocfs2_dinode *) osb->local_alloc_bh->b_data;
1270 /* We want to clear the local alloc before doing anything
1272 * local alloc shutdown won't try to double free main bitmap
1275 alloc_copy = kmemdup(alloc, osb->local_alloc_bh->b_size, GFP_NOFS);
1291 ocfs2_clear_local_alloc(alloc);