From patchwork Wed May 29 01:55:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Bo X-Patchwork-Id: 2627481 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 C911F40077 for ; Wed, 29 May 2013 01:56:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934839Ab3E2B4u (ORCPT ); Tue, 28 May 2013 21:56:50 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:31466 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934826Ab3E2B4t (ORCPT ); Tue, 28 May 2013 21:56:49 -0400 Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r4T1uj3f006308 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 29 May 2013 01:56:46 GMT Received: from userz7021.oracle.com (userz7021.oracle.com [156.151.31.85]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r4T1uiuV019069 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Wed, 29 May 2013 01:56:45 GMT Received: from abhmt104.oracle.com (abhmt104.oracle.com [141.146.116.56]) by userz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r4T1uiOn018567; Wed, 29 May 2013 01:56:44 GMT Received: from liubo (/153.135.240.155) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 28 May 2013 18:56:43 -0700 Date: Wed, 29 May 2013 10:55:11 +0900 From: Liu Bo To: Kyle Gates Cc: dsterba@suse.cz, linux-btrfs@vger.kernel.org Subject: Re: nocow 'C' flag ignored after balance Message-ID: <20130529015510.GA6571@liubo> Reply-To: bo.li.liu@oracle.com References: <20130510051500.GB5615@liubo.jp.oracle.com> <20130517070443.GN20202@liubo.jp.oracle.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: acsinet21.oracle.com [141.146.126.237] Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On Tue, May 28, 2013 at 09:22:11AM -0500, Kyle Gates wrote: > >From: Liu Bo > > > >Subject: [PATCH] Btrfs: fix broken nocow after a normal balance > > >[...] > > Sorry for the long wait in replying. > This patch was unsuccessful in fixing the problem (on my 3.8 Ubuntu > Raring kernel). I can probably try again on a newer version if you > think it will help. > This was my first kernel compile so I patched by hand and waited (10 > hours on my old 32 bit single core machine). > > I did move some of the files off and back on to the filesystem to > start fresh and compare but all seem to exhibit the same behavior > after a balance. > Thanks for testing the patch although it didn't help you. Actually I tested it to be sure that it fixed the problems in my reproducer. So anyway can you please apply this debug patch in order to nail it down? thanks, liubo --- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index df472ab..c12a11c 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -2857,8 +2857,12 @@ static noinline int check_committed_ref(struct btrfs_trans_handle *trans, goto out; if (btrfs_extent_generation(leaf, ei) <= - btrfs_root_last_snapshot(&root->root_item)) + btrfs_root_last_snapshot(&root->root_item)) { + printk("extent gen %llu last_snap %llu\n", + btrfs_extent_generation(leaf, ei), + btrfs_root_last_snapshot(&root->root_item)); goto out; + } iref = (struct btrfs_extent_inline_ref *)(ei + 1); if (btrfs_extent_inline_ref_type(leaf, iref) != diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 23c596c..8cad6ee 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -1317,16 +1317,24 @@ next_slot: goto out_check; if (btrfs_file_extent_compression(leaf, fi) || btrfs_file_extent_encryption(leaf, fi) || - btrfs_file_extent_other_encoding(leaf, fi)) + btrfs_file_extent_other_encoding(leaf, fi)) { + printk("special encoding\n"); goto out_check; - if (extent_type == BTRFS_FILE_EXTENT_REG && !force) + } + if (extent_type == BTRFS_FILE_EXTENT_REG && !force) { + printk("BTRFS_FILE_EXTENT_REF\n"); goto out_check; - if (btrfs_extent_readonly(root, disk_bytenr)) + } + if (btrfs_extent_readonly(root, disk_bytenr)) { + printk("ro\n"); goto out_check; + } if (btrfs_cross_ref_exist(trans, root, ino, found_key.offset - - extent_offset, disk_bytenr)) + extent_offset, disk_bytenr)) { + printk("cross ref\n"); goto out_check; + } disk_bytenr += extent_offset; disk_bytenr += cur_offset - found_key.offset; num_bytes = min(end + 1, extent_end) - cur_offset;