From patchwork Mon May 11 08:08:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 6373951 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 DFB04BEEE5 for ; Mon, 11 May 2015 08:09:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 149242035E for ; Mon, 11 May 2015 08:09:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 228AE2037F for ; Mon, 11 May 2015 08:09:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752752AbbEKIJa (ORCPT ); Mon, 11 May 2015 04:09:30 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:64834 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752302AbbEKIJC (ORCPT ); Mon, 11 May 2015 04:09:02 -0400 X-IronPort-AV: E=Sophos;i="5.04,848,1406563200"; d="scan'208";a="91967348" Received: from unknown (HELO edo.cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 11 May 2015 16:05:04 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (localhost.localdomain [127.0.0.1]) by edo.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id t4B87d7K028757 for ; Mon, 11 May 2015 16:07:39 +0800 Received: from localhost.localdomain (10.167.226.33) by G08CNEXCHPEKD02.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.181.6; Mon, 11 May 2015 16:09:02 +0800 From: Qu Wenruo To: Subject: [PATCH v2 05/13] btrfs-progs: Export write_tree_block(). Date: Mon, 11 May 2015 16:08:46 +0800 Message-ID: <1431331734-11714-6-git-send-email-quwenruo@cn.fujitsu.com> X-Mailer: git-send-email 2.4.0 In-Reply-To: <1431331734-11714-1-git-send-email-quwenruo@cn.fujitsu.com> References: <1431331734-11714-1-git-send-email-quwenruo@cn.fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.226.33] 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.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 Export write_tree_block() function and allow it write extent without transaction. This provides the basis for later uuid change function. Signed-off-by: Qu Wenruo --- v2: None --- disk-io.c | 4 ++-- disk-io.h | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/disk-io.c b/disk-io.c index 0edebfa..2ab2d2e 100644 --- a/disk-io.c +++ b/disk-io.c @@ -372,7 +372,7 @@ int write_and_map_eb(struct btrfs_trans_handle *trans, return 0; } -static int write_tree_block(struct btrfs_trans_handle *trans, +int write_tree_block(struct btrfs_trans_handle *trans, struct btrfs_root *root, struct extent_buffer *eb) { @@ -381,7 +381,7 @@ static int write_tree_block(struct btrfs_trans_handle *trans, BUG(); } - if (!btrfs_buffer_uptodate(eb, trans->transid)) + if (trans && !btrfs_buffer_uptodate(eb, trans->transid)) BUG(); btrfs_set_header_flag(eb, BTRFS_HEADER_FLAG_WRITTEN); diff --git a/disk-io.h b/disk-io.h index e1c2030..c1ab875 100644 --- a/disk-io.h +++ b/disk-io.h @@ -127,6 +127,9 @@ int csum_tree_block_size(struct extent_buffer *buf, u16 csum_sectorsize, int verify); int verify_tree_block_csum_silent(struct extent_buffer *buf, u16 csum_size); int btrfs_read_buffer(struct extent_buffer *buf, u64 parent_transid); +int write_tree_block(struct btrfs_trans_handle *trans, + struct btrfs_root *root, + struct extent_buffer *eb); int write_and_map_eb(struct btrfs_trans_handle *trans, struct btrfs_root *root, struct extent_buffer *eb);