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
237 * Tell us whether a given allocation should use the local alloc
240 * This function does semi-dirty reads of local alloc size and state!
256 * allocations go through the local alloc, so allow an
272 struct ocfs2_dinode *alloc = NULL;
282 mlog(ML_NOTICE, "Requested local alloc window %d is larger "
290 /* read the alloc off disk */
306 alloc = (struct ocfs2_dinode *) alloc_bh->b_data;
307 la = OCFS2_LOCAL_ALLOC(alloc);
309 if (!(le32_to_cpu(alloc->i_flags) &
311 mlog(ML_ERROR, "Invalid local alloc inode, %llu\n",
319 mlog(ML_ERROR, "Local alloc size is invalid (la_size = %u)\n",
326 num_used = ocfs2_local_alloc_count_bits(alloc);
328 /* hopefully the local alloc has always been recovered before
331 || alloc->id1.bitmap1.i_used
332 || alloc->id1.bitmap1.i_total
335 " unrecovered local alloc, please run fsck.ocfs2!\n"
337 num_used, le32_to_cpu(alloc->id1.bitmap1.i_used),
338 le32_to_cpu(alloc->id1.bitmap1.i_total),
339 le32_to_cpu(OCFS2_LOCAL_ALLOC(alloc)->la_bm_off));
376 struct ocfs2_dinode *alloc = NULL;
425 alloc = (struct ocfs2_dinode *) bh->b_data;
427 alloc_copy = kmemdup(alloc, bh->b_size, GFP_NOFS);
440 ocfs2_clear_local_alloc(alloc);
473 * alloc before giving up the recovered nodes journal. To solve this,
474 * we kmalloc a copy of the local alloc before it's change for the
484 struct ocfs2_dinode *alloc;
515 alloc = (struct ocfs2_dinode *) alloc_bh->b_data;
516 ocfs2_clear_local_alloc(alloc);
518 ocfs2_compute_meta_ecc(osb->sb, alloc_bh->b_data, &alloc->i_check);
543 * a clean local alloc on disk and dropped the node out of the
548 struct ocfs2_dinode *alloc)
583 status = ocfs2_sync_local_to_main(osb, handle, alloc,
610 * local alloc. You lose them when you drop i_rwsem.
620 struct ocfs2_dinode *alloc;
651 alloc = (struct ocfs2_dinode *) osb->local_alloc_bh->b_data;
654 if (le32_to_cpu(alloc->id1.bitmap1.i_used) !=
655 ocfs2_local_alloc_count_bits(alloc)) {
656 status = ocfs2_error(osb->sb, "local alloc inode %llu says it has %u used bits, but a count shows %u\n",
657 (unsigned long long)le64_to_cpu(alloc->i_blkno),
658 le32_to_cpu(alloc->id1.bitmap1.i_used),
659 ocfs2_local_alloc_count_bits(alloc));
664 free_bits = le32_to_cpu(alloc->id1.bitmap1.i_total) -
665 le32_to_cpu(alloc->id1.bitmap1.i_used);
679 * disabled the local alloc entirely. Re-check
686 free_bits = le32_to_cpu(alloc->id1.bitmap1.i_total) -
687 le32_to_cpu(alloc->id1.bitmap1.i_used);
724 struct ocfs2_dinode *alloc;
730 alloc = (struct ocfs2_dinode *) osb->local_alloc_bh->b_data;
731 la = OCFS2_LOCAL_ALLOC(alloc);
733 start = ocfs2_local_alloc_find_clear_bits(osb, alloc, &bits_wanted,
761 le32_add_cpu(&alloc->id1.bitmap1.i_used, *num_bits);
780 struct ocfs2_dinode *alloc;
786 alloc = (struct ocfs2_dinode *) osb->local_alloc_bh->b_data;
787 la = OCFS2_LOCAL_ALLOC(alloc);
805 le32_add_cpu(&alloc->id1.bitmap1.i_used, -num_bits);
812 static u32 ocfs2_local_alloc_count_bits(struct ocfs2_dinode *alloc)
815 struct ocfs2_local_alloc *la = OCFS2_LOCAL_ALLOC(alloc);
824 struct ocfs2_dinode *alloc,
834 if (!alloc->id1.bitmap1.i_total) {
863 bitmap = OCFS2_LOCAL_ALLOC(alloc)->la_bitmap;
866 left = le32_to_cpu(alloc->id1.bitmap1.i_total);
899 le32_to_cpu(alloc->id1.bitmap1.i_total),
905 static void ocfs2_clear_local_alloc(struct ocfs2_dinode *alloc)
907 struct ocfs2_local_alloc *la = OCFS2_LOCAL_ALLOC(alloc);
910 alloc->id1.bitmap1.i_total = 0;
911 alloc->id1.bitmap1.i_used = 0;
937 * sync the local alloc to main bitmap.
944 struct ocfs2_dinode *alloc,
953 struct ocfs2_local_alloc *la = OCFS2_LOCAL_ALLOC(alloc);
956 le32_to_cpu(alloc->id1.bitmap1.i_total),
957 le32_to_cpu(alloc->id1.bitmap1.i_used));
959 if (!alloc->id1.bitmap1.i_total) {
963 if (le32_to_cpu(alloc->id1.bitmap1.i_used) ==
964 le32_to_cpu(alloc->id1.bitmap1.i_total)) {
972 left = le32_to_cpu(alloc->id1.bitmap1.i_total);
1026 * Given an event, calculate the size of our next local alloc window.
1028 * This should always be called under i_rwsem of the local alloc inode
1029 * so that local alloc disabling doesn't race with processes trying to
1032 * Returns the state which the local alloc was left in. This value can
1055 * by local alloc until we have to disable it.
1061 * the number of local alloc bits used down
1077 * Don't increase the size of the local alloc window until we
1148 struct ocfs2_dinode *alloc = NULL;
1151 alloc = (struct ocfs2_dinode *) osb->local_alloc_bh->b_data;
1152 la = OCFS2_LOCAL_ALLOC(alloc);
1155 le32_to_cpu(alloc->id1.bitmap1.i_total),
1206 alloc->id1.bitmap1.i_total = cpu_to_le32(cluster_count);
1211 alloc->id1.bitmap1.i_used = 0;
1212 memset(OCFS2_LOCAL_ALLOC(alloc)->la_bitmap, 0,
1216 OCFS2_LOCAL_ALLOC(alloc)->la_bitmap);
1219 le32_to_cpu(OCFS2_LOCAL_ALLOC(alloc)->la_bm_off),
1220 le32_to_cpu(alloc->id1.bitmap1.i_total));
1228 /* Note that we do *NOT* lock the local alloc inode here as
1237 struct ocfs2_dinode *alloc;
1262 alloc = (struct ocfs2_dinode *) osb->local_alloc_bh->b_data;
1264 /* We want to clear the local alloc before doing anything
1266 * local alloc shutdown won't try to double free main bitmap
1269 alloc_copy = kmemdup(alloc, osb->local_alloc_bh->b_size, GFP_NOFS);
1285 ocfs2_clear_local_alloc(alloc);