diff mbox

Btrfs: overwrite existing csums when logging

Message ID 1356123730-19510-1-git-send-email-jbacik@fusionio.com (mailing list archive)
State New, archived
Headers show

Commit Message

Josef Bacik Dec. 21, 2012, 9:02 p.m. UTC
Users were complaining about the warning in btrfs_log_parent_inode() because
we're returning -EEXIST.  This warning is gone in another patch but it's
still making us commit a transaction when we don't have to.  Basically
because we will log all csums in an ordered extent for an em we have the
chance of logging the same csums multiple times.  Since it's not that big of
a deal just allow csums to be over written in logs and that way we are safe.
This gets rid of the EEXIST and we log like we normally would.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
---
 fs/btrfs/file-item.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
diff mbox

Patch

diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c
index bd38cef..93ddc2e 100644
--- a/fs/btrfs/file-item.c
+++ b/fs/btrfs/file-item.c
@@ -835,6 +835,13 @@  insert:
 	ret = btrfs_insert_empty_item(trans, root, path, &file_key,
 				      ins_size);
 	path->leave_spinning = 0;
+
+	/*
+	 * We can sometimes already have copied a csum into the log, that's ok
+	 * just overwrite it.
+	 */
+	if (root->objectid == BTRFS_TREE_LOG_OBJECTID && ret == -EEXIST)
+		ret = 0;
 	if (ret < 0)
 		goto fail_unlock;
 	if (ret != 0) {