Deprecate uptodate and dirty fields in ext4_block.
authorngkaho1234 <ngkaho1234@gmail.com>
Fri, 4 Dec 2015 17:34:33 +0000 (17:34 +0000)
committerngkaho1234 <ngkaho1234@gmail.com>
Fri, 4 Dec 2015 17:35:25 +0000 (17:35 +0000)
14 files changed:
lwext4/ext4.c
lwext4/ext4_balloc.c
lwext4/ext4_bcache.c
lwext4/ext4_bcache.h
lwext4/ext4_blockdev.c
lwext4/ext4_dir.c
lwext4/ext4_dir_idx.c
lwext4/ext4_extent.c
lwext4/ext4_extent_full.c
lwext4/ext4_fs.c
lwext4/ext4_ialloc.c
lwext4/ext4_journal.c
lwext4/ext4_mkfs.c
lwext4/ext4_xattr.c

index 31a0835fdf1e1092261ebf7b03f726350dd2ef4a..00c08354bd45bcfab549dc2afc3670116d572bf3 100644 (file)
@@ -248,7 +248,7 @@ static int ext4_link(struct ext4_mountpoint *mp, struct ext4_inode_ref *parent,
                                return EIO;
 
                        ext4_dir_en_set_inode(res.dentry, parent->index);
-                       res.block.dirty = true;
+                       ext4_bcache_set_dirty(res.block.buf);
                        r = ext4_dir_destroy_result(ch, &res);
                        if (r != EOK)
                                return r;
@@ -1509,7 +1509,7 @@ int ext4_fwrite(ext4_file *f, const void *buf, size_t size, size_t *wcnt)
                        goto Finish;
 
                memcpy(b.data + unalg, u8_buf, len);
-               b.dirty = true;
+               ext4_bcache_set_dirty(b.buf);
 
                r = ext4_block_set(f->mp->fs.bdev, &b);
                if (r != EOK)
@@ -1610,7 +1610,7 @@ int ext4_fwrite(ext4_file *f, const void *buf, size_t size, size_t *wcnt)
                        goto Finish;
 
                memcpy(b.data, u8_buf, size);
-               b.dirty = true;
+               ext4_bcache_set_dirty(b.buf);
 
                r = ext4_block_set(f->mp->fs.bdev, &b);
                if (r != EOK)
@@ -1894,7 +1894,7 @@ static int ext4_fsymlink_set(ext4_file *f, const void *buf, uint32_t size)
                        goto Finish;
 
                memcpy(b.data, buf, size);
-               b.dirty = true;
+               ext4_bcache_set_dirty(b.buf);
                r = ext4_block_set(f->mp->fs.bdev, &b);
                if (r != EOK)
                        goto Finish;
index f647a09677626a00d0631f4924e60d91be76065e..64f1bcf26253100ff0309e0c61dd0bc5b3f63f4c 100644 (file)
@@ -181,7 +181,7 @@ int ext4_balloc_free_block(struct ext4_inode_ref *inode_ref, ext4_fsblk_t baddr)
        /* Modify bitmap */
        ext4_bmap_bit_clr(bitmap_block.data, index_in_group);
        ext4_balloc_set_bitmap_csum(sb, bg, bitmap_block.data);
-       bitmap_block.dirty = true;
+       ext4_bcache_set_dirty(bitmap_block.buf);
 
        /* Release block with bitmap */
        rc = ext4_block_set(fs->bdev, &bitmap_block);
@@ -276,7 +276,7 @@ int ext4_balloc_free_blocks(struct ext4_inode_ref *inode_ref,
                /* Modify bitmap */
                ext4_bmap_bits_free(blk.data, idx_in_bg_first, free_cnt);
                ext4_balloc_set_bitmap_csum(sb, bg, blk.data);
-               blk.dirty = true;
+               ext4_bcache_set_dirty(blk.buf);
 
                count -= free_cnt;
                first += free_cnt;
@@ -384,7 +384,7 @@ int ext4_balloc_alloc_block(struct ext4_inode_ref *inode_ref,
                ext4_bmap_bit_set(b.data, idx_in_bg);
                ext4_balloc_set_bitmap_csum(sb, bg_ref.block_group,
                                            b.data);
-               b.dirty = true;
+               ext4_bcache_set_dirty(b.buf);
                r = ext4_block_set(inode_ref->fs->bdev, &b);
                if (r != EOK) {
                        ext4_fs_put_block_group_ref(&bg_ref);
@@ -408,7 +408,7 @@ int ext4_balloc_alloc_block(struct ext4_inode_ref *inode_ref,
                        ext4_bmap_bit_set(b.data, tmp_idx);
 
                        ext4_balloc_set_bitmap_csum(sb, bg, b.data);
-                       b.dirty = true;
+                       ext4_bcache_set_dirty(b.buf);
                        r = ext4_block_set(inode_ref->fs->bdev, &b);
                        if (r != EOK)
                                return r;
@@ -423,7 +423,7 @@ int ext4_balloc_alloc_block(struct ext4_inode_ref *inode_ref,
        if (r == EOK) {
                ext4_bmap_bit_set(b.data, rel_blk_idx);
                ext4_balloc_set_bitmap_csum(sb, bg_ref.block_group, b.data);
-               b.dirty = true;
+               ext4_bcache_set_dirty(b.buf);
                r = ext4_block_set(inode_ref->fs->bdev, &b);
                if (r != EOK)
                        return r;
@@ -491,7 +491,7 @@ goal_failed:
                if (r == EOK) {
                        ext4_bmap_bit_set(b.data, rel_blk_idx);
                        ext4_balloc_set_bitmap_csum(sb, bg, b.data);
-                       b.dirty = true;
+                       ext4_bcache_set_dirty(b.buf);
                        r = ext4_block_set(inode_ref->fs->bdev, &b);
                        if (r != EOK) {
                                ext4_fs_put_block_group_ref(&bg_ref);
@@ -594,7 +594,7 @@ int ext4_balloc_try_alloc_block(struct ext4_inode_ref *inode_ref,
        if (*free) {
                ext4_bmap_bit_set(b.data, index_in_group);
                ext4_balloc_set_bitmap_csum(sb, bg_ref.block_group, b.data);
-               b.dirty = true;
+               ext4_bcache_set_dirty(b.buf);
        }
 
        /* Release block with bitmap */
index 5e04a8488235b0aab0c06a60c8a83a6e28abe9b4..0a2e2a510c4d793a849d7cc60a64f0352fcc8e12 100644 (file)
@@ -182,10 +182,6 @@ int ext4_bcache_alloc(struct ext4_bcache *bc, struct ext4_block *b,
 
                buf->refctr++;
 
-               b->uptodate = ext4_bcache_test_flag(buf, BC_UPTODATE);
-               /* Right now we don't propagate the dirty flag from ext4_buf to
-                * ext4_block. */
-               b->dirty = false;
                b->buf = buf;
                b->data = buf->data;
 
@@ -207,8 +203,6 @@ int ext4_bcache_alloc(struct ext4_bcache *bc, struct ext4_block *b,
         * by 1*/
        buf->lru_id = ++bc->lru_ctr;
 
-       b->uptodate = false;
-       b->dirty = false;
        b->buf = buf;
        b->data = buf->data;
 
@@ -234,18 +228,6 @@ int ext4_bcache_free(struct ext4_bcache *bc, struct ext4_block *b)
        /*Just decrease reference counter*/
        buf->refctr--;
 
-       /* If buffer is modified, buf will be mark up-to-date and dirty. */
-       if (b->dirty) {
-               ext4_bcache_set_flag(buf, BC_DIRTY);
-               ext4_bcache_set_flag(buf, BC_UPTODATE);
-               b->uptodate = true;
-       }
-       /* Someone might want to drop this buffer from bcache. */
-       if (!b->uptodate) {
-               ext4_bcache_clear_flag(buf, BC_DIRTY);
-               ext4_bcache_clear_flag(buf, BC_UPTODATE);
-       }
-
        /* We are the last one touching this buffer, do the cleanups. */
        if (!buf->refctr) {
                RB_INSERT(ext4_buf_lru, &bc->lru_root, buf);
@@ -265,8 +247,6 @@ int ext4_bcache_free(struct ext4_bcache *bc, struct ext4_block *b)
 
        b->lb_id = 0;
        b->data = 0;
-       b->uptodate = false;
-       b->dirty = false;
 
        return EOK;
 }
index c718a1134f51a4cc72e6ec1db2b59179ac7f028e..bb6e6ca4baba234de6000a20847b6d3a78d45802 100644 (file)
@@ -49,16 +49,10 @@ extern "C" {
 #include "queue.h"
 
 #define EXT4_BLOCK_ZERO()      \
-       {.uptodate = 0, .dirty = 0, .lb_id = 0, .data = 0}
+       {.lb_id = 0, .data = 0}
 
 /**@brief   Single block descriptor*/
 struct ext4_block {
-       /**@brief   Uptodate flag*/
-       bool uptodate;
-
-       /**@brief   Dirty flag*/
-       bool dirty;
-
        /**@brief   Logical block ID*/
        uint64_t lb_id;
 
@@ -162,6 +156,16 @@ enum bcache_state_bits {
 #define ext4_bcache_test_flag(buf, b)    \
        (((buf)->flags & (1 << (b))) >> (b))
 
+static inline void ext4_bcache_set_dirty(struct ext4_buf *buf) {
+       ext4_bcache_set_flag(buf, BC_UPTODATE);
+       ext4_bcache_set_flag(buf, BC_DIRTY);
+}
+
+static inline void ext4_bcache_clear_dirty(struct ext4_buf *buf) {
+       ext4_bcache_clear_flag(buf, BC_UPTODATE);
+       ext4_bcache_clear_flag(buf, BC_DIRTY);
+}
+
 /**@brief   Static initializer of block cache structure.*/
 #define EXT4_BCACHE_STATIC_INSTANCE(__name, __cnt, __itemsize)                 \
        static struct ext4_bcache __name = {                                   \
index 3fb9368628a747a0dc24c3e5337bb7262ec1975d..8ad251b042d79b9908869b9522a8567e08c524a0 100644 (file)
@@ -146,7 +146,6 @@ int ext4_block_get_noread(struct ext4_blockdev *bdev, struct ext4_block *b,
        if (!(lba < bdev->lg_bcnt))
                return ERANGE;
 
-       b->dirty = 0;
        b->lb_id = lba;
 
        /*If cache is full we have to (flush and) drop it anyway :(*/
@@ -171,7 +170,7 @@ int ext4_block_get(struct ext4_blockdev *bdev, struct ext4_block *b,
        if (r != EOK)
                return r;
 
-       if (b->uptodate) {
+       if (ext4_bcache_test_flag(b->buf, BC_UPTODATE)) {
                /* Data in the cache is up-to-date.
                 * Reading from physical device is not required */
                return EOK;
@@ -187,7 +186,6 @@ int ext4_block_get(struct ext4_blockdev *bdev, struct ext4_block *b,
        /* Mark buffer up-to-date, since
         * fresh data is read from physical device just now. */
        ext4_bcache_set_flag(b->buf, BC_UPTODATE);
-       b->uptodate = true;
        return EOK;
 }
 
index 0778b1c4b3fdc3811f92ac9b502e63a4a12dd587..b22e88bcb93f1ee4aab2a0aad675c8a19cef2d65 100644 (file)
@@ -421,7 +421,7 @@ int ext4_dir_add_entry(struct ext4_inode_ref *parent, const char *name,
        }
 
        ext4_dir_set_csum(parent, (void *)b.data);
-       b.dirty = true;
+       ext4_bcache_set_dirty(b.buf);
        r = ext4_block_set(fs->bdev, &b);
 
        return r;
@@ -554,7 +554,7 @@ int ext4_dir_remove_entry(struct ext4_inode_ref *parent, const char *name,
 
        ext4_dir_set_csum(parent,
                        (struct ext4_dir_en *)result.block.data);
-       result.block.dirty = true;
+       ext4_bcache_set_dirty(result.block.buf);
 
        return ext4_dir_destroy_result(parent, &result);
 }
@@ -591,7 +591,7 @@ int ext4_dir_try_insert_entry(struct ext4_sblock *sb,
                        ext4_dir_write_entry(sb, start, rec_len, child, name,
                                             name_len);
                        ext4_dir_set_csum(inode_ref, (void *)dst_blk->data);
-                       dst_blk->dirty = true;
+                       ext4_bcache_set_dirty(dst_blk->buf);
 
                        return EOK;
                }
@@ -620,7 +620,7 @@ int ext4_dir_try_insert_entry(struct ext4_sblock *sb,
 
                                ext4_dir_set_csum(inode_ref,
                                                  (void *)dst_blk->data);
-                               dst_blk->dirty = true;
+                               ext4_bcache_set_dirty(dst_blk->buf);
                                return EOK;
                        }
                }
index b3577ddd7678130dac455cbbabd33c59e4a1033c..830b73cf696a2fc5396f05ff18a57c0900bca2fa 100644 (file)
@@ -425,7 +425,7 @@ int ext4_dir_dx_init(struct ext4_inode_ref *dir, struct ext4_inode_ref *parent)
 
        ext4_dir_en_set_inode(be, 0);
 
-       new_block.dirty = true;
+       ext4_bcache_set_dirty(new_block.buf);
        rc = ext4_block_set(dir->fs->bdev, &new_block);
        if (rc != EOK) {
                ext4_block_set(dir->fs->bdev, &block);
@@ -437,7 +437,7 @@ int ext4_dir_dx_init(struct ext4_inode_ref *dir, struct ext4_inode_ref *parent)
        ext4_dir_dx_entry_set_block(entry, iblock);
 
        ext4_dir_set_dx_csum(dir, (struct ext4_dir_en *)block.data);
-       block.dirty = true;
+       ext4_bcache_set_dirty(block.buf);
 
        return ext4_block_set(dir->fs->bdev, &block);
 }
@@ -897,7 +897,7 @@ ext4_dir_dx_insert_entry(struct ext4_inode_ref *inode_ref __unused,
        ext4_dir_dx_entry_set_hash(new_index_entry, hash);
        ext4_dir_dx_climit_set_count(climit, count + 1);
        ext4_dir_set_dx_csum(inode_ref, (void *)index_block->b.data);
-       index_block->b.dirty = true;
+       ext4_bcache_set_dirty(index_block->b.buf);
 }
 
 /**@brief Split directory entries to two parts preventing node overflow.
@@ -1073,8 +1073,8 @@ static int ext4_dir_dx_split_data(struct ext4_inode_ref *inode_ref,
        }
        ext4_dir_set_csum(inode_ref, (void *)old_data_block->data);
        ext4_dir_set_csum(inode_ref, (void *)new_data_block_tmp.data);
-       old_data_block->dirty = true;
-       new_data_block_tmp.dirty = true;
+       ext4_bcache_set_dirty(old_data_block->buf);
+       ext4_bcache_set_dirty(new_data_block_tmp.buf);
 
        free(sort);
        free(entry_buffer);
@@ -1187,7 +1187,7 @@ ext4_dir_dx_split_index(struct ext4_inode_ref *ino_ref,
                                                ino_ref,
                                                (struct ext4_dir_en *)
                                                dxb->b.data);
-                               dxb->b.dirty = true;
+                               ext4_bcache_set_dirty(dxb->b.buf);
 
                                struct ext4_block block_tmp = dxb->b;
 
@@ -1205,11 +1205,11 @@ ext4_dir_dx_split_index(struct ext4_inode_ref *ino_ref,
                                                 new_iblk);
                        ext4_dir_set_dx_csum(ino_ref, (void *)dx_blks[0].b.data);
                        ext4_dir_set_dx_csum(ino_ref, (void *)dx_blks[1].b.data);
-                       dx_blks[0].b.dirty = true;
-                       dx_blks[1].b.dirty = true;
+                       ext4_bcache_set_dirty(dx_blks[0].b.buf);
+                       ext4_bcache_set_dirty(dx_blks[1].b.buf);
 
                        ext4_dir_set_dx_csum(ino_ref, (void *)b.data);
-                       b.dirty = true;
+                       ext4_bcache_set_dirty(b.buf);
                        return ext4_block_set(ino_ref->fs->bdev, &b);
                } else {
                        size_t sz;
@@ -1241,8 +1241,8 @@ ext4_dir_dx_split_index(struct ext4_inode_ref *ino_ref,
 
                        ext4_dir_set_dx_csum(ino_ref, (void *)dx_blks[0].b.data);
                        ext4_dir_set_dx_csum(ino_ref, (void *)dx_blks[1].b.data);
-                       dx_blks[0].b.dirty = true;
-                       dx_blks[1].b.dirty = true;
+                       ext4_bcache_set_dirty(dx_blks[0].b.buf);
+                       ext4_bcache_set_dirty(dx_blks[1].b.buf);
                }
        }
 
@@ -1414,7 +1414,7 @@ int ext4_dir_dx_reset_parent_inode(struct ext4_inode_ref *dir,
        ext4_dx_dot_en_set_inode(&root->dots[1], parent_inode);
 
        ext4_dir_set_dx_csum(dir, (void *)block.data);
-       block.dirty = true;
+       ext4_bcache_set_dirty(block.buf);
 
        return ext4_block_set(dir->fs->bdev, &block);
 }
index e5ec5f85dce656363dba592db5dfb9ee9035182c..a356518d3dbf63c5fd28c3b12e8e8776e6d2fcb1 100644 (file)
@@ -534,7 +534,7 @@ int ext4_extent_remove_space(struct ext4_inode_ref *inode_ref, ext4_lblk_t from,
 
        ext4_extent_header_set_entries_count(path_ptr->header, entries);
        ext4_extent_block_csum_set(inode_ref, path_ptr->header);
-       path_ptr->block.dirty = true;
+       ext4_bcache_set_dirty(path_ptr->block.buf);
 
        /* If leaf node is empty, parent entry must be modified */
        bool remove_parent_record = false;
@@ -576,7 +576,7 @@ int ext4_extent_remove_space(struct ext4_inode_ref *inode_ref, ext4_lblk_t from,
 
                ext4_extent_header_set_entries_count(path_ptr->header, entries);
                ext4_extent_block_csum_set(inode_ref, path_ptr->header);
-               path_ptr->block.dirty = true;
+               ext4_bcache_set_dirty(path_ptr->block.buf);
 
                /* Free the node if it is empty */
                if ((entries == 0) && (path_ptr != path)) {
@@ -704,7 +704,7 @@ static int ext4_extent_append_extent(struct ext4_inode_ref *inode_ref,
                        ext4_extent_header_set_generation(path_ptr->header, 0);
 
                        ext4_extent_block_csum_set(inode_ref, path_ptr->header);
-                       path_ptr->block.dirty = true;
+                       ext4_bcache_set_dirty(path_ptr->block.buf);
 
                        /* Jump to the preceding item */
                        path_ptr--;
@@ -730,7 +730,7 @@ static int ext4_extent_append_extent(struct ext4_inode_ref *inode_ref,
                        ext4_extent_header_set_entries_count(path_ptr->header,
                                                             entries + 1);
                        ext4_extent_block_csum_set(inode_ref, path_ptr->header);
-                       path_ptr->block.dirty = true;
+                       ext4_bcache_set_dirty(path_ptr->block.buf);
 
                        /* No more splitting needed */
                        return EOK;
@@ -813,7 +813,7 @@ static int ext4_extent_append_extent(struct ext4_inode_ref *inode_ref,
                                                         limit);
 
                ext4_extent_block_csum_set(inode_ref, old_root->header);
-               old_root->block.dirty = true;
+               ext4_bcache_set_dirty(old_root->block.buf);
 
                /* Re-initialize new root metadata */
                new_root->depth = root_depth + 1;
@@ -831,7 +831,7 @@ static int ext4_extent_append_extent(struct ext4_inode_ref *inode_ref,
 
                /* Since new_root belongs to on-disk inode,
                 * we don't do checksum here */
-               new_root->block.dirty = true;
+               ext4_bcache_set_dirty(new_root->block.buf);
        } else {
                if (path->depth) {
                        path->index =
@@ -848,7 +848,7 @@ static int ext4_extent_append_extent(struct ext4_inode_ref *inode_ref,
                ext4_extent_header_set_entries_count(path->header, entries + 1);
                /* Since new_root belongs to on-disk inode,
                 * we don't do checksum here */
-               path->block.dirty = true;
+               ext4_bcache_set_dirty(path->block.buf);
        }
 
        return EOK;
@@ -928,7 +928,7 @@ ext4_extent_append_block(struct ext4_inode_ref *inode_ref, uint32_t *iblock,
                        }
 
                        ext4_extent_block_csum_set(inode_ref, path_ptr->header);
-                       path_ptr->block.dirty = true;
+                       ext4_bcache_set_dirty(path_ptr->block.buf);
 
                        goto finish;
                } else {
@@ -970,7 +970,7 @@ ext4_extent_append_block(struct ext4_inode_ref *inode_ref, uint32_t *iblock,
                        }
 
                        ext4_extent_block_csum_set(inode_ref, path_ptr->header);
-                       path_ptr->block.dirty = true;
+                       ext4_bcache_set_dirty(path_ptr->block.buf);
 
                        goto finish;
                }
@@ -1011,7 +1011,7 @@ append_extent:
        }
 
        ext4_extent_block_csum_set(inode_ref, path_ptr->header);
-       path_ptr->block.dirty = true;
+       ext4_bcache_set_dirty(path_ptr->block.buf);
 
 finish:
        /* Set return values */
index 60b838e678ac9e1c8d9dca59923698322369d640..2d34d67a6026f7d8a46582140e6536d2cfb3922e 100644 (file)
@@ -353,7 +353,7 @@ static int ext4_ext_dirty(struct ext4_inode_ref *inode_ref,
                          struct ext4_extent_path *path)
 {
        if (path->block.lb_id)
-               path->block.dirty = true;
+               ext4_bcache_set_dirty(path->block.buf);
        else
                inode_ref->dirty = true;
 
@@ -374,7 +374,7 @@ static void ext4_ext_drop_refs(struct ext4_inode_ref *inode_ref,
 
        for (i = 0; i <= depth; i++, path++) {
                if (path->block.lb_id) {
-                       if (path->block.dirty)
+                       if (ext4_bcache_test_flag(path->block.buf, BC_DIRTY))
                                ext4_extent_block_csum_set(inode_ref,
                                                path->header);
 
@@ -798,7 +798,7 @@ out:
        } else if (bh.lb_id) {
                /* If we got a sibling leaf. */
                ext4_extent_block_csum_set(inode_ref, ext_block_hdr(&bh));
-               bh.dirty = true;
+               ext4_bcache_set_dirty(bh.buf);
 
                spt->path.p_block = ext4_idx_pblock(ix);
                spt->path.depth = to_le16(eh->depth);
@@ -1070,7 +1070,7 @@ out:
        } else if (bh.lb_id) {
                /* If we got a sibling leaf. */
                ext4_extent_block_csum_set(inode_ref, ext_block_hdr(&bh));
-               bh.dirty = true;
+               ext4_bcache_set_dirty(bh.buf);
 
                spt->path.p_block = ext4_ext_pblock(ex);
                spt->path.depth = to_le16(eh->depth);
@@ -1166,7 +1166,7 @@ static int ext4_ext_grow_indepth(struct ext4_inode_ref *inode_ref,
        }
        neh->depth = to_le16(to_le16(neh->depth) + 1);
 
-       bh.dirty = true;
+       ext4_bcache_set_dirty(bh.buf);
        inode_ref->dirty = true;
        ext4_block_set(inode_ref->fs->bdev, &bh);
 
@@ -1728,7 +1728,7 @@ static int ext4_ext_zero_unwritten_range(struct ext4_inode_ref *inode_ref,
                        break;
 
                memset(bh.data, 0, block_size);
-               bh.dirty = true;
+               ext4_bcache_set_dirty(bh.buf);
                err = ext4_block_set(inode_ref->fs->bdev, &bh);
                if (err != EOK)
                        break;
index 7f27ab93e6688ab48e9613ab4574397fe4f329c6..edc87ad4e0a44cf5f0a4e1d7427d0602ce9798a9 100644 (file)
@@ -356,7 +356,7 @@ static int ext4_fs_init_block_bitmap(struct ext4_block_group_ref *bg_ref)
          * of bitmap ), set rest of the block bitmap to 1
          */
         ext4_fs_mark_bitmap_end(group_blocks, block_size * 8, block_bitmap.data);
-       block_bitmap.dirty = true;
+       ext4_bcache_set_dirty(block_bitmap.buf);
 
        ext4_balloc_set_bitmap_csum(sb, bg_ref->block_group, block_bitmap.data);
        bg_ref->dirty = true;
@@ -399,7 +399,7 @@ static int ext4_fs_init_inode_bitmap(struct ext4_block_group_ref *bg_ref)
        if (i < end_bit)
                memset(b.data + (i >> 3), 0xff, (end_bit - i) >> 3);
 
-       b.dirty = true;
+       ext4_bcache_set_dirty(b.buf);
 
        ext4_ialloc_set_bitmap_csum(sb, bg, b.data);
        bg_ref->dirty = true;
@@ -440,7 +440,7 @@ static int ext4_fs_init_inode_table(struct ext4_block_group_ref *bg_ref)
                        return rc;
 
                memset(b.data, 0, block_size);
-               b.dirty = true;
+               ext4_bcache_set_dirty(b.buf);
 
                ext4_block_set(bg_ref->fs->bdev, &b);
                if (rc != EOK)
@@ -629,7 +629,7 @@ int ext4_fs_put_block_group_ref(struct ext4_block_group_ref *ref)
                ref->block_group->checksum = to_le16(cs);
 
                /* Mark block dirty for writing changes to physical device */
-               ref->block.dirty = true;
+               ext4_bcache_set_dirty(ref->block.buf);
        }
 
        /* Put back block, that contains block group descriptor */
@@ -781,7 +781,7 @@ int ext4_fs_put_inode_ref(struct ext4_inode_ref *ref)
        if (ref->dirty) {
                /* Mark block dirty for writing changes to physical device */
                ext4_fs_set_inode_checksum(ref);
-               ref->block.dirty = true;
+               ext4_bcache_set_dirty(ref->block.buf);
        }
 
        /* Put back block, that contains i-node */
@@ -1118,7 +1118,7 @@ static int ext4_fs_release_inode_block(struct ext4_inode_ref *inode_ref,
                /* Set zero if physical data block address found */
                if (level == 1) {
                        ((uint32_t *)block.data)[offset_in_block] = to_le32(0);
-                       block.dirty = true;
+                       ext4_bcache_set_dirty(block.buf);
                }
 
                rc = ext4_block_set(fs->bdev, &block);
@@ -1507,7 +1507,7 @@ static int ext4_fs_set_inode_data_block_index(struct ext4_inode_ref *inode_ref,
 
                /* Initialize new block */
                memset(new_block.data, 0, block_size);
-               new_block.dirty = true;
+               ext4_bcache_set_dirty(new_block.buf);
 
                /* Put back the allocated block */
                rc = ext4_block_set(fs->bdev, &new_block);
@@ -1554,7 +1554,7 @@ static int ext4_fs_set_inode_data_block_index(struct ext4_inode_ref *inode_ref,
 
                        /* Initialize allocated block */
                        memset(new_block.data, 0, block_size);
-                       new_block.dirty = true;
+                       ext4_bcache_set_dirty(new_block.buf);
 
                        rc = ext4_block_set(fs->bdev, &new_block);
                        if (rc != EOK) {
@@ -1565,7 +1565,7 @@ static int ext4_fs_set_inode_data_block_index(struct ext4_inode_ref *inode_ref,
                        /* Write block address to the parent */
                        uint32_t * p = (uint32_t * )block.data;
                        p[off_in_blk] = to_le32((uint32_t)new_blk);
-                       block.dirty = true;
+                       ext4_bcache_set_dirty(block.buf);
                        current_block = new_blk;
                }
 
@@ -1573,7 +1573,7 @@ static int ext4_fs_set_inode_data_block_index(struct ext4_inode_ref *inode_ref,
                if (l == 1) {
                        uint32_t * p = (uint32_t * )block.data;
                        p[off_in_blk] = to_le32((uint32_t)fblock);
-                       block.dirty = true;
+                       ext4_bcache_set_dirty(block.buf);
                }
 
                rc = ext4_block_set(fs->bdev, &block);
index 7f7b0d624579fa5dc9d40acba367a39e42e83012..0a73b3ab83c7b16198bf5ab59c0da8066e3b0a94 100644 (file)
@@ -184,7 +184,7 @@ int ext4_ialloc_free_inode(struct ext4_fs *fs, uint32_t index, bool is_dir)
        uint32_t index_in_group = ext4_ialloc_inode_to_bgidx(sb, index);
        ext4_bmap_bit_clr(b.data, index_in_group);
        ext4_ialloc_set_bitmap_csum(sb, bg, b.data);
-       b.dirty = true;
+       ext4_bcache_set_dirty(b.buf);
 
        /* Put back the block with bitmap */
        rc = ext4_block_set(fs->bdev, &b);
@@ -300,7 +300,7 @@ int ext4_ialloc_alloc_inode(struct ext4_fs *fs, uint32_t *idx, bool is_dir)
                        /* Free i-node found, save the bitmap */
                        ext4_ialloc_set_bitmap_csum(sb,bg,
                                                    b.data);
-                       b.dirty = true;
+                       ext4_bcache_set_dirty(b.buf);
 
                        ext4_block_set(fs->bdev, &b);
                        if (rc != EOK) {
index 832922f4d65b649cb4f0102d5c422d840a7696ed..f573b053cb547cffb4bf13f47f1dfd9b8f3c67f9 100644 (file)
@@ -410,7 +410,7 @@ static void jbd_replay_block_tags(struct jbd_fs *jbd_fs,
                        journal_block.data,
                        jbd_get32(&jbd_fs->sb, blocksize));
 
-               ext4_block.dirty = true;
+               ext4_bcache_set_dirty(ext4_block.buf);
                ext4_block_set(fs->bdev, &ext4_block);
        } else {
                uint16_t mount_count, state;
index b9a2912e6a6cdfc7a2fe1b1a58a475544e657d80..ee43f1481d27ba50c7d9ce4104a637551647e0b3 100644 (file)
@@ -394,7 +394,7 @@ static int write_bgroups(struct ext4_blockdev *bd, struct fs_aux_info *aux_info,
                                        break;
                        }
 
-                       b.dirty = true;
+                       ext4_bcache_set_dirty(b.buf);
                        r = ext4_block_set(bd, &b);
                        if (r != EOK)
                                return r;
@@ -407,7 +407,7 @@ static int write_bgroups(struct ext4_blockdev *bd, struct fs_aux_info *aux_info,
                if (r != EOK)
                        return r;
                memset(b.data, 0, block_size);
-               b.dirty = true;
+               ext4_bcache_set_dirty(b.buf);
                r = ext4_block_set(bd, &b);
                if (r != EOK)
                        return r;
@@ -415,7 +415,7 @@ static int write_bgroups(struct ext4_blockdev *bd, struct fs_aux_info *aux_info,
                if (r != EOK)
                        return r;
                memset(b.data, 0, block_size);
-               b.dirty = true;
+               ext4_bcache_set_dirty(b.buf);
                r = ext4_block_set(bd, &b);
                if (r != EOK)
                        return r;
index 1be5a7d24f9c24a2ee43f6c2881de81abb2cd643..f15060535c333f23b56f44554bcf5d1bd07f44fb 100644 (file)
@@ -655,7 +655,7 @@ static int ext4_xattr_write_to_disk(struct ext4_xattr_ref *xattr_ref)
                block_data = (char *)block_header + block_size_rem;
                block_size_rem -= sizeof(struct ext4_xattr_header);
 
-               xattr_ref->block.dirty = true;
+               ext4_bcache_set_dirty(xattr_ref->block.buf);
        } else {
                /* We don't need an extra block.*/
                if (xattr_ref->block_loaded) {
@@ -677,7 +677,7 @@ static int ext4_xattr_write_to_disk(struct ext4_xattr_ref *xattr_ref)
                                    &xattr_ref->fs->sb, 0);
 
                                xattr_ref->inode_ref->dirty = true;
-                               xattr_ref->block.dirty = true;
+                               ext4_bcache_set_dirty(xattr_ref->block.buf);
                        }
                }
        }
@@ -726,7 +726,7 @@ static int ext4_xattr_write_to_disk(struct ext4_xattr_ref *xattr_ref)
                ext4_xattr_set_block_checksum(xattr_ref->inode_ref,
                                              xattr_ref->block.lb_id,
                                              block_header);
-               xattr_ref->block.dirty = true;
+               ext4_bcache_set_dirty(xattr_ref->block.buf);
        }
 
 Finish: