From patchwork Thu Feb 12 14:49:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 5820171 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3287BBF440 for ; Thu, 12 Feb 2015 14:50:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 501CB20218 for ; Thu, 12 Feb 2015 14:50:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8235D201C0 for ; Thu, 12 Feb 2015 14:50:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755824AbbBLOuF (ORCPT ); Thu, 12 Feb 2015 09:50:05 -0500 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:58221 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755806AbbBLOuD (ORCPT ); Thu, 12 Feb 2015 09:50:03 -0500 Received: from pps.filterd (m0004003 [127.0.0.1]) by mx0b-00082601.pphosted.com (8.14.5/8.14.5) with SMTP id t1CEiDdK003696 for ; Thu, 12 Feb 2015 06:50:02 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wit.ai; h=from : to : subject : date : message-id : mime-version : content-type; s=mx2; bh=t3sIoeCI4XDAqVq7nwLVXyCVq9jzj94ummunzus2MaM=; b=wXWZb3rHDLQPHRSk3xWat1lwa24oEWsa9BLKk58YxFIBLCUpfnHndCmITCbJgiShZyws 3TeRBtXJMJl463IXp47iME9tG0Te8krwMkm5lsPR8C1q/uB+9QiApPcm7inFjV/NIPLJ nfEMKErUz1fwPO0QKRxXWld04ifQ9kBTlf77gYZCfvKY/FDUdQAfWpF9y98GdnivS7VS InjhR7jzsWezyqpT1BfspIsSXW9f3AbEifd3NqbqAprDk1qUWK24WL2QlSjl8DVkIhi4 hATljflVD7rFuKKB6AXU134iPGw77H1qhyNQFbYhtAKwSB0L83Johl4pIXT+442vEnoo 2Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fb.com; h=from : to : subject : date : message-id : mime-version : content-type; s=facebook; bh=t3sIoeCI4XDAqVq7nwLVXyCVq9jzj94ummunzus2MaM=; b=LFADaUVV47dmb76w66JOpvjivLzw0EGQPVxK3EEnSW/2KpY6MegAS2KHtiiAgxBnPUkH Kc61WTTenLEckekEBsAeOuH7SvR0s1QG/+nggPLcF+eM1SGYsegcuDnZtooJNJo+qoD0 fVKkD3zcYyQ/3yKWfZVXJeFVA1nKFt0S5o4= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0b-00082601.pphosted.com with ESMTP id 1sgvt7888a-1 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT) for ; Thu, 12 Feb 2015 06:50:02 -0800 Received: from localhost (192.168.57.29) by mail.thefacebook.com (192.168.16.22) with Microsoft SMTP Server (TLS) id 14.3.195.1; Thu, 12 Feb 2015 06:50:00 -0800 From: Josef Bacik To: Subject: [PATCH] Btrfs: add metadump_v2 support to the kernel Date: Thu, 12 Feb 2015 09:49:59 -0500 Message-ID: <1423752599-17850-1-git-send-email-jbacik@fb.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-Originating-IP: [192.168.57.29] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.13.68, 1.0.33, 0.0.0000 definitions=2015-02-12_04:2015-02-12, 2015-02-12, 1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=fb_default_notspam policy=fb_default score=0 kscore.is_bulkscore=5.55111512312578e-17 kscore.compositescore=0 circleOfTrustscore=514.84 compositescore=0.996321851895651 urlsuspect_oldscore=0.996321851895651 suspectscore=1 recipient_domain_to_sender_totalscore=0 phishscore=0 bulkscore=0 kscore.is_spamscore=0 recipient_to_sender_totalscore=0 recipient_domain_to_sender_domain_totalscore=64355 rbsscore=0.996321851895651 spamscore=0 recipient_to_sender_domain_totalscore=0 urlsuspectscore=0.9 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1402240000 definitions=main-1502120148 X-FB-Internal: deliver Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP For newly restored metadumps we can actually mount the fs and use it properly except that the data obviously doesn't match properly. To get around this make us skip csum validation if the metadump_v2 flag is set on the fs, this will allow us to reproduce balance issues with metadumps. Thanks, Signed-off-by: Josef Bacik --- fs/btrfs/ctree.h | 1 + fs/btrfs/inode.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 1675602..bc16147 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -356,6 +356,7 @@ static inline unsigned long btrfs_chunk_item_size(int num_stripes) #define BTRFS_SUPER_FLAG_SEEDING (1ULL << 32) #define BTRFS_SUPER_FLAG_METADUMP (1ULL << 33) +#define BTRFS_SUPER_FLAG_METADUMP_V2 (1ULL << 34) #define BTRFS_BACKREF_REV_MAX 256 #define BTRFS_BACKREF_REV_SHIFT 56 diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 4564975..70d0af8 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -3039,6 +3039,10 @@ static int btrfs_readpage_end_io_hook(struct btrfs_io_bio *io_bio, if (BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM) return 0; + if (btrfs_super_flags(root->fs_info->super_copy) & + BTRFS_SUPER_FLAG_METADUMP_V2) + return 0; + if (root->root_key.objectid == BTRFS_DATA_RELOC_TREE_OBJECTID && test_range_bit(io_tree, start, end, EXTENT_NODATASUM, 1, NULL)) { clear_extent_bits(io_tree, start, end, EXTENT_NODATASUM,