Skip to content

Commit 1fd4033

Browse files
lorddoskiaskdave
authored andcommitted
btrfs: rename BTRFS_INODE_ORDERED_DATA_CLOSE flag
Commit 8d875f9 ("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 f6dc45c ("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: Nikolay Borisov <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 8d1a7aa commit 1fd4033

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

fs/btrfs/btrfs_inode.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* new data the application may have written before commit.
2222
*/
2323
enum {
24-
BTRFS_INODE_ORDERED_DATA_CLOSE,
24+
BTRFS_INODE_FLUSH_ON_CLOSE,
2525
BTRFS_INODE_DUMMY,
2626
BTRFS_INODE_IN_DEFRAG,
2727
BTRFS_INODE_HAS_ASYNC_EXTENT,

fs/btrfs/file.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2091,12 +2091,12 @@ int btrfs_release_file(struct inode *inode, struct file *filp)
20912091
filp->private_data = NULL;
20922092

20932093
/*
2094-
* ordered_data_close is set by setattr when we are about to truncate
2095-
* a file from a non-zero size to a zero size. This tries to
2096-
* flush down new bytes that may have been written if the
2097-
* application were using truncate to replace a file in place.
2094+
* Set by setattr when we are about to truncate a file from a non-zero
2095+
* size to a zero size. This tries to flush down new bytes that may
2096+
* have been written if the application were using truncate to replace
2097+
* a file in place.
20982098
*/
2099-
if (test_and_clear_bit(BTRFS_INODE_ORDERED_DATA_CLOSE,
2099+
if (test_and_clear_bit(BTRFS_INODE_FLUSH_ON_CLOSE,
21002100
&BTRFS_I(inode)->runtime_flags))
21012101
filemap_flush(inode->i_mapping);
21022102
return 0;

fs/btrfs/inode.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4835,11 +4835,11 @@ static int btrfs_setsize(struct inode *inode, struct iattr *attr)
48354835

48364836
/*
48374837
* We're truncating a file that used to have good data down to
4838-
* zero. Make sure it gets into the ordered flush list so that
4839-
* any new writes get down to disk quickly.
4838+
* zero. Make sure any new writes to the file get on disk
4839+
* on close.
48404840
*/
48414841
if (newsize == 0)
4842-
set_bit(BTRFS_INODE_ORDERED_DATA_CLOSE,
4842+
set_bit(BTRFS_INODE_FLUSH_ON_CLOSE,
48434843
&BTRFS_I(inode)->runtime_flags);
48444844

48454845
truncate_setsize(inode, newsize);

0 commit comments

Comments
 (0)