aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorFilipe David Borba Manana <fdmanana@gmail.com>2013-09-16 04:53:28 -0400
committerChris Mason <chris.mason@fusionio.com>2013-11-11 21:49:51 -0500
commitf06becc4119856c984e3beef54aa75538e656c6d (patch)
treebe4cb96d6cec6bccf8c17117e74cb14a0328fddb /fs/btrfs/inode.c
parent69e9c6c6dc87587d8846e447febedefe037c14f8 (diff)
Btrfs: don't store NULL byte in symlink extents
It is not necessary to store the NULL byte in a symlink inline file extent. There's currently no code that requires the NULL byte to be present in the extent. This change also doesn't break file format compatibility nor the send/receive feature. The VFS also doesn't need the NULL byte to be present in the extent, as it reads up to inode->i_size bytes (which already excluded the NULL byte) and sets the NULL byte for us (in fs/namei.c:page_getlink()). So with this change we save 1 byte per symlink file extent (which is always inlined in the btree leaf) without losing backward and forward compatibility. Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com> Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index dfc60aa40332..59b4e2e495ac 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -8339,7 +8339,7 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry,
8339 struct btrfs_file_extent_item *ei; 8339 struct btrfs_file_extent_item *ei;
8340 struct extent_buffer *leaf; 8340 struct extent_buffer *leaf;
8341 8341
8342 name_len = strlen(symname) + 1; 8342 name_len = strlen(symname);
8343 if (name_len > BTRFS_MAX_INLINE_DATA_SIZE(root)) 8343 if (name_len > BTRFS_MAX_INLINE_DATA_SIZE(root))
8344 return -ENAMETOOLONG; 8344 return -ENAMETOOLONG;
8345 8345
@@ -8427,7 +8427,7 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry,
8427 inode->i_mapping->a_ops = &btrfs_symlink_aops; 8427 inode->i_mapping->a_ops = &btrfs_symlink_aops;
8428 inode->i_mapping->backing_dev_info = &root->fs_info->bdi; 8428 inode->i_mapping->backing_dev_info = &root->fs_info->bdi;
8429 inode_set_bytes(inode, name_len); 8429 inode_set_bytes(inode, name_len);
8430 btrfs_i_size_write(inode, name_len - 1); 8430 btrfs_i_size_write(inode, name_len);
8431 err = btrfs_update_inode(trans, root, inode); 8431 err = btrfs_update_inode(trans, root, inode);
8432 if (err) 8432 if (err)
8433 drop_inode = 1; 8433 drop_inode = 1;