shithub: lwext4

Download patch

ref: d24a490d30a7a1565eb5970a8232a091e6e9dd1b
parent: c3b88a14d1ad01e8fb1ab27c60064fd207e00754
author: gkostka <kostka.grzegorz@gmail.com>
date: Tue Jun 16 06:01:33 EDT 2015

clang-format: ext4_balloc

--- a/lwext4/ext4_balloc.c
+++ b/lwext4/ext4_balloc.c
@@ -47,7 +47,6 @@
 #include <ext4_bitmap.h>
 #include <ext4_inode.h>
 
-
 /**@brief Compute number of block group from block address.
  * @param sb         Superblock pointer.
  * @param baddr Absolute address of block.
@@ -54,22 +53,22 @@
  * @return Block group index
  */
 static uint32_t ext4_balloc_get_bgid_of_block(struct ext4_sblock *s,
-    uint32_t baddr)
+                                              uint32_t baddr)
 {
-    if(ext4_get32(s, first_data_block))
+    if (ext4_get32(s, first_data_block))
         baddr--;
 
     return baddr / ext4_get32(s, blocks_per_group);
 }
 
-
-uint32_t ext4_balloc_get_first_data_block_in_group(struct ext4_sblock *s,
-    struct ext4_block_group_ref * bg_ref)
+uint32_t
+ext4_balloc_get_first_data_block_in_group(struct ext4_sblock *s,
+                                          struct ext4_block_group_ref *bg_ref)
 {
     uint32_t block_group_count = ext4_block_group_cnt(s);
     uint32_t inode_table_first_block =
-            ext4_bg_get_inode_table_first_block(bg_ref->block_group, s);
-    uint32_t block_size  = ext4_sb_get_block_size(s);
+        ext4_bg_get_inode_table_first_block(bg_ref->block_group, s);
+    uint32_t block_size = ext4_sb_get_block_size(s);
 
     uint16_t inode_size = ext4_get16(s, inode_size);
     uint32_t inodes_per_group = ext4_get32(s, inodes_per_group);
@@ -76,15 +75,14 @@
 
     uint32_t inode_table_bytes;
 
-
     if (bg_ref->index < block_group_count - 1) {
         inode_table_bytes = inodes_per_group * inode_size;
     } else {
         /* Last block group could be smaller */
         uint32_t inodes_count_total = ext4_get32(s, inodes_count);
-        inode_table_bytes =
-                (inodes_count_total - ((block_group_count - 1) *
-                        inodes_per_group)) * inode_size;
+        inode_table_bytes = (inodes_count_total -
+                             ((block_group_count - 1) * inodes_per_group)) *
+                            inode_size;
     }
 
     uint32_t inode_table_blocks = inode_table_bytes / block_size;
@@ -100,8 +98,7 @@
     struct ext4_fs *fs = inode_ref->fs;
     struct ext4_sblock *sb = &fs->sb;
 
-
-    uint32_t block_group    = ext4_balloc_get_bgid_of_block(sb, baddr);
+    uint32_t block_group = ext4_balloc_get_bgid_of_block(sb, baddr);
     uint32_t index_in_group = ext4_fs_baddr2_index_in_group(sb, baddr);
 
     /* Load block group reference */
@@ -112,12 +109,12 @@
 
     /* Load block with bitmap */
     uint32_t bitmap_block_addr =
-            ext4_bg_get_block_bitmap(bg_ref.block_group, sb);
+        ext4_bg_get_block_bitmap(bg_ref.block_group, sb);
 
     struct ext4_block bitmap_block;
 
     rc = ext4_block_get(fs->bdev, &bitmap_block, bitmap_block_addr);
-    if (rc != EOK){
+    if (rc != EOK) {
         ext4_fs_put_block_group_ref(&bg_ref);
         return rc;
     }
@@ -137,14 +134,12 @@
     uint32_t block_size = ext4_sb_get_block_size(sb);
 
     /* Update superblock free blocks count */
-    uint64_t sb_free_blocks =
-            ext4_sb_get_free_blocks_cnt(sb);
+    uint64_t sb_free_blocks = ext4_sb_get_free_blocks_cnt(sb);
     sb_free_blocks++;
     ext4_sb_set_free_blocks_cnt(sb, sb_free_blocks);
 
     /* Update inode blocks count */
-    uint64_t ino_blocks =
-            ext4_inode_get_blocks_count(sb, inode_ref->inode);
+    uint64_t ino_blocks = ext4_inode_get_blocks_count(sb, inode_ref->inode);
     ino_blocks -= block_size / EXT4_INODE_BLOCK_SIZE;
     ext4_inode_set_blocks_count(sb, inode_ref->inode, ino_blocks);
     inode_ref->dirty = true;
@@ -151,10 +146,9 @@
 
     /* Update block group free blocks count */
     uint32_t free_blocks =
-            ext4_bg_get_free_blocks_count(bg_ref.block_group, sb);
+        ext4_bg_get_free_blocks_count(bg_ref.block_group, sb);
     free_blocks++;
-    ext4_bg_set_free_blocks_count(bg_ref.block_group,
-        sb, free_blocks);
+    ext4_bg_set_free_blocks_count(bg_ref.block_group, sb, free_blocks);
 
     bg_ref.dirty = true;
 
@@ -163,7 +157,7 @@
 }
 
 int ext4_balloc_free_blocks(struct ext4_inode_ref *inode_ref, uint32_t first,
-    uint32_t count)
+                            uint32_t count)
 {
     int rc = EOK;
     struct ext4_fs *fs = inode_ref->fs;
@@ -170,23 +164,22 @@
     struct ext4_sblock *sb = &fs->sb;
 
     /* Compute indexes */
-    uint32_t block_group_first =
-            ext4_balloc_get_bgid_of_block(sb, first);
+    uint32_t block_group_first = ext4_balloc_get_bgid_of_block(sb, first);
 
     /* Compute indexes */
     uint32_t block_group_last =
-            ext4_balloc_get_bgid_of_block(sb, first + count - 1);
+        ext4_balloc_get_bgid_of_block(sb, first + count - 1);
 
-    if(!ext4_sb_has_feature_incompatible(sb, EXT4_FEATURE_INCOMPAT_FLEX_BG)){
+    if (!ext4_sb_has_feature_incompatible(sb, EXT4_FEATURE_INCOMPAT_FLEX_BG)) {
         /*It is not possible withot flex_bg that blocks are continuous
          * and and last block belongs to other bg.*/
         ext4_assert(block_group_first ==
-                ext4_balloc_get_bgid_of_block(sb, first + count - 1));
+                    ext4_balloc_get_bgid_of_block(sb, first + count - 1));
     }
 
     /* Load block group reference */
     struct ext4_block_group_ref bg_ref;
-    while(block_group_first <= block_group_last){
+    while (block_group_first <= block_group_last) {
 
         rc = ext4_fs_get_block_group_ref(fs, block_group_first, &bg_ref);
         if (rc != EOK)
@@ -193,21 +186,22 @@
             return rc;
 
         uint32_t index_in_group_first =
-                ext4_fs_baddr2_index_in_group(sb, first);
+            ext4_fs_baddr2_index_in_group(sb, first);
 
         /* Load block with bitmap */
         uint32_t bitmap_block_addr =
-                ext4_bg_get_block_bitmap(bg_ref.block_group, sb);
+            ext4_bg_get_block_bitmap(bg_ref.block_group, sb);
 
         struct ext4_block bitmap_block;
 
         rc = ext4_block_get(fs->bdev, &bitmap_block, bitmap_block_addr);
-        if (rc != EOK){
+        if (rc != EOK) {
             ext4_fs_put_block_group_ref(&bg_ref);
             return rc;
         }
 
-        uint32_t free_cnt = ext4_sb_get_block_size(sb) * 8 - index_in_group_first;
+        uint32_t free_cnt =
+            ext4_sb_get_block_size(sb) * 8 - index_in_group_first;
 
         /*If last block, free only count blocks*/
         free_cnt = count > free_cnt ? free_cnt : count;
@@ -229,14 +223,12 @@
         uint32_t block_size = ext4_sb_get_block_size(sb);
 
         /* Update superblock free blocks count */
-        uint64_t sb_free_blocks =
-                ext4_sb_get_free_blocks_cnt(sb);
+        uint64_t sb_free_blocks = ext4_sb_get_free_blocks_cnt(sb);
         sb_free_blocks += free_cnt;
         ext4_sb_set_free_blocks_cnt(sb, sb_free_blocks);
 
         /* Update inode blocks count */
-        uint64_t ino_blocks =
-                ext4_inode_get_blocks_count(sb, inode_ref->inode);
+        uint64_t ino_blocks = ext4_inode_get_blocks_count(sb, inode_ref->inode);
         ino_blocks -= free_cnt * (block_size / EXT4_INODE_BLOCK_SIZE);
         ext4_inode_set_blocks_count(sb, inode_ref->inode, ino_blocks);
         inode_ref->dirty = true;
@@ -243,15 +235,14 @@
 
         /* Update block group free blocks count */
         uint32_t free_blocks =
-                ext4_bg_get_free_blocks_count(bg_ref.block_group, sb);
+            ext4_bg_get_free_blocks_count(bg_ref.block_group, sb);
         free_blocks += free_cnt;
-        ext4_bg_set_free_blocks_count(bg_ref.block_group,
-                sb, free_blocks);
+        ext4_bg_set_free_blocks_count(bg_ref.block_group, sb, free_blocks);
         bg_ref.dirty = true;
 
         /* Release block group reference */
         rc = ext4_fs_put_block_group_ref(&bg_ref);
-        if(rc != EOK)
+        if (rc != EOK)
             break;
 
         block_group_first++;
@@ -262,13 +253,13 @@
     return rc;
 }
 
-
 /**@brief Compute 'goal' for allocation algorithm.
  * @param inode_ref Reference to inode, to allocate block for
  * @param goal
  * @return error code
  */
-static int ext4_balloc_find_goal(struct ext4_inode_ref *inode_ref, uint32_t *goal)
+static int ext4_balloc_find_goal(struct ext4_inode_ref *inode_ref,
+                                 uint32_t *goal)
 {
     struct ext4_sblock *sb = &inode_ref->fs->sb;
     *goal = 0;
@@ -282,8 +273,8 @@
 
     /* If inode has some blocks, get last block address + 1 */
     if (inode_block_count > 0) {
-        int rc = ext4_fs_get_inode_data_block_index(inode_ref,
-                inode_block_count - 1, goal);
+        int rc = ext4_fs_get_inode_data_block_index(
+            inode_ref, inode_block_count - 1, goal);
         if (rc != EOK)
             return rc;
 
@@ -303,8 +294,7 @@
 
     /* Load block group reference */
     struct ext4_block_group_ref bg_ref;
-    int rc = ext4_fs_get_block_group_ref(inode_ref->fs,
-            block_group, &bg_ref);
+    int rc = ext4_fs_get_block_group_ref(inode_ref->fs, block_group, &bg_ref);
     if (rc != EOK)
         return rc;
 
@@ -311,7 +301,7 @@
     /* Compute indexes */
     uint32_t block_group_count = ext4_block_group_cnt(sb);
     uint32_t inode_table_first_block =
-            ext4_bg_get_inode_table_first_block(bg_ref.block_group, sb);
+        ext4_bg_get_inode_table_first_block(bg_ref.block_group, sb);
     uint16_t inode_table_item_size = ext4_get16(sb, inode_size);
     uint32_t inode_table_bytes;
 
@@ -322,9 +312,9 @@
         /* Last block group could be smaller */
         uint32_t inodes_count_total = ext4_get32(sb, inodes_count);
 
-        inode_table_bytes =
-                (inodes_count_total - ((block_group_count - 1) *
-                        inodes_per_group)) * inode_table_item_size;
+        inode_table_bytes = (inodes_count_total -
+                             ((block_group_count - 1) * inodes_per_group)) *
+                            inode_table_item_size;
     }
 
     uint32_t inode_table_blocks = inode_table_bytes / block_size;
@@ -334,12 +324,10 @@
 
     *goal = inode_table_first_block + inode_table_blocks;
 
-    return  ext4_fs_put_block_group_ref(&bg_ref);
+    return ext4_fs_put_block_group_ref(&bg_ref);
 }
 
-
-int ext4_balloc_alloc_block(struct ext4_inode_ref *inode_ref,
-    uint32_t *fblock)
+int ext4_balloc_alloc_block(struct ext4_inode_ref *inode_ref, uint32_t *fblock)
 {
     uint32_t allocated_block = 0;
     uint32_t bitmap_block_addr;
@@ -358,18 +346,15 @@
 
     /* Load block group number for goal and relative index */
     uint32_t block_group = ext4_balloc_get_bgid_of_block(sb, goal);
-    uint32_t index_in_group =
-            ext4_fs_baddr2_index_in_group(sb, goal);
+    uint32_t index_in_group = ext4_fs_baddr2_index_in_group(sb, goal);
 
     /* Load block group reference */
     struct ext4_block_group_ref bg_ref;
-    rc = ext4_fs_get_block_group_ref(inode_ref->fs,
-            block_group, &bg_ref);
+    rc = ext4_fs_get_block_group_ref(inode_ref->fs, block_group, &bg_ref);
     if (rc != EOK)
         return rc;
 
-    free_blocks =
-            ext4_bg_get_free_blocks_count(bg_ref.block_group, sb);
+    free_blocks = ext4_bg_get_free_blocks_count(bg_ref.block_group, sb);
     if (free_blocks == 0) {
         /* This group has no free blocks */
         goto goal_failed;
@@ -377,20 +362,18 @@
 
     /* Compute indexes */
     uint32_t first_in_group =
-            ext4_balloc_get_first_data_block_in_group(sb, &bg_ref);
+        ext4_balloc_get_first_data_block_in_group(sb, &bg_ref);
 
     uint32_t first_in_group_index =
-            ext4_fs_baddr2_index_in_group(sb, first_in_group);
+        ext4_fs_baddr2_index_in_group(sb, first_in_group);
 
     if (index_in_group < first_in_group_index)
         index_in_group = first_in_group_index;
 
     /* Load block with bitmap */
-    bitmap_block_addr =
-            ext4_bg_get_block_bitmap(bg_ref.block_group, sb);
+    bitmap_block_addr = ext4_bg_get_block_bitmap(bg_ref.block_group, sb);
 
-    rc = ext4_block_get(inode_ref->fs->bdev, &bitmap_block,
-            bitmap_block_addr);
+    rc = ext4_block_get(inode_ref->fs->bdev, &bitmap_block, bitmap_block_addr);
     if (rc != EOK) {
         ext4_fs_put_block_group_ref(&bg_ref);
         return rc;
@@ -407,14 +390,12 @@
         }
 
         allocated_block =
-                ext4_fs_index_in_group2_baddr(sb, index_in_group,
-                        block_group);
+            ext4_fs_index_in_group2_baddr(sb, index_in_group, block_group);
 
         goto success;
     }
 
-    uint32_t blocks_in_group =
-            ext4_blocks_in_group_cnt(sb, block_group);
+    uint32_t blocks_in_group = ext4_blocks_in_group_cnt(sb, block_group);
 
     uint32_t end_idx = (index_in_group + 63) & ~63;
     if (end_idx > blocks_in_group)
@@ -422,8 +403,7 @@
 
     /* Try to find free block near to goal */
     uint32_t tmp_idx;
-    for (tmp_idx = index_in_group + 1; tmp_idx < end_idx;
-            ++tmp_idx) {
+    for (tmp_idx = index_in_group + 1; tmp_idx < end_idx; ++tmp_idx) {
         if (ext4_bmap_is_bit_clr(bitmap_block.data, tmp_idx)) {
             ext4_bmap_bit_set(bitmap_block.data, tmp_idx);
 
@@ -433,18 +413,15 @@
                 return rc;
 
             allocated_block =
-                    ext4_fs_index_in_group2_baddr(sb, tmp_idx,
-                            block_group);
+                ext4_fs_index_in_group2_baddr(sb, tmp_idx, block_group);
 
             goto success;
         }
     }
 
-
-
     /* Find free bit in bitmap */
-    rc = ext4_bmap_bit_find_clr(bitmap_block.data,
-            index_in_group, blocks_in_group, &rel_block_idx);
+    rc = ext4_bmap_bit_find_clr(bitmap_block.data, index_in_group,
+                                blocks_in_group, &rel_block_idx);
     if (rc == EOK) {
         ext4_bmap_bit_set(bitmap_block.data, rel_block_idx);
         bitmap_block.dirty = true;
@@ -453,8 +430,7 @@
             return rc;
 
         allocated_block =
-                ext4_fs_index_in_group2_baddr(sb, rel_block_idx,
-                        block_group);
+            ext4_fs_index_in_group2_baddr(sb, rel_block_idx, block_group);
 
         goto success;
     }
@@ -461,7 +437,7 @@
 
     /* No free block found yet */
     rc = ext4_block_set(inode_ref->fs->bdev, &bitmap_block);
-    if(rc != EOK){
+    if (rc != EOK) {
         ext4_fs_put_block_group_ref(&bg_ref);
         return rc;
     }
@@ -469,10 +445,9 @@
 goal_failed:
 
     rc = ext4_fs_put_block_group_ref(&bg_ref);
-    if(rc != EOK)
+    if (rc != EOK)
         return rc;
 
-
     /* Try other block groups */
     uint32_t block_group_count = ext4_block_group_cnt(sb);
 
@@ -480,13 +455,11 @@
     uint32_t count = block_group_count;
 
     while (count > 0) {
-        rc = ext4_fs_get_block_group_ref(inode_ref->fs, bgid,
-                &bg_ref);
+        rc = ext4_fs_get_block_group_ref(inode_ref->fs, bgid, &bg_ref);
         if (rc != EOK)
             return rc;
 
-        free_blocks =
-                ext4_bg_get_free_blocks_count(bg_ref.block_group, sb);
+        free_blocks = ext4_bg_get_free_blocks_count(bg_ref.block_group, sb);
         if (free_blocks == 0) {
             /* This group has no free blocks */
             goto next_group;
@@ -493,11 +466,10 @@
         }
 
         /* Load block with bitmap */
-        bitmap_block_addr =
-                ext4_bg_get_block_bitmap(bg_ref.block_group, sb);
+        bitmap_block_addr = ext4_bg_get_block_bitmap(bg_ref.block_group, sb);
 
         rc = ext4_block_get(inode_ref->fs->bdev, &bitmap_block,
-                bitmap_block_addr);
+                            bitmap_block_addr);
 
         if (rc != EOK) {
             ext4_fs_put_block_group_ref(&bg_ref);
@@ -505,22 +477,19 @@
         }
 
         /* Compute indexes */
-        first_in_group =
-                ext4_balloc_get_first_data_block_in_group(sb, &bg_ref);
-        index_in_group =
-                ext4_fs_baddr2_index_in_group(sb, first_in_group);
+        first_in_group = ext4_balloc_get_first_data_block_in_group(sb, &bg_ref);
+        index_in_group = ext4_fs_baddr2_index_in_group(sb, first_in_group);
         blocks_in_group = ext4_blocks_in_group_cnt(sb, bgid);
 
         first_in_group_index =
-                ext4_fs_baddr2_index_in_group(sb, first_in_group);
+            ext4_fs_baddr2_index_in_group(sb, first_in_group);
 
         if (index_in_group < first_in_group_index)
             index_in_group = first_in_group_index;
 
+        rc = ext4_bmap_bit_find_clr(bitmap_block.data, index_in_group,
+                                    blocks_in_group, &rel_block_idx);
 
-        rc = ext4_bmap_bit_find_clr(bitmap_block.data,
-                index_in_group, blocks_in_group, &rel_block_idx);
-
         if (rc == EOK) {
 
             ext4_bmap_bit_set(bitmap_block.data, rel_block_idx);
@@ -527,27 +496,26 @@
 
             bitmap_block.dirty = true;
             rc = ext4_block_set(inode_ref->fs->bdev, &bitmap_block);
-            if (rc != EOK){
+            if (rc != EOK) {
                 ext4_fs_put_block_group_ref(&bg_ref);
                 return rc;
             }
 
             allocated_block =
-                    ext4_fs_index_in_group2_baddr(sb, rel_block_idx,
-                            bgid);
+                ext4_fs_index_in_group2_baddr(sb, rel_block_idx, bgid);
 
             goto success;
         }
 
         rc = ext4_block_set(inode_ref->fs->bdev, &bitmap_block);
-        if(rc != EOK){
+        if (rc != EOK) {
             ext4_fs_put_block_group_ref(&bg_ref);
             return rc;
         }
 
-next_group:
+    next_group:
         rc = ext4_fs_put_block_group_ref(&bg_ref);
-        if(rc != EOK){
+        if (rc != EOK) {
             return rc;
         }
 
@@ -558,7 +526,7 @@
 
     return ENOSPC;
 
-    success:
+success:
     /* Empty command - because of syntax */
     ;
 
@@ -570,8 +538,7 @@
     ext4_sb_set_free_blocks_cnt(sb, sb_free_blocks);
 
     /* Update inode blocks (different block size!) count */
-    uint64_t ino_blocks =
-            ext4_inode_get_blocks_count(sb, inode_ref->inode);
+    uint64_t ino_blocks = ext4_inode_get_blocks_count(sb, inode_ref->inode);
     ino_blocks += block_size / EXT4_INODE_BLOCK_SIZE;
     ext4_inode_set_blocks_count(sb, inode_ref->inode, ino_blocks);
     inode_ref->dirty = true;
@@ -578,10 +545,9 @@
 
     /* Update block group free blocks count */
     uint32_t bg_free_blocks =
-            ext4_bg_get_free_blocks_count(bg_ref.block_group, sb);
+        ext4_bg_get_free_blocks_count(bg_ref.block_group, sb);
     bg_free_blocks--;
-    ext4_bg_set_free_blocks_count(bg_ref.block_group, sb,
-        bg_free_blocks);
+    ext4_bg_set_free_blocks_count(bg_ref.block_group, sb, bg_free_blocks);
 
     bg_ref.dirty = true;
 
@@ -592,7 +558,7 @@
 }
 
 int ext4_balloc_try_alloc_block(struct ext4_inode_ref *inode_ref,
-    uint32_t baddr, bool *free)
+                                uint32_t baddr, bool *free)
 {
     int rc;
 
@@ -601,8 +567,7 @@
 
     /* Compute indexes */
     uint32_t block_group = ext4_balloc_get_bgid_of_block(sb, baddr);
-    uint32_t index_in_group =
-            ext4_fs_baddr2_index_in_group(sb, baddr);
+    uint32_t index_in_group = ext4_fs_baddr2_index_in_group(sb, baddr);
 
     /* Load block group reference */
     struct ext4_block_group_ref bg_ref;
@@ -612,13 +577,12 @@
 
     /* Load block with bitmap */
     uint32_t bitmap_block_addr =
-            ext4_bg_get_block_bitmap(bg_ref.block_group, sb);
+        ext4_bg_get_block_bitmap(bg_ref.block_group, sb);
 
-
     struct ext4_block bitmap_block;
 
     rc = ext4_block_get(fs->bdev, &bitmap_block, bitmap_block_addr);
-    if (rc != EOK){
+    if (rc != EOK) {
         ext4_fs_put_block_group_ref(&bg_ref);
         return rc;
     }
@@ -652,8 +616,7 @@
     ext4_sb_set_free_blocks_cnt(sb, sb_free_blocks);
 
     /* Update inode blocks count */
-    uint64_t ino_blocks =
-            ext4_inode_get_blocks_count(sb, inode_ref->inode);
+    uint64_t ino_blocks = ext4_inode_get_blocks_count(sb, inode_ref->inode);
     ino_blocks += block_size / EXT4_INODE_BLOCK_SIZE;
     ext4_inode_set_blocks_count(sb, inode_ref->inode, ino_blocks);
     inode_ref->dirty = true;
@@ -660,14 +623,13 @@
 
     /* Update block group free blocks count */
     uint32_t free_blocks =
-            ext4_bg_get_free_blocks_count(bg_ref.block_group, sb);
+        ext4_bg_get_free_blocks_count(bg_ref.block_group, sb);
     free_blocks--;
-    ext4_bg_set_free_blocks_count(bg_ref.block_group,
-        sb, free_blocks);
+    ext4_bg_set_free_blocks_count(bg_ref.block_group, sb, free_blocks);
 
     bg_ref.dirty = true;
 
-    terminate:
+terminate:
     return ext4_fs_put_block_group_ref(&bg_ref);
 }
 
--- a/lwext4/ext4_balloc.h
+++ b/lwext4/ext4_balloc.h
@@ -48,34 +48,32 @@
 #include <stdint.h>
 #include <stdbool.h>
 
-
 /**@brief   Get first datablock in block group
  * @param   s superblock descriptor
  * @param   bg_ref block group reference
  * @return  block id of the first datablock in block group*/
-uint32_t ext4_balloc_get_first_data_block_in_group(struct ext4_sblock *s,
-    struct ext4_block_group_ref * bg_ref);
+uint32_t
+ext4_balloc_get_first_data_block_in_group(struct ext4_sblock *s,
+                                          struct ext4_block_group_ref *bg_ref);
 
 /**@brief   Free block from inode.
  * @param   inode_ref inode reference
  * @param   baddr block address
  * @return  standard error code*/
-int ext4_balloc_free_block(struct ext4_inode_ref *inode_ref,
-    uint32_t baddr);
+int ext4_balloc_free_block(struct ext4_inode_ref *inode_ref, uint32_t baddr);
 
 /**@brief   Free blocks from inode.
  * @param   inode_ref inode reference
  * @param   baddr block address
  * @return  standard error code*/
-int ext4_balloc_free_blocks(struct ext4_inode_ref *inode_ref,
-    uint32_t first, uint32_t count);
+int ext4_balloc_free_blocks(struct ext4_inode_ref *inode_ref, uint32_t first,
+                            uint32_t count);
 
 /**@brief   Allocate block procedure.
  * @param   inode_ref inode reference
  * @param   baddr allocated block address
  * @return  standard error code*/
-int ext4_balloc_alloc_block(struct ext4_inode_ref *inode_ref,
-    uint32_t *baddr);
+int ext4_balloc_alloc_block(struct ext4_inode_ref *inode_ref, uint32_t *baddr);
 
 /**@brief   Try allocate selected block.
  * @param   inode_ref inode reference
@@ -83,7 +81,7 @@
  * @param   free if baddr is not allocated
  * @return  standard error code*/
 int ext4_balloc_try_alloc_block(struct ext4_inode_ref *inode_ref,
-    uint32_t baddr, bool *free);
+                                uint32_t baddr, bool *free);
 
 #endif /* EXT4_BALLOC_H_ */
 
@@ -90,4 +88,3 @@
 /**
  * @}
  */
-