Commit 1fd4033d authored by Nikolay Borisov's avatar Nikolay Borisov Committed by David Sterba

btrfs: rename BTRFS_INODE_ORDERED_DATA_CLOSE flag

Commit 8d875f95 ("btrfs: disable strict file flushes for
renames and truncates") eliminated the notion of ordered operations and
instead BTRFS_INODE_ORDERED_DATA_CLOSE only remained as a flag
indicating that a file's content should be synced to disk in case a
file is truncated and any writes happen to it concurrently. In fact
this intendend behavior was broken until it was fixed in
f6dc45c7 ("Btrfs: fix filemap_flush call in btrfs_file_release").

All things considered let's give the flag a more descriptive name. Also
slightly reword comments.
Signed-off-by: default avatarNikolay Borisov <nborisov@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 8d1a7aae
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
* new data the application may have written before commit. * new data the application may have written before commit.
*/ */
enum { enum {
BTRFS_INODE_ORDERED_DATA_CLOSE, BTRFS_INODE_FLUSH_ON_CLOSE,
BTRFS_INODE_DUMMY, BTRFS_INODE_DUMMY,
BTRFS_INODE_IN_DEFRAG, BTRFS_INODE_IN_DEFRAG,
BTRFS_INODE_HAS_ASYNC_EXTENT, BTRFS_INODE_HAS_ASYNC_EXTENT,
......
...@@ -2091,12 +2091,12 @@ int btrfs_release_file(struct inode *inode, struct file *filp) ...@@ -2091,12 +2091,12 @@ int btrfs_release_file(struct inode *inode, struct file *filp)
filp->private_data = NULL; filp->private_data = NULL;
/* /*
* ordered_data_close is set by setattr when we are about to truncate * Set by setattr when we are about to truncate a file from a non-zero
* a file from a non-zero size to a zero size. This tries to * size to a zero size. This tries to flush down new bytes that may
* flush down new bytes that may have been written if the * have been written if the application were using truncate to replace
* application were using truncate to replace a file in place. * a file in place.
*/ */
if (test_and_clear_bit(BTRFS_INODE_ORDERED_DATA_CLOSE, if (test_and_clear_bit(BTRFS_INODE_FLUSH_ON_CLOSE,
&BTRFS_I(inode)->runtime_flags)) &BTRFS_I(inode)->runtime_flags))
filemap_flush(inode->i_mapping); filemap_flush(inode->i_mapping);
return 0; return 0;
......
...@@ -4835,11 +4835,11 @@ static int btrfs_setsize(struct inode *inode, struct iattr *attr) ...@@ -4835,11 +4835,11 @@ static int btrfs_setsize(struct inode *inode, struct iattr *attr)
/* /*
* We're truncating a file that used to have good data down to * We're truncating a file that used to have good data down to
* zero. Make sure it gets into the ordered flush list so that * zero. Make sure any new writes to the file get on disk
* any new writes get down to disk quickly. * on close.
*/ */
if (newsize == 0) if (newsize == 0)
set_bit(BTRFS_INODE_ORDERED_DATA_CLOSE, set_bit(BTRFS_INODE_FLUSH_ON_CLOSE,
&BTRFS_I(inode)->runtime_flags); &BTRFS_I(inode)->runtime_flags);
truncate_setsize(inode, newsize); truncate_setsize(inode, newsize);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment