inode.c (617ba13b31fbf505cc21799826639ef24ed94af0) inode.c (dab291af8d6307a3075c3d67d0cc8f98e646cb94)
1/*
2 * linux/fs/ext4/inode.c
3 *
4 * Copyright (C) 1992, 1993, 1994, 1995
5 * Remy Card (card@masi.ibp.fr)
6 * Laboratoire MASI - Institut Blaise Pascal
7 * Universite Pierre et Marie Curie (Paris VI)
8 *

--- 11 unchanged lines hidden (view full) ---

20 * (jj@sunsite.ms.mff.cuni.cz)
21 *
22 * Assorted race fixes, rewrite of ext4_get_block() by Al Viro, 2000
23 */
24
25#include <linux/module.h>
26#include <linux/fs.h>
27#include <linux/time.h>
1/*
2 * linux/fs/ext4/inode.c
3 *
4 * Copyright (C) 1992, 1993, 1994, 1995
5 * Remy Card (card@masi.ibp.fr)
6 * Laboratoire MASI - Institut Blaise Pascal
7 * Universite Pierre et Marie Curie (Paris VI)
8 *

--- 11 unchanged lines hidden (view full) ---

20 * (jj@sunsite.ms.mff.cuni.cz)
21 *
22 * Assorted race fixes, rewrite of ext4_get_block() by Al Viro, 2000
23 */
24
25#include <linux/module.h>
26#include <linux/fs.h>
27#include <linux/time.h>
28#include <linux/ext4_jbd.h>
29#include <linux/jbd.h>
28#include <linux/ext4_jbd2.h>
29#include <linux/jbd2.h>
30#include <linux/smp_lock.h>
31#include <linux/highuid.h>
32#include <linux/pagemap.h>
33#include <linux/quotaops.h>
34#include <linux/string.h>
35#include <linux/buffer_head.h>
36#include <linux/writeback.h>
37#include <linux/mpage.h>

--- 41 unchanged lines hidden (view full) ---

79 /* Never use the revoke function if we are doing full data
80 * journaling: there is no need to, and a V1 superblock won't
81 * support it. Otherwise, only skip the revoke on un-journaled
82 * data blocks. */
83
84 if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA ||
85 (!is_metadata && !ext4_should_journal_data(inode))) {
86 if (bh) {
30#include <linux/smp_lock.h>
31#include <linux/highuid.h>
32#include <linux/pagemap.h>
33#include <linux/quotaops.h>
34#include <linux/string.h>
35#include <linux/buffer_head.h>
36#include <linux/writeback.h>
37#include <linux/mpage.h>

--- 41 unchanged lines hidden (view full) ---

79 /* Never use the revoke function if we are doing full data
80 * journaling: there is no need to, and a V1 superblock won't
81 * support it. Otherwise, only skip the revoke on un-journaled
82 * data blocks. */
83
84 if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA ||
85 (!is_metadata && !ext4_should_journal_data(inode))) {
86 if (bh) {
87 BUFFER_TRACE(bh, "call journal_forget");
87 BUFFER_TRACE(bh, "call jbd2_journal_forget");
88 return ext4_journal_forget(handle, bh);
89 }
90 return 0;
91 }
92
93 /*
94 * data!=journal && (is_metadata || should_journal_data(inode))
95 */

--- 556 unchanged lines hidden (view full) ---

652 if (err)
653 goto failed;
654 }
655 *blks = num;
656 return err;
657failed:
658 /* Allocation failed, free what we already allocated */
659 for (i = 1; i <= n ; i++) {
88 return ext4_journal_forget(handle, bh);
89 }
90 return 0;
91 }
92
93 /*
94 * data!=journal && (is_metadata || should_journal_data(inode))
95 */

--- 556 unchanged lines hidden (view full) ---

652 if (err)
653 goto failed;
654 }
655 *blks = num;
656 return err;
657failed:
658 /* Allocation failed, free what we already allocated */
659 for (i = 1; i <= n ; i++) {
660 BUFFER_TRACE(branch[i].bh, "call journal_forget");
660 BUFFER_TRACE(branch[i].bh, "call jbd2_journal_forget");
661 ext4_journal_forget(handle, branch[i].bh);
662 }
663 for (i = 0; i <indirect_blks; i++)
664 ext4_free_blocks(handle, inode, new_blocks[i], 1);
665
666 ext4_free_blocks(handle, inode, new_blocks[i], num);
667
668 return err;

--- 84 unchanged lines hidden (view full) ---

753 * Inode was dirtied above.
754 */
755 jbd_debug(5, "splicing direct\n");
756 }
757 return err;
758
759err_out:
760 for (i = 1; i <= num; i++) {
661 ext4_journal_forget(handle, branch[i].bh);
662 }
663 for (i = 0; i <indirect_blks; i++)
664 ext4_free_blocks(handle, inode, new_blocks[i], 1);
665
666 ext4_free_blocks(handle, inode, new_blocks[i], num);
667
668 return err;

--- 84 unchanged lines hidden (view full) ---

753 * Inode was dirtied above.
754 */
755 jbd_debug(5, "splicing direct\n");
756 }
757 return err;
758
759err_out:
760 for (i = 1; i <= num; i++) {
761 BUFFER_TRACE(where[i].bh, "call journal_forget");
761 BUFFER_TRACE(where[i].bh, "call jbd2_journal_forget");
762 ext4_journal_forget(handle, where[i].bh);
763 ext4_free_blocks(handle,inode,le32_to_cpu(where[i-1].key),1);
764 }
765 ext4_free_blocks(handle, inode, le32_to_cpu(where[num].key), blks);
766
767 return err;
768}
769

--- 344 unchanged lines hidden (view full) ---

1114 }
1115 return ret;
1116}
1117
1118/*
1119 * To preserve ordering, it is essential that the hole instantiation and
1120 * the data write be encapsulated in a single transaction. We cannot
1121 * close off a transaction and start a new one between the ext4_get_block()
762 ext4_journal_forget(handle, where[i].bh);
763 ext4_free_blocks(handle,inode,le32_to_cpu(where[i-1].key),1);
764 }
765 ext4_free_blocks(handle, inode, le32_to_cpu(where[num].key), blks);
766
767 return err;
768}
769

--- 344 unchanged lines hidden (view full) ---

1114 }
1115 return ret;
1116}
1117
1118/*
1119 * To preserve ordering, it is essential that the hole instantiation and
1120 * the data write be encapsulated in a single transaction. We cannot
1121 * close off a transaction and start a new one between the ext4_get_block()
1122 * and the commit_write(). So doing the journal_start at the start of
1122 * and the commit_write(). So doing the jbd2_journal_start at the start of
1123 * prepare_write() is the right place.
1124 *
1125 * Also, this function can nest inside ext4_writepage() ->
1126 * block_write_full_page(). In that case, we *know* that ext4_writepage()
1127 * has generated enough buffer credits to do the whole page. So we won't
1128 * block on the journal in that case, which is good, because the caller may
1129 * be PF_MEMALLOC.
1130 *
1131 * By accident, ext4 can be reentered when a transaction is open via
1132 * quota file writes. If we were to commit the transaction while thus
1133 * reentered, there can be a deadlock - we would be holding a quota
1134 * lock, and the commit would never complete if another thread had a
1135 * transaction open and was blocking on the quota lock - a ranking
1136 * violation.
1137 *
1123 * prepare_write() is the right place.
1124 *
1125 * Also, this function can nest inside ext4_writepage() ->
1126 * block_write_full_page(). In that case, we *know* that ext4_writepage()
1127 * has generated enough buffer credits to do the whole page. So we won't
1128 * block on the journal in that case, which is good, because the caller may
1129 * be PF_MEMALLOC.
1130 *
1131 * By accident, ext4 can be reentered when a transaction is open via
1132 * quota file writes. If we were to commit the transaction while thus
1133 * reentered, there can be a deadlock - we would be holding a quota
1134 * lock, and the commit would never complete if another thread had a
1135 * transaction open and was blocking on the quota lock - a ranking
1136 * violation.
1137 *
1138 * So what we do is to rely on the fact that journal_stop/journal_start
1138 * So what we do is to rely on the fact that jbd2_journal_stop/journal_start
1139 * will _not_ run commit under these circumstances because handle->h_ref
1140 * is elevated. We'll still have enough credits for the tiny quotafile
1141 * write.
1142 */
1143static int do_journal_get_write_access(handle_t *handle,
1144 struct buffer_head *bh)
1145{
1146 if (!buffer_mapped(bh) || buffer_freed(bh))

--- 32 unchanged lines hidden (view full) ---

1179 if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries))
1180 goto retry;
1181out:
1182 return ret;
1183}
1184
1185int ext4_journal_dirty_data(handle_t *handle, struct buffer_head *bh)
1186{
1139 * will _not_ run commit under these circumstances because handle->h_ref
1140 * is elevated. We'll still have enough credits for the tiny quotafile
1141 * write.
1142 */
1143static int do_journal_get_write_access(handle_t *handle,
1144 struct buffer_head *bh)
1145{
1146 if (!buffer_mapped(bh) || buffer_freed(bh))

--- 32 unchanged lines hidden (view full) ---

1179 if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries))
1180 goto retry;
1181out:
1182 return ret;
1183}
1184
1185int ext4_journal_dirty_data(handle_t *handle, struct buffer_head *bh)
1186{
1187 int err = journal_dirty_data(handle, bh);
1187 int err = jbd2_journal_dirty_data(handle, bh);
1188 if (err)
1189 ext4_journal_abort_handle(__FUNCTION__, __FUNCTION__,
1190 bh, handle,err);
1191 return err;
1192}
1193
1194/* For commit_write() in data=journal mode */
1195static int commit_write_fn(handle_t *handle, struct buffer_head *bh)

--- 132 unchanged lines hidden (view full) ---

1328 * regular files. If somebody wants to bmap a directory
1329 * or symlink and gets confused because the buffer
1330 * hasn't yet been flushed to disk, they deserve
1331 * everything they get.
1332 */
1333
1334 EXT4_I(inode)->i_state &= ~EXT4_STATE_JDATA;
1335 journal = EXT4_JOURNAL(inode);
1188 if (err)
1189 ext4_journal_abort_handle(__FUNCTION__, __FUNCTION__,
1190 bh, handle,err);
1191 return err;
1192}
1193
1194/* For commit_write() in data=journal mode */
1195static int commit_write_fn(handle_t *handle, struct buffer_head *bh)

--- 132 unchanged lines hidden (view full) ---

1328 * regular files. If somebody wants to bmap a directory
1329 * or symlink and gets confused because the buffer
1330 * hasn't yet been flushed to disk, they deserve
1331 * everything they get.
1332 */
1333
1334 EXT4_I(inode)->i_state &= ~EXT4_STATE_JDATA;
1335 journal = EXT4_JOURNAL(inode);
1336 journal_lock_updates(journal);
1337 err = journal_flush(journal);
1338 journal_unlock_updates(journal);
1336 jbd2_journal_lock_updates(journal);
1337 err = jbd2_journal_flush(journal);
1338 jbd2_journal_unlock_updates(journal);
1339
1340 if (err)
1341 return 0;
1342 }
1343
1344 return generic_block_bmap(mapping,block,ext4_get_block);
1345}
1346

--- 4 unchanged lines hidden (view full) ---

1351}
1352
1353static int bput_one(handle_t *handle, struct buffer_head *bh)
1354{
1355 put_bh(bh);
1356 return 0;
1357}
1358
1339
1340 if (err)
1341 return 0;
1342 }
1343
1344 return generic_block_bmap(mapping,block,ext4_get_block);
1345}
1346

--- 4 unchanged lines hidden (view full) ---

1351}
1352
1353static int bput_one(handle_t *handle, struct buffer_head *bh)
1354{
1355 put_bh(bh);
1356 return 0;
1357}
1358
1359static int journal_dirty_data_fn(handle_t *handle, struct buffer_head *bh)
1359static int jbd2_journal_dirty_data_fn(handle_t *handle, struct buffer_head *bh)
1360{
1361 if (buffer_mapped(bh))
1362 return ext4_journal_dirty_data(handle, bh);
1363 return 0;
1364}
1365
1366/*
1367 * Note that we always start a transaction even if we're not journalling

--- 91 unchanged lines hidden (view full) ---

1459
1460 /*
1461 * And attach them to the current transaction. But only if
1462 * block_write_full_page() succeeded. Otherwise they are unmapped,
1463 * and generally junk.
1464 */
1465 if (ret == 0) {
1466 err = walk_page_buffers(handle, page_bufs, 0, PAGE_CACHE_SIZE,
1360{
1361 if (buffer_mapped(bh))
1362 return ext4_journal_dirty_data(handle, bh);
1363 return 0;
1364}
1365
1366/*
1367 * Note that we always start a transaction even if we're not journalling

--- 91 unchanged lines hidden (view full) ---

1459
1460 /*
1461 * And attach them to the current transaction. But only if
1462 * block_write_full_page() succeeded. Otherwise they are unmapped,
1463 * and generally junk.
1464 */
1465 if (ret == 0) {
1466 err = walk_page_buffers(handle, page_bufs, 0, PAGE_CACHE_SIZE,
1467 NULL, journal_dirty_data_fn);
1467 NULL, jbd2_journal_dirty_data_fn);
1468 if (!ret)
1469 ret = err;
1470 }
1471 walk_page_buffers(handle, page_bufs, 0,
1472 PAGE_CACHE_SIZE, NULL, bput_one);
1473 err = ext4_journal_stop(handle);
1474 if (!ret)
1475 ret = err;

--- 114 unchanged lines hidden (view full) ---

1590 journal_t *journal = EXT4_JOURNAL(page->mapping->host);
1591
1592 /*
1593 * If it's a full truncate we just forget about the pending dirtying
1594 */
1595 if (offset == 0)
1596 ClearPageChecked(page);
1597
1468 if (!ret)
1469 ret = err;
1470 }
1471 walk_page_buffers(handle, page_bufs, 0,
1472 PAGE_CACHE_SIZE, NULL, bput_one);
1473 err = ext4_journal_stop(handle);
1474 if (!ret)
1475 ret = err;

--- 114 unchanged lines hidden (view full) ---

1590 journal_t *journal = EXT4_JOURNAL(page->mapping->host);
1591
1592 /*
1593 * If it's a full truncate we just forget about the pending dirtying
1594 */
1595 if (offset == 0)
1596 ClearPageChecked(page);
1597
1598 journal_invalidatepage(journal, page, offset);
1598 jbd2_journal_invalidatepage(journal, page, offset);
1599}
1600
1601static int ext4_releasepage(struct page *page, gfp_t wait)
1602{
1603 journal_t *journal = EXT4_JOURNAL(page->mapping->host);
1604
1605 WARN_ON(PageChecked(page));
1606 if (!page_has_buffers(page))
1607 return 0;
1599}
1600
1601static int ext4_releasepage(struct page *page, gfp_t wait)
1602{
1603 journal_t *journal = EXT4_JOURNAL(page->mapping->host);
1604
1605 WARN_ON(PageChecked(page));
1606 if (!page_has_buffers(page))
1607 return 0;
1608 return journal_try_to_free_buffers(journal, page, wait);
1608 return jbd2_journal_try_to_free_buffers(journal, page, wait);
1609}
1610
1611/*
1612 * If the O_DIRECT write will extend the file then add this inode to the
1613 * orphan list. So recovery will truncate it back to the original size
1614 * if the machine crashes during the write.
1615 *
1616 * If the O_DIRECT write is intantiating holes inside i_size and the machine

--- 360 unchanged lines hidden (view full) ---

1977 if (bh) {
1978 BUFFER_TRACE(bh, "retaking write access");
1979 ext4_journal_get_write_access(handle, bh);
1980 }
1981 }
1982
1983 /*
1984 * Any buffers which are on the journal will be in memory. We find
1609}
1610
1611/*
1612 * If the O_DIRECT write will extend the file then add this inode to the
1613 * orphan list. So recovery will truncate it back to the original size
1614 * if the machine crashes during the write.
1615 *
1616 * If the O_DIRECT write is intantiating holes inside i_size and the machine

--- 360 unchanged lines hidden (view full) ---

1977 if (bh) {
1978 BUFFER_TRACE(bh, "retaking write access");
1979 ext4_journal_get_write_access(handle, bh);
1980 }
1981 }
1982
1983 /*
1984 * Any buffers which are on the journal will be in memory. We find
1985 * them on the hash table so journal_revoke() will run journal_forget()
1985 * them on the hash table so jbd2_journal_revoke() will run jbd2_journal_forget()
1986 * on them. We've already detached each block from the file, so
1986 * on them. We've already detached each block from the file, so
1987 * bforget() in journal_forget() should be safe.
1987 * bforget() in jbd2_journal_forget() should be safe.
1988 *
1988 *
1989 * AKPM: turn on bforget in journal_forget()!!!
1989 * AKPM: turn on bforget in jbd2_journal_forget()!!!
1990 */
1991 for (p = first; p < last; p++) {
1992 u32 nr = le32_to_cpu(*p);
1993 if (nr) {
1994 struct buffer_head *bh;
1995
1996 *p = 0;
1997 bh = sb_find_get_block(inode->i_sb, nr);

--- 129 unchanged lines hidden (view full) ---

2127 (__le32*)bh->b_data,
2128 (__le32*)bh->b_data + addr_per_block,
2129 depth);
2130
2131 /*
2132 * We've probably journalled the indirect block several
2133 * times during the truncate. But it's no longer
2134 * needed and we now drop it from the transaction via
1990 */
1991 for (p = first; p < last; p++) {
1992 u32 nr = le32_to_cpu(*p);
1993 if (nr) {
1994 struct buffer_head *bh;
1995
1996 *p = 0;
1997 bh = sb_find_get_block(inode->i_sb, nr);

--- 129 unchanged lines hidden (view full) ---

2127 (__le32*)bh->b_data,
2128 (__le32*)bh->b_data + addr_per_block,
2129 depth);
2130
2131 /*
2132 * We've probably journalled the indirect block several
2133 * times during the truncate. But it's no longer
2134 * needed and we now drop it from the transaction via
2135 * journal_revoke().
2135 * jbd2_journal_revoke().
2136 *
2137 * That's easy if it's exclusively part of this
2138 * transaction. But if it's part of the committing
2136 *
2137 * That's easy if it's exclusively part of this
2138 * transaction. But if it's part of the committing
2139 * transaction then journal_forget() will simply
2139 * transaction then jbd2_journal_forget() will simply
2140 * brelse() it. That means that if the underlying
2141 * block is reallocated in ext4_get_block(),
2142 * unmap_underlying_metadata() will find this block
2143 * and will try to get rid of it. damn, damn.
2144 *
2145 * If this block has already been committed to the
2146 * journal, a revoke record will be written. And
2147 * revoke records must be emitted *before* clearing

--- 98 unchanged lines hidden (view full) ---

2246 return;
2247 if (ext4_inode_is_fast_symlink(inode))
2248 return;
2249 if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
2250 return;
2251
2252 /*
2253 * We have to lock the EOF page here, because lock_page() nests
2140 * brelse() it. That means that if the underlying
2141 * block is reallocated in ext4_get_block(),
2142 * unmap_underlying_metadata() will find this block
2143 * and will try to get rid of it. damn, damn.
2144 *
2145 * If this block has already been committed to the
2146 * journal, a revoke record will be written. And
2147 * revoke records must be emitted *before* clearing

--- 98 unchanged lines hidden (view full) ---

2246 return;
2247 if (ext4_inode_is_fast_symlink(inode))
2248 return;
2249 if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
2250 return;
2251
2252 /*
2253 * We have to lock the EOF page here, because lock_page() nests
2254 * outside journal_start().
2254 * outside jbd2_journal_start().
2255 */
2256 if ((inode->i_size & (blocksize - 1)) == 0) {
2257 /* Block boundary? Nothing to do */
2258 page = NULL;
2259 } else {
2260 page = grab_cache_page(mapping,
2261 inode->i_size >> PAGE_CACHE_SHIFT);
2262 if (!page)

--- 767 unchanged lines hidden (view full) ---

3030int ext4_mark_iloc_dirty(handle_t *handle,
3031 struct inode *inode, struct ext4_iloc *iloc)
3032{
3033 int err = 0;
3034
3035 /* the do_update_inode consumes one bh->b_count */
3036 get_bh(iloc->bh);
3037
2255 */
2256 if ((inode->i_size & (blocksize - 1)) == 0) {
2257 /* Block boundary? Nothing to do */
2258 page = NULL;
2259 } else {
2260 page = grab_cache_page(mapping,
2261 inode->i_size >> PAGE_CACHE_SHIFT);
2262 if (!page)

--- 767 unchanged lines hidden (view full) ---

3030int ext4_mark_iloc_dirty(handle_t *handle,
3031 struct inode *inode, struct ext4_iloc *iloc)
3032{
3033 int err = 0;
3034
3035 /* the do_update_inode consumes one bh->b_count */
3036 get_bh(iloc->bh);
3037
3038 /* ext4_do_update_inode() does journal_dirty_metadata */
3038 /* ext4_do_update_inode() does jbd2_journal_dirty_metadata */
3039 err = ext4_do_update_inode(handle, inode, iloc);
3040 put_bh(iloc->bh);
3041 return err;
3042}
3043
3044/*
3045 * On success, We end up with an outstanding reference count against
3046 * iloc->bh. This _must_ be cleaned up later.

--- 101 unchanged lines hidden (view full) ---

3148{
3149 struct ext4_iloc iloc;
3150
3151 int err = 0;
3152 if (handle) {
3153 err = ext4_get_inode_loc(inode, &iloc);
3154 if (!err) {
3155 BUFFER_TRACE(iloc.bh, "get_write_access");
3039 err = ext4_do_update_inode(handle, inode, iloc);
3040 put_bh(iloc->bh);
3041 return err;
3042}
3043
3044/*
3045 * On success, We end up with an outstanding reference count against
3046 * iloc->bh. This _must_ be cleaned up later.

--- 101 unchanged lines hidden (view full) ---

3148{
3149 struct ext4_iloc iloc;
3150
3151 int err = 0;
3152 if (handle) {
3153 err = ext4_get_inode_loc(inode, &iloc);
3154 if (!err) {
3155 BUFFER_TRACE(iloc.bh, "get_write_access");
3156 err = journal_get_write_access(handle, iloc.bh);
3156 err = jbd2_journal_get_write_access(handle, iloc.bh);
3157 if (!err)
3158 err = ext4_journal_dirty_metadata(handle,
3159 iloc.bh);
3160 brelse(iloc.bh);
3161 }
3162 }
3163 ext4_std_error(inode->i_sb, err);
3164 return err;

--- 15 unchanged lines hidden (view full) ---

3180 * So, first we make sure that the journal is empty and that
3181 * nobody is changing anything.
3182 */
3183
3184 journal = EXT4_JOURNAL(inode);
3185 if (is_journal_aborted(journal) || IS_RDONLY(inode))
3186 return -EROFS;
3187
3157 if (!err)
3158 err = ext4_journal_dirty_metadata(handle,
3159 iloc.bh);
3160 brelse(iloc.bh);
3161 }
3162 }
3163 ext4_std_error(inode->i_sb, err);
3164 return err;

--- 15 unchanged lines hidden (view full) ---

3180 * So, first we make sure that the journal is empty and that
3181 * nobody is changing anything.
3182 */
3183
3184 journal = EXT4_JOURNAL(inode);
3185 if (is_journal_aborted(journal) || IS_RDONLY(inode))
3186 return -EROFS;
3187
3188 journal_lock_updates(journal);
3189 journal_flush(journal);
3188 jbd2_journal_lock_updates(journal);
3189 jbd2_journal_flush(journal);
3190
3191 /*
3192 * OK, there are no updates running now, and all cached data is
3193 * synced to disk. We are now in a completely consistent state
3194 * which doesn't have anything in the journal, and we know that
3195 * no filesystem updates are running, so it is safe to modify
3196 * the inode's in-core data-journaling state flag now.
3197 */
3198
3199 if (val)
3200 EXT4_I(inode)->i_flags |= EXT4_JOURNAL_DATA_FL;
3201 else
3202 EXT4_I(inode)->i_flags &= ~EXT4_JOURNAL_DATA_FL;
3203 ext4_set_aops(inode);
3204
3190
3191 /*
3192 * OK, there are no updates running now, and all cached data is
3193 * synced to disk. We are now in a completely consistent state
3194 * which doesn't have anything in the journal, and we know that
3195 * no filesystem updates are running, so it is safe to modify
3196 * the inode's in-core data-journaling state flag now.
3197 */
3198
3199 if (val)
3200 EXT4_I(inode)->i_flags |= EXT4_JOURNAL_DATA_FL;
3201 else
3202 EXT4_I(inode)->i_flags &= ~EXT4_JOURNAL_DATA_FL;
3203 ext4_set_aops(inode);
3204
3205 journal_unlock_updates(journal);
3205 jbd2_journal_unlock_updates(journal);
3206
3207 /* Finally we can mark the inode as dirty. */
3208
3209 handle = ext4_journal_start(inode, 1);
3210 if (IS_ERR(handle))
3211 return PTR_ERR(handle);
3212
3213 err = ext4_mark_inode_dirty(handle, inode);
3214 handle->h_sync = 1;
3215 ext4_journal_stop(handle);
3216 ext4_std_error(inode->i_sb, err);
3217
3218 return err;
3219}
3206
3207 /* Finally we can mark the inode as dirty. */
3208
3209 handle = ext4_journal_start(inode, 1);
3210 if (IS_ERR(handle))
3211 return PTR_ERR(handle);
3212
3213 err = ext4_mark_inode_dirty(handle, inode);
3214 handle->h_sync = 1;
3215 ext4_journal_stop(handle);
3216 ext4_std_error(inode->i_sb, err);
3217
3218 return err;
3219}