From patchwork Fri Dec 21 21:02:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 1904721 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 3C2F73FE37 for ; Fri, 21 Dec 2012 20:55:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752182Ab2LUUzw (ORCPT ); Fri, 21 Dec 2012 15:55:52 -0500 Received: from mx1.fusionio.com ([66.114.96.30]:39117 "EHLO mx1.fusionio.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751738Ab2LUUzv (ORCPT ); Fri, 21 Dec 2012 15:55:51 -0500 X-ASG-Debug-ID: 1356123349-03d6a50cb5e80170001-6jHSXT Received: from mail1.int.fusionio.com (mail1.int.fusionio.com [10.101.1.21]) by mx1.fusionio.com with ESMTP id AjFpPgL1TueFc2GC (version=TLSv1 cipher=AES128-SHA bits=128 verify=NO) for ; Fri, 21 Dec 2012 13:55:49 -0700 (MST) X-Barracuda-Envelope-From: JBacik@fusionio.com Received: from localhost (24.211.209.217) by mail.fusionio.com (10.101.1.19) with Microsoft SMTP Server (TLS) id 8.3.83.0; Fri, 21 Dec 2012 13:55:49 -0700 From: Josef Bacik To: Subject: [PATCH] Btrfs: overwrite existing csums when logging Date: Fri, 21 Dec 2012 16:02:10 -0500 X-ASG-Orig-Subj: [PATCH] Btrfs: overwrite existing csums when logging Message-ID: <1356123730-19510-1-git-send-email-jbacik@fusionio.com> X-Mailer: git-send-email 1.7.7.6 MIME-Version: 1.0 X-Barracuda-Connect: mail1.int.fusionio.com[10.101.1.21] X-Barracuda-Start-Time: 1356123349 X-Barracuda-Encrypted: AES128-SHA X-Barracuda-URL: http://10.101.1.180:8000/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at fusionio.com X-Barracuda-Bayes: INNOCENT GLOBAL 0.0000 1.0000 -2.0210 X-Barracuda-Spam-Score: -2.02 X-Barracuda-Spam-Status: No, SCORE=-2.02 using per-user scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=9.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.2.117681 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org 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 --- 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) {