From patchwork Tue Mar 24 10:51:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Chinner X-Patchwork-Id: 6078051 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0C7E69F399 for ; Tue, 24 Mar 2015 10:51:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4C438201CD for ; Tue, 24 Mar 2015 10:51:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 236CD20212 for ; Tue, 24 Mar 2015 10:51:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752455AbbCXKvX (ORCPT ); Tue, 24 Mar 2015 06:51:23 -0400 Received: from ipmail04.adl6.internode.on.net ([150.101.137.141]:27601 "EHLO ipmail04.adl6.internode.on.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752342AbbCXKvT (ORCPT ); Tue, 24 Mar 2015 06:51:19 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2APCQBkQBFVPAYQLHlcgwOBLIY9rG0BAQEBAQaaSU0BAQEBAQEGAQEBATg7hBUBBScvIxAIGDE5AwcUGYguySGGDYkmgQGEFwWua4FnAYI8KjGBAoFBAQEB Received: from ppp121-44-16-6.lns20.syd4.internode.on.net (HELO dastard) ([121.44.16.6]) by ipmail04.adl6.internode.on.net with ESMTP; 24 Mar 2015 21:21:14 +1030 Received: from disappointment.disaster.area ([192.168.1.110] helo=disappointment) by dastard with esmtp (Exim 4.80) (envelope-from ) id 1YaMQS-0002qG-J0; Tue, 24 Mar 2015 21:51:12 +1100 Received: from dave by disappointment with local (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1YaMQS-0000n8-Hg; Tue, 24 Mar 2015 21:51:12 +1100 From: Dave Chinner To: xfs@oss.sgi.com Cc: linux-fsdevel@vger.kernel.org, willy@linux.intel.com, jack@suse.cz Subject: [PATCH 6/8] xfs: add DAX truncate support Date: Tue, 24 Mar 2015 21:51:04 +1100 Message-Id: <1427194266-2885-7-git-send-email-david@fromorbit.com> X-Mailer: git-send-email 2.0.0 In-Reply-To: <1427194266-2885-1-git-send-email-david@fromorbit.com> References: <1427194266-2885-1-git-send-email-david@fromorbit.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@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 From: Dave Chinner When we truncate a DAX file, we need to call through the DAX page truncation path rather than through block_truncate_page() so that mappings and block zeroing are all handled correctly. Otherwise, truncate does not need to change. Signed-off-by: Dave Chinner Reviewed-by: Brian Foster --- fs/xfs/xfs_iops.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index 8b9e688..9ca5352 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -851,7 +851,11 @@ xfs_setattr_size( * to hope that the caller sees ENOMEM and retries the truncate * operation. */ - error = block_truncate_page(inode->i_mapping, newsize, xfs_get_blocks); + if (IS_DAX(inode)) + error = dax_truncate_page(inode, newsize, xfs_get_blocks_dax); + else + error = block_truncate_page(inode->i_mapping, newsize, + xfs_get_blocks); if (error) return error; truncate_setsize(inode, newsize);