aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/localalloc.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-02-20 01:50:32 -0500
committerTakashi Iwai <tiwai@suse.de>2014-02-20 01:50:32 -0500
commitf31f40be8f82d5eeb4ca084f9ac0f11ca265876b (patch)
tree6fce9ac78045249084d641945e094dcaea72d265 /fs/ocfs2/localalloc.c
parent13c12dbe3a2ce17227f7ddef652b6a53c78fa51f (diff)
parent895be5b31e5175bef575008aadb4f0a27b850daa (diff)
Merge tag 'asoc-v3.14-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Fixes for v3.14 A few fixes, all driver speccific ones. The DaVinci ones aren't as clear as they should be from the subject lines on the commits but they fix issues which will prevent correct operation in some use cases and only affect that particular driver so are reasonably safe.
Diffstat (limited to 'fs/ocfs2/localalloc.c')
-rw-r--r--fs/ocfs2/localalloc.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c
index cd5496b7a0a3..044013455621 100644
--- a/fs/ocfs2/localalloc.c
+++ b/fs/ocfs2/localalloc.c
@@ -781,6 +781,48 @@ bail:
781 return status; 781 return status;
782} 782}
783 783
784int ocfs2_free_local_alloc_bits(struct ocfs2_super *osb,
785 handle_t *handle,
786 struct ocfs2_alloc_context *ac,
787 u32 bit_off,
788 u32 num_bits)
789{
790 int status, start;
791 u32 clear_bits;
792 struct inode *local_alloc_inode;
793 void *bitmap;
794 struct ocfs2_dinode *alloc;
795 struct ocfs2_local_alloc *la;
796
797 BUG_ON(ac->ac_which != OCFS2_AC_USE_LOCAL);
798
799 local_alloc_inode = ac->ac_inode;
800 alloc = (struct ocfs2_dinode *) osb->local_alloc_bh->b_data;
801 la = OCFS2_LOCAL_ALLOC(alloc);
802
803 bitmap = la->la_bitmap;
804 start = bit_off - le32_to_cpu(la->la_bm_off);
805 clear_bits = num_bits;
806
807 status = ocfs2_journal_access_di(handle,
808 INODE_CACHE(local_alloc_inode),
809 osb->local_alloc_bh,
810 OCFS2_JOURNAL_ACCESS_WRITE);
811 if (status < 0) {
812 mlog_errno(status);
813 goto bail;
814 }
815
816 while (clear_bits--)
817 ocfs2_clear_bit(start++, bitmap);
818
819 le32_add_cpu(&alloc->id1.bitmap1.i_used, -num_bits);
820 ocfs2_journal_dirty(handle, osb->local_alloc_bh);
821
822bail:
823 return status;
824}
825
784static u32 ocfs2_local_alloc_count_bits(struct ocfs2_dinode *alloc) 826static u32 ocfs2_local_alloc_count_bits(struct ocfs2_dinode *alloc)
785{ 827{
786 u32 count; 828 u32 count;