linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josef Bacik <jbacik@fusionio.com>
To: <linux-btrfs@vger.kernel.org>
Subject: [PATCH] Btrfs: overwrite existing csums when logging
Date: Fri, 21 Dec 2012 16:02:10 -0500	[thread overview]
Message-ID: <1356123730-19510-1-git-send-email-jbacik@fusionio.com> (raw)

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 --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) {
-- 
1.7.7.6


                 reply	other threads:[~2012-12-21 20:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1356123730-19510-1-git-send-email-jbacik@fusionio.com \
    --to=jbacik@fusionio.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).