Loading fs/ocfs2/alloc.c +18 −11 Original line number Original line Diff line number Diff line Loading @@ -1006,7 +1006,7 @@ static int ocfs2_create_new_meta_bhs(handle_t *handle, int count, status, i; int count, status, i; u16 suballoc_bit_start; u16 suballoc_bit_start; u32 num_got; u32 num_got; u64 first_blkno; u64 suballoc_loc, first_blkno; struct ocfs2_super *osb = struct ocfs2_super *osb = OCFS2_SB(ocfs2_metadata_cache_get_super(et->et_ci)); OCFS2_SB(ocfs2_metadata_cache_get_super(et->et_ci)); struct ocfs2_extent_block *eb; struct ocfs2_extent_block *eb; Loading @@ -1015,10 +1015,10 @@ static int ocfs2_create_new_meta_bhs(handle_t *handle, count = 0; count = 0; while (count < wanted) { while (count < wanted) { status = ocfs2_claim_metadata(osb, status = ocfs2_claim_metadata(handle, handle, meta_ac, meta_ac, wanted - count, wanted - count, &suballoc_loc, &suballoc_bit_start, &suballoc_bit_start, &num_got, &num_got, &first_blkno); &first_blkno); Loading Loading @@ -1052,6 +1052,7 @@ static int ocfs2_create_new_meta_bhs(handle_t *handle, eb->h_fs_generation = cpu_to_le32(osb->fs_generation); eb->h_fs_generation = cpu_to_le32(osb->fs_generation); eb->h_suballoc_slot = eb->h_suballoc_slot = cpu_to_le16(meta_ac->ac_alloc_slot); cpu_to_le16(meta_ac->ac_alloc_slot); eb->h_suballoc_loc = cpu_to_le64(suballoc_loc); eb->h_suballoc_bit = cpu_to_le16(suballoc_bit_start); eb->h_suballoc_bit = cpu_to_le16(suballoc_bit_start); eb->h_list.l_count = eb->h_list.l_count = cpu_to_le16(ocfs2_extent_recs_per_eb(osb->sb)); cpu_to_le16(ocfs2_extent_recs_per_eb(osb->sb)); Loading Loading @@ -4786,7 +4787,7 @@ int ocfs2_add_clusters_in_btree(handle_t *handle, goto leave; goto leave; } } status = __ocfs2_claim_clusters(osb, handle, data_ac, 1, status = __ocfs2_claim_clusters(handle, data_ac, 1, clusters_to_add, &bit_off, &num_bits); clusters_to_add, &bit_off, &num_bits); if (status < 0) { if (status < 0) { if (status != -ENOSPC) if (status != -ENOSPC) Loading Loading @@ -6295,6 +6296,7 @@ int ocfs2_truncate_log_init(struct ocfs2_super *osb) */ */ struct ocfs2_cached_block_free { struct ocfs2_cached_block_free { struct ocfs2_cached_block_free *free_next; struct ocfs2_cached_block_free *free_next; u64 free_bg; u64 free_blk; u64 free_blk; unsigned int free_bit; unsigned int free_bit; }; }; Loading Loading @@ -6341,6 +6343,9 @@ static int ocfs2_free_cached_blocks(struct ocfs2_super *osb, } } while (head) { while (head) { if (head->free_bg) bg_blkno = head->free_bg; else bg_blkno = ocfs2_which_suballoc_group(head->free_blk, bg_blkno = ocfs2_which_suballoc_group(head->free_blk, head->free_bit); head->free_bit); mlog(0, "Free bit: (bit %u, blkno %llu)\n", mlog(0, "Free bit: (bit %u, blkno %llu)\n", Loading Loading @@ -6390,7 +6395,7 @@ int ocfs2_cache_cluster_dealloc(struct ocfs2_cached_dealloc_ctxt *ctxt, int ret = 0; int ret = 0; struct ocfs2_cached_block_free *item; struct ocfs2_cached_block_free *item; item = kmalloc(sizeof(*item), GFP_NOFS); item = kzalloc(sizeof(*item), GFP_NOFS); if (item == NULL) { if (item == NULL) { ret = -ENOMEM; ret = -ENOMEM; mlog_errno(ret); mlog_errno(ret); Loading Loading @@ -6530,8 +6535,8 @@ ocfs2_find_per_slot_free_list(int type, } } int ocfs2_cache_block_dealloc(struct ocfs2_cached_dealloc_ctxt *ctxt, int ocfs2_cache_block_dealloc(struct ocfs2_cached_dealloc_ctxt *ctxt, int type, int slot, u64 blkno, int type, int slot, u64 suballoc, unsigned int bit) u64 blkno, unsigned int bit) { { int ret; int ret; struct ocfs2_per_slot_free_list *fl; struct ocfs2_per_slot_free_list *fl; Loading @@ -6544,7 +6549,7 @@ int ocfs2_cache_block_dealloc(struct ocfs2_cached_dealloc_ctxt *ctxt, goto out; goto out; } } item = kmalloc(sizeof(*item), GFP_NOFS); item = kzalloc(sizeof(*item), GFP_NOFS); if (item == NULL) { if (item == NULL) { ret = -ENOMEM; ret = -ENOMEM; mlog_errno(ret); mlog_errno(ret); Loading @@ -6554,6 +6559,7 @@ int ocfs2_cache_block_dealloc(struct ocfs2_cached_dealloc_ctxt *ctxt, mlog(0, "Insert: (type %d, slot %u, bit %u, blk %llu)\n", mlog(0, "Insert: (type %d, slot %u, bit %u, blk %llu)\n", type, slot, bit, (unsigned long long)blkno); type, slot, bit, (unsigned long long)blkno); item->free_bg = suballoc; item->free_blk = blkno; item->free_blk = blkno; item->free_bit = bit; item->free_bit = bit; item->free_next = fl->f_first; item->free_next = fl->f_first; Loading @@ -6570,6 +6576,7 @@ static int ocfs2_cache_extent_block_free(struct ocfs2_cached_dealloc_ctxt *ctxt, { { return ocfs2_cache_block_dealloc(ctxt, EXTENT_ALLOC_SYSTEM_INODE, return ocfs2_cache_block_dealloc(ctxt, EXTENT_ALLOC_SYSTEM_INODE, le16_to_cpu(eb->h_suballoc_slot), le16_to_cpu(eb->h_suballoc_slot), le64_to_cpu(eb->h_suballoc_loc), le64_to_cpu(eb->h_blkno), le64_to_cpu(eb->h_blkno), le16_to_cpu(eb->h_suballoc_bit)); le16_to_cpu(eb->h_suballoc_bit)); } } Loading Loading @@ -6883,7 +6890,7 @@ int ocfs2_convert_inline_data_to_extents(struct inode *inode, data_ac->ac_resv = &OCFS2_I(inode)->ip_la_data_resv; data_ac->ac_resv = &OCFS2_I(inode)->ip_la_data_resv; ret = ocfs2_claim_clusters(osb, handle, data_ac, 1, &bit_off, ret = ocfs2_claim_clusters(handle, data_ac, 1, &bit_off, &num); &num); if (ret) { if (ret) { mlog_errno(ret); mlog_errno(ret); Loading fs/ocfs2/alloc.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -210,7 +210,7 @@ static inline void ocfs2_init_dealloc_ctxt(struct ocfs2_cached_dealloc_ctxt *c) int ocfs2_cache_cluster_dealloc(struct ocfs2_cached_dealloc_ctxt *ctxt, int ocfs2_cache_cluster_dealloc(struct ocfs2_cached_dealloc_ctxt *ctxt, u64 blkno, unsigned int bit); u64 blkno, unsigned int bit); int ocfs2_cache_block_dealloc(struct ocfs2_cached_dealloc_ctxt *ctxt, int ocfs2_cache_block_dealloc(struct ocfs2_cached_dealloc_ctxt *ctxt, int type, int slot, u64 blkno, int type, int slot, u64 suballoc, u64 blkno, unsigned int bit); unsigned int bit); static inline int ocfs2_dealloc_has_cluster(struct ocfs2_cached_dealloc_ctxt *c) static inline int ocfs2_dealloc_has_cluster(struct ocfs2_cached_dealloc_ctxt *c) { { Loading fs/ocfs2/dir.c +11 −7 Original line number Original line Diff line number Diff line Loading @@ -2395,15 +2395,15 @@ static int ocfs2_dx_dir_attach_index(struct ocfs2_super *osb, int ret; int ret; struct ocfs2_dinode *di = (struct ocfs2_dinode *) di_bh->b_data; struct ocfs2_dinode *di = (struct ocfs2_dinode *) di_bh->b_data; u16 dr_suballoc_bit; u16 dr_suballoc_bit; u64 dr_blkno; u64 suballoc_loc, dr_blkno; unsigned int num_bits; unsigned int num_bits; struct buffer_head *dx_root_bh = NULL; struct buffer_head *dx_root_bh = NULL; struct ocfs2_dx_root_block *dx_root; struct ocfs2_dx_root_block *dx_root; struct ocfs2_dir_block_trailer *trailer = struct ocfs2_dir_block_trailer *trailer = ocfs2_trailer_from_bh(dirdata_bh, dir->i_sb); ocfs2_trailer_from_bh(dirdata_bh, dir->i_sb); ret = ocfs2_claim_metadata(osb, handle, meta_ac, 1, &dr_suballoc_bit, ret = ocfs2_claim_metadata(handle, meta_ac, 1, &suballoc_loc, &num_bits, &dr_blkno); &dr_suballoc_bit, &num_bits, &dr_blkno); if (ret) { if (ret) { mlog_errno(ret); mlog_errno(ret); goto out; goto out; Loading Loading @@ -2431,6 +2431,7 @@ static int ocfs2_dx_dir_attach_index(struct ocfs2_super *osb, memset(dx_root, 0, osb->sb->s_blocksize); memset(dx_root, 0, osb->sb->s_blocksize); strcpy(dx_root->dr_signature, OCFS2_DX_ROOT_SIGNATURE); strcpy(dx_root->dr_signature, OCFS2_DX_ROOT_SIGNATURE); dx_root->dr_suballoc_slot = cpu_to_le16(meta_ac->ac_alloc_slot); dx_root->dr_suballoc_slot = cpu_to_le16(meta_ac->ac_alloc_slot); dx_root->dr_suballoc_loc = cpu_to_le64(suballoc_loc); dx_root->dr_suballoc_bit = cpu_to_le16(dr_suballoc_bit); dx_root->dr_suballoc_bit = cpu_to_le16(dr_suballoc_bit); dx_root->dr_fs_generation = cpu_to_le32(osb->fs_generation); dx_root->dr_fs_generation = cpu_to_le32(osb->fs_generation); dx_root->dr_blkno = cpu_to_le64(dr_blkno); dx_root->dr_blkno = cpu_to_le64(dr_blkno); Loading Loading @@ -2544,7 +2545,7 @@ static int __ocfs2_dx_dir_new_cluster(struct inode *dir, * chance of contiguousness as the directory grows in number * chance of contiguousness as the directory grows in number * of entries. * of entries. */ */ ret = __ocfs2_claim_clusters(osb, handle, data_ac, 1, 1, &phys, &num); ret = __ocfs2_claim_clusters(handle, data_ac, 1, 1, &phys, &num); if (ret) { if (ret) { mlog_errno(ret); mlog_errno(ret); goto out; goto out; Loading Loading @@ -2979,7 +2980,7 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh, */ */ if (ocfs2_dir_resv_allowed(osb)) if (ocfs2_dir_resv_allowed(osb)) data_ac->ac_resv = &oi->ip_la_data_resv; data_ac->ac_resv = &oi->ip_la_data_resv; ret = ocfs2_claim_clusters(osb, handle, data_ac, 1, &bit_off, &len); ret = ocfs2_claim_clusters(handle, data_ac, 1, &bit_off, &len); if (ret) { if (ret) { mlog_errno(ret); mlog_errno(ret); goto out_commit; goto out_commit; Loading Loading @@ -3118,7 +3119,7 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh, * pass. Claim the 2nd cluster as a separate extent. * pass. Claim the 2nd cluster as a separate extent. */ */ if (alloc > len) { if (alloc > len) { ret = ocfs2_claim_clusters(osb, handle, data_ac, 1, &bit_off, ret = ocfs2_claim_clusters(handle, data_ac, 1, &bit_off, &len); &len); if (ret) { if (ret) { mlog_errno(ret); mlog_errno(ret); Loading Loading @@ -4465,6 +4466,9 @@ static int ocfs2_dx_dir_remove_index(struct inode *dir, blk = le64_to_cpu(dx_root->dr_blkno); blk = le64_to_cpu(dx_root->dr_blkno); bit = le16_to_cpu(dx_root->dr_suballoc_bit); bit = le16_to_cpu(dx_root->dr_suballoc_bit); if (dx_root->dr_suballoc_loc) bg_blkno = le64_to_cpu(dx_root->dr_suballoc_loc); else bg_blkno = ocfs2_which_suballoc_group(blk, bit); bg_blkno = ocfs2_which_suballoc_group(blk, bit); ret = ocfs2_free_suballoc_bits(handle, dx_alloc_inode, dx_alloc_bh, ret = ocfs2_free_suballoc_bits(handle, dx_alloc_inode, dx_alloc_bh, bit, bg_blkno, 1); bit, bg_blkno, 1); Loading fs/ocfs2/journal.h +12 −0 Original line number Original line Diff line number Diff line Loading @@ -561,6 +561,18 @@ static inline int ocfs2_calc_group_alloc_credits(struct super_block *sb, return blocks; return blocks; } } /* * Allocating a discontiguous block group requires the credits from * ocfs2_calc_group_alloc_credits() as well as enough credits to fill * the group descriptor's extent list. The caller already has started * the transaction with ocfs2_calc_group_alloc_credits(). They extend * it with these credits. */ static inline int ocfs2_calc_bg_discontig_credits(struct super_block *sb) { return ocfs2_extent_recs_per_gd(sb); } static inline int ocfs2_calc_tree_trunc_credits(struct super_block *sb, static inline int ocfs2_calc_tree_trunc_credits(struct super_block *sb, unsigned int clusters_to_del, unsigned int clusters_to_del, struct ocfs2_dinode *fe, struct ocfs2_dinode *fe, Loading fs/ocfs2/localalloc.c +3 −3 Original line number Original line Diff line number Diff line Loading @@ -122,7 +122,7 @@ unsigned int ocfs2_la_default_mb(struct ocfs2_super *osb) struct super_block *sb = osb->sb; struct super_block *sb = osb->sb; gd_mb = ocfs2_clusters_to_megabytes(osb->sb, gd_mb = ocfs2_clusters_to_megabytes(osb->sb, 8 * ocfs2_group_bitmap_size(sb)); 8 * ocfs2_group_bitmap_size(sb, 0, osb->s_feature_incompat)); /* /* * This takes care of files systems with very small group * This takes care of files systems with very small group Loading Loading @@ -1161,7 +1161,7 @@ static int ocfs2_local_alloc_new_window(struct ocfs2_super *osb, /* we used the generic suballoc reserve function, but we set /* we used the generic suballoc reserve function, but we set * everything up nicely, so there's no reason why we can't use * everything up nicely, so there's no reason why we can't use * the more specific cluster api to claim bits. */ * the more specific cluster api to claim bits. */ status = ocfs2_claim_clusters(osb, handle, ac, osb->local_alloc_bits, status = ocfs2_claim_clusters(handle, ac, osb->local_alloc_bits, &cluster_off, &cluster_count); &cluster_off, &cluster_count); if (status == -ENOSPC) { if (status == -ENOSPC) { retry_enospc: retry_enospc: Loading @@ -1175,7 +1175,7 @@ static int ocfs2_local_alloc_new_window(struct ocfs2_super *osb, goto bail; goto bail; ac->ac_bits_wanted = osb->local_alloc_default_bits; ac->ac_bits_wanted = osb->local_alloc_default_bits; status = ocfs2_claim_clusters(osb, handle, ac, status = ocfs2_claim_clusters(handle, ac, osb->local_alloc_bits, osb->local_alloc_bits, &cluster_off, &cluster_off, &cluster_count); &cluster_count); Loading Loading
fs/ocfs2/alloc.c +18 −11 Original line number Original line Diff line number Diff line Loading @@ -1006,7 +1006,7 @@ static int ocfs2_create_new_meta_bhs(handle_t *handle, int count, status, i; int count, status, i; u16 suballoc_bit_start; u16 suballoc_bit_start; u32 num_got; u32 num_got; u64 first_blkno; u64 suballoc_loc, first_blkno; struct ocfs2_super *osb = struct ocfs2_super *osb = OCFS2_SB(ocfs2_metadata_cache_get_super(et->et_ci)); OCFS2_SB(ocfs2_metadata_cache_get_super(et->et_ci)); struct ocfs2_extent_block *eb; struct ocfs2_extent_block *eb; Loading @@ -1015,10 +1015,10 @@ static int ocfs2_create_new_meta_bhs(handle_t *handle, count = 0; count = 0; while (count < wanted) { while (count < wanted) { status = ocfs2_claim_metadata(osb, status = ocfs2_claim_metadata(handle, handle, meta_ac, meta_ac, wanted - count, wanted - count, &suballoc_loc, &suballoc_bit_start, &suballoc_bit_start, &num_got, &num_got, &first_blkno); &first_blkno); Loading Loading @@ -1052,6 +1052,7 @@ static int ocfs2_create_new_meta_bhs(handle_t *handle, eb->h_fs_generation = cpu_to_le32(osb->fs_generation); eb->h_fs_generation = cpu_to_le32(osb->fs_generation); eb->h_suballoc_slot = eb->h_suballoc_slot = cpu_to_le16(meta_ac->ac_alloc_slot); cpu_to_le16(meta_ac->ac_alloc_slot); eb->h_suballoc_loc = cpu_to_le64(suballoc_loc); eb->h_suballoc_bit = cpu_to_le16(suballoc_bit_start); eb->h_suballoc_bit = cpu_to_le16(suballoc_bit_start); eb->h_list.l_count = eb->h_list.l_count = cpu_to_le16(ocfs2_extent_recs_per_eb(osb->sb)); cpu_to_le16(ocfs2_extent_recs_per_eb(osb->sb)); Loading Loading @@ -4786,7 +4787,7 @@ int ocfs2_add_clusters_in_btree(handle_t *handle, goto leave; goto leave; } } status = __ocfs2_claim_clusters(osb, handle, data_ac, 1, status = __ocfs2_claim_clusters(handle, data_ac, 1, clusters_to_add, &bit_off, &num_bits); clusters_to_add, &bit_off, &num_bits); if (status < 0) { if (status < 0) { if (status != -ENOSPC) if (status != -ENOSPC) Loading Loading @@ -6295,6 +6296,7 @@ int ocfs2_truncate_log_init(struct ocfs2_super *osb) */ */ struct ocfs2_cached_block_free { struct ocfs2_cached_block_free { struct ocfs2_cached_block_free *free_next; struct ocfs2_cached_block_free *free_next; u64 free_bg; u64 free_blk; u64 free_blk; unsigned int free_bit; unsigned int free_bit; }; }; Loading Loading @@ -6341,6 +6343,9 @@ static int ocfs2_free_cached_blocks(struct ocfs2_super *osb, } } while (head) { while (head) { if (head->free_bg) bg_blkno = head->free_bg; else bg_blkno = ocfs2_which_suballoc_group(head->free_blk, bg_blkno = ocfs2_which_suballoc_group(head->free_blk, head->free_bit); head->free_bit); mlog(0, "Free bit: (bit %u, blkno %llu)\n", mlog(0, "Free bit: (bit %u, blkno %llu)\n", Loading Loading @@ -6390,7 +6395,7 @@ int ocfs2_cache_cluster_dealloc(struct ocfs2_cached_dealloc_ctxt *ctxt, int ret = 0; int ret = 0; struct ocfs2_cached_block_free *item; struct ocfs2_cached_block_free *item; item = kmalloc(sizeof(*item), GFP_NOFS); item = kzalloc(sizeof(*item), GFP_NOFS); if (item == NULL) { if (item == NULL) { ret = -ENOMEM; ret = -ENOMEM; mlog_errno(ret); mlog_errno(ret); Loading Loading @@ -6530,8 +6535,8 @@ ocfs2_find_per_slot_free_list(int type, } } int ocfs2_cache_block_dealloc(struct ocfs2_cached_dealloc_ctxt *ctxt, int ocfs2_cache_block_dealloc(struct ocfs2_cached_dealloc_ctxt *ctxt, int type, int slot, u64 blkno, int type, int slot, u64 suballoc, unsigned int bit) u64 blkno, unsigned int bit) { { int ret; int ret; struct ocfs2_per_slot_free_list *fl; struct ocfs2_per_slot_free_list *fl; Loading @@ -6544,7 +6549,7 @@ int ocfs2_cache_block_dealloc(struct ocfs2_cached_dealloc_ctxt *ctxt, goto out; goto out; } } item = kmalloc(sizeof(*item), GFP_NOFS); item = kzalloc(sizeof(*item), GFP_NOFS); if (item == NULL) { if (item == NULL) { ret = -ENOMEM; ret = -ENOMEM; mlog_errno(ret); mlog_errno(ret); Loading @@ -6554,6 +6559,7 @@ int ocfs2_cache_block_dealloc(struct ocfs2_cached_dealloc_ctxt *ctxt, mlog(0, "Insert: (type %d, slot %u, bit %u, blk %llu)\n", mlog(0, "Insert: (type %d, slot %u, bit %u, blk %llu)\n", type, slot, bit, (unsigned long long)blkno); type, slot, bit, (unsigned long long)blkno); item->free_bg = suballoc; item->free_blk = blkno; item->free_blk = blkno; item->free_bit = bit; item->free_bit = bit; item->free_next = fl->f_first; item->free_next = fl->f_first; Loading @@ -6570,6 +6576,7 @@ static int ocfs2_cache_extent_block_free(struct ocfs2_cached_dealloc_ctxt *ctxt, { { return ocfs2_cache_block_dealloc(ctxt, EXTENT_ALLOC_SYSTEM_INODE, return ocfs2_cache_block_dealloc(ctxt, EXTENT_ALLOC_SYSTEM_INODE, le16_to_cpu(eb->h_suballoc_slot), le16_to_cpu(eb->h_suballoc_slot), le64_to_cpu(eb->h_suballoc_loc), le64_to_cpu(eb->h_blkno), le64_to_cpu(eb->h_blkno), le16_to_cpu(eb->h_suballoc_bit)); le16_to_cpu(eb->h_suballoc_bit)); } } Loading Loading @@ -6883,7 +6890,7 @@ int ocfs2_convert_inline_data_to_extents(struct inode *inode, data_ac->ac_resv = &OCFS2_I(inode)->ip_la_data_resv; data_ac->ac_resv = &OCFS2_I(inode)->ip_la_data_resv; ret = ocfs2_claim_clusters(osb, handle, data_ac, 1, &bit_off, ret = ocfs2_claim_clusters(handle, data_ac, 1, &bit_off, &num); &num); if (ret) { if (ret) { mlog_errno(ret); mlog_errno(ret); Loading
fs/ocfs2/alloc.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -210,7 +210,7 @@ static inline void ocfs2_init_dealloc_ctxt(struct ocfs2_cached_dealloc_ctxt *c) int ocfs2_cache_cluster_dealloc(struct ocfs2_cached_dealloc_ctxt *ctxt, int ocfs2_cache_cluster_dealloc(struct ocfs2_cached_dealloc_ctxt *ctxt, u64 blkno, unsigned int bit); u64 blkno, unsigned int bit); int ocfs2_cache_block_dealloc(struct ocfs2_cached_dealloc_ctxt *ctxt, int ocfs2_cache_block_dealloc(struct ocfs2_cached_dealloc_ctxt *ctxt, int type, int slot, u64 blkno, int type, int slot, u64 suballoc, u64 blkno, unsigned int bit); unsigned int bit); static inline int ocfs2_dealloc_has_cluster(struct ocfs2_cached_dealloc_ctxt *c) static inline int ocfs2_dealloc_has_cluster(struct ocfs2_cached_dealloc_ctxt *c) { { Loading
fs/ocfs2/dir.c +11 −7 Original line number Original line Diff line number Diff line Loading @@ -2395,15 +2395,15 @@ static int ocfs2_dx_dir_attach_index(struct ocfs2_super *osb, int ret; int ret; struct ocfs2_dinode *di = (struct ocfs2_dinode *) di_bh->b_data; struct ocfs2_dinode *di = (struct ocfs2_dinode *) di_bh->b_data; u16 dr_suballoc_bit; u16 dr_suballoc_bit; u64 dr_blkno; u64 suballoc_loc, dr_blkno; unsigned int num_bits; unsigned int num_bits; struct buffer_head *dx_root_bh = NULL; struct buffer_head *dx_root_bh = NULL; struct ocfs2_dx_root_block *dx_root; struct ocfs2_dx_root_block *dx_root; struct ocfs2_dir_block_trailer *trailer = struct ocfs2_dir_block_trailer *trailer = ocfs2_trailer_from_bh(dirdata_bh, dir->i_sb); ocfs2_trailer_from_bh(dirdata_bh, dir->i_sb); ret = ocfs2_claim_metadata(osb, handle, meta_ac, 1, &dr_suballoc_bit, ret = ocfs2_claim_metadata(handle, meta_ac, 1, &suballoc_loc, &num_bits, &dr_blkno); &dr_suballoc_bit, &num_bits, &dr_blkno); if (ret) { if (ret) { mlog_errno(ret); mlog_errno(ret); goto out; goto out; Loading Loading @@ -2431,6 +2431,7 @@ static int ocfs2_dx_dir_attach_index(struct ocfs2_super *osb, memset(dx_root, 0, osb->sb->s_blocksize); memset(dx_root, 0, osb->sb->s_blocksize); strcpy(dx_root->dr_signature, OCFS2_DX_ROOT_SIGNATURE); strcpy(dx_root->dr_signature, OCFS2_DX_ROOT_SIGNATURE); dx_root->dr_suballoc_slot = cpu_to_le16(meta_ac->ac_alloc_slot); dx_root->dr_suballoc_slot = cpu_to_le16(meta_ac->ac_alloc_slot); dx_root->dr_suballoc_loc = cpu_to_le64(suballoc_loc); dx_root->dr_suballoc_bit = cpu_to_le16(dr_suballoc_bit); dx_root->dr_suballoc_bit = cpu_to_le16(dr_suballoc_bit); dx_root->dr_fs_generation = cpu_to_le32(osb->fs_generation); dx_root->dr_fs_generation = cpu_to_le32(osb->fs_generation); dx_root->dr_blkno = cpu_to_le64(dr_blkno); dx_root->dr_blkno = cpu_to_le64(dr_blkno); Loading Loading @@ -2544,7 +2545,7 @@ static int __ocfs2_dx_dir_new_cluster(struct inode *dir, * chance of contiguousness as the directory grows in number * chance of contiguousness as the directory grows in number * of entries. * of entries. */ */ ret = __ocfs2_claim_clusters(osb, handle, data_ac, 1, 1, &phys, &num); ret = __ocfs2_claim_clusters(handle, data_ac, 1, 1, &phys, &num); if (ret) { if (ret) { mlog_errno(ret); mlog_errno(ret); goto out; goto out; Loading Loading @@ -2979,7 +2980,7 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh, */ */ if (ocfs2_dir_resv_allowed(osb)) if (ocfs2_dir_resv_allowed(osb)) data_ac->ac_resv = &oi->ip_la_data_resv; data_ac->ac_resv = &oi->ip_la_data_resv; ret = ocfs2_claim_clusters(osb, handle, data_ac, 1, &bit_off, &len); ret = ocfs2_claim_clusters(handle, data_ac, 1, &bit_off, &len); if (ret) { if (ret) { mlog_errno(ret); mlog_errno(ret); goto out_commit; goto out_commit; Loading Loading @@ -3118,7 +3119,7 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh, * pass. Claim the 2nd cluster as a separate extent. * pass. Claim the 2nd cluster as a separate extent. */ */ if (alloc > len) { if (alloc > len) { ret = ocfs2_claim_clusters(osb, handle, data_ac, 1, &bit_off, ret = ocfs2_claim_clusters(handle, data_ac, 1, &bit_off, &len); &len); if (ret) { if (ret) { mlog_errno(ret); mlog_errno(ret); Loading Loading @@ -4465,6 +4466,9 @@ static int ocfs2_dx_dir_remove_index(struct inode *dir, blk = le64_to_cpu(dx_root->dr_blkno); blk = le64_to_cpu(dx_root->dr_blkno); bit = le16_to_cpu(dx_root->dr_suballoc_bit); bit = le16_to_cpu(dx_root->dr_suballoc_bit); if (dx_root->dr_suballoc_loc) bg_blkno = le64_to_cpu(dx_root->dr_suballoc_loc); else bg_blkno = ocfs2_which_suballoc_group(blk, bit); bg_blkno = ocfs2_which_suballoc_group(blk, bit); ret = ocfs2_free_suballoc_bits(handle, dx_alloc_inode, dx_alloc_bh, ret = ocfs2_free_suballoc_bits(handle, dx_alloc_inode, dx_alloc_bh, bit, bg_blkno, 1); bit, bg_blkno, 1); Loading
fs/ocfs2/journal.h +12 −0 Original line number Original line Diff line number Diff line Loading @@ -561,6 +561,18 @@ static inline int ocfs2_calc_group_alloc_credits(struct super_block *sb, return blocks; return blocks; } } /* * Allocating a discontiguous block group requires the credits from * ocfs2_calc_group_alloc_credits() as well as enough credits to fill * the group descriptor's extent list. The caller already has started * the transaction with ocfs2_calc_group_alloc_credits(). They extend * it with these credits. */ static inline int ocfs2_calc_bg_discontig_credits(struct super_block *sb) { return ocfs2_extent_recs_per_gd(sb); } static inline int ocfs2_calc_tree_trunc_credits(struct super_block *sb, static inline int ocfs2_calc_tree_trunc_credits(struct super_block *sb, unsigned int clusters_to_del, unsigned int clusters_to_del, struct ocfs2_dinode *fe, struct ocfs2_dinode *fe, Loading
fs/ocfs2/localalloc.c +3 −3 Original line number Original line Diff line number Diff line Loading @@ -122,7 +122,7 @@ unsigned int ocfs2_la_default_mb(struct ocfs2_super *osb) struct super_block *sb = osb->sb; struct super_block *sb = osb->sb; gd_mb = ocfs2_clusters_to_megabytes(osb->sb, gd_mb = ocfs2_clusters_to_megabytes(osb->sb, 8 * ocfs2_group_bitmap_size(sb)); 8 * ocfs2_group_bitmap_size(sb, 0, osb->s_feature_incompat)); /* /* * This takes care of files systems with very small group * This takes care of files systems with very small group Loading Loading @@ -1161,7 +1161,7 @@ static int ocfs2_local_alloc_new_window(struct ocfs2_super *osb, /* we used the generic suballoc reserve function, but we set /* we used the generic suballoc reserve function, but we set * everything up nicely, so there's no reason why we can't use * everything up nicely, so there's no reason why we can't use * the more specific cluster api to claim bits. */ * the more specific cluster api to claim bits. */ status = ocfs2_claim_clusters(osb, handle, ac, osb->local_alloc_bits, status = ocfs2_claim_clusters(handle, ac, osb->local_alloc_bits, &cluster_off, &cluster_count); &cluster_off, &cluster_count); if (status == -ENOSPC) { if (status == -ENOSPC) { retry_enospc: retry_enospc: Loading @@ -1175,7 +1175,7 @@ static int ocfs2_local_alloc_new_window(struct ocfs2_super *osb, goto bail; goto bail; ac->ac_bits_wanted = osb->local_alloc_default_bits; ac->ac_bits_wanted = osb->local_alloc_default_bits; status = ocfs2_claim_clusters(osb, handle, ac, status = ocfs2_claim_clusters(handle, ac, osb->local_alloc_bits, osb->local_alloc_bits, &cluster_off, &cluster_off, &cluster_count); &cluster_count); Loading