From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 249ABC2BCA1 for ; Fri, 7 Jun 2019 13:12:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EE89A208E3 for ; Fri, 7 Jun 2019 13:12:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="nRDRC0+9" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729133AbfFGNL0 (ORCPT ); Fri, 7 Jun 2019 09:11:26 -0400 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:53165 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729052AbfFGNLV (ORCPT ); Fri, 7 Jun 2019 09:11:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1559913081; x=1591449081; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Sceo+E3qPLPcf84lMk/uwJwqo0EhyjB73konNzrUp0U=; b=nRDRC0+9/ZqL7o5LijwfvLGmhVQagD8pC0NoD6oPEaffmrwAiCYoNlum IL9KmCT5L5sCb616+Bf2tlWoAXt22BVNQQ2R/SvlIZ1ogkJrK49xyZGpA 9/eGKX0/w1xoE0ynjvgNPxut+bcDPhWhaMN/ZtolcRGYQoHmJ0QHZT86/ Fu9oXNXTM5/L2o+GTdiGKa5aynekNiOWHiF/SQa4uS7zOo83roERBOHa/ QLCgYmxwFNp4p6jG3mWHHYfOjs8bhhVmOhBPz3mzWQtrm1OoTuYPCIW5d s9LdVQftFPViZVRqesp3pL0ld6A0cFKSOMmwEZWLQQ9xNBez+fiduTB3i A==; X-IronPort-AV: E=Sophos;i="5.63,563,1557158400"; d="scan'208";a="110027777" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 07 Jun 2019 21:11:21 +0800 IronPort-SDR: PgjCzsjCngKeHtkpHB6v/6nAfh2E+la86qnVmyMmonkjaUb3+U1viEfGdnYyn5gPopchosiPRx pmp5ukB/FYPwXAQS7JbBcwc0mk6hK1ORRUlZkDC6JEYb1EuP09qBcZOXvOP21wIlwW30yxTmcW ctoJpHCyNYEZpHFdEbj+g+Mklaj5ZPEsXfYSdgKufl5UnrPWuADnOEX4pcvWuAZ8/dc6ggbx71 2oY2pHlAKCMn6E0z6MB6ZwtWxcMlfytE7US14pamjQH60pVflMcz6rlYd8/CbWe/cDQC2rPo1u yYiZF/h2KGKKr23KW2a38tWf Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 07 Jun 2019 05:48:38 -0700 IronPort-SDR: 5ucARHwTib91o21SkMfarKE2KT4zGnVxo8EVkI21T36K4fSonyOo3Xu5NjiqAVPJrbuMVyiQvP 6iyQaugsHN91BVlRA6GdFB6ryWu9GZeD8KdPC+V2m+s3n7RdMSLpZhUUqMe0mrcC5pM+kzeEFt E/M5VRqrj+cCG4OLKVK9u90ntv3gB8ZLNc22JG9b0XeEN6iA4Ot0G3oeDykf4fjm7mGGTerptv KqX3M0mmEbuxDfUWqbEdDfLCls0DikrDjDTzWtxUnUXEpxusBOjIAZIoEobzh72gh2tvKk9PXr FTc= Received: from naota.dhcp.fujisawa.hgst.com (HELO naota.fujisawa.hgst.com) ([10.149.53.115]) by uls-op-cesaip02.wdc.com with ESMTP; 07 Jun 2019 06:11:19 -0700 From: Naohiro Aota To: linux-btrfs@vger.kernel.org, David Sterba Cc: Chris Mason , Josef Bacik , Qu Wenruo , Nikolay Borisov , linux-kernel@vger.kernel.org, Hannes Reinecke , linux-fsdevel@vger.kernel.org, Damien Le Moal , =?UTF-8?q?Matias=20Bj=C3=B8rling?= , Johannes Thumshirn , Bart Van Assche , Naohiro Aota Subject: [PATCH 04/19] btrfs: disable fallocate in HMZONED mode Date: Fri, 7 Jun 2019 22:10:10 +0900 Message-Id: <20190607131025.31996-5-naohiro.aota@wdc.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190607131025.31996-1-naohiro.aota@wdc.com> References: <20190607131025.31996-1-naohiro.aota@wdc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org fallocate() is implemented by reserving actual extent instead of reservations. This can result in exposing the sequential write constraint of host-managed zoned block devices to the application, which would break the POSIX semantic for the fallocated file. To avoid this, report fallocate() as not supported when in HMZONED mode for now. In the future, we may be able to implement "in-memory" fallocate() in HMZONED mode by utilizing space_info->bytes_may_use or so. Signed-off-by: Naohiro Aota --- fs/btrfs/file.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 89f5be2bfb43..e664b5363697 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -3027,6 +3027,10 @@ static long btrfs_fallocate(struct file *file, int mode, alloc_end = round_up(offset + len, blocksize); cur_offset = alloc_start; + /* Do not allow fallocate in HMZONED mode */ + if (btrfs_fs_incompat(btrfs_sb(inode->i_sb), HMZONED)) + return -EOPNOTSUPP; + /* Make sure we aren't being give some crap mode */ if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE | FALLOC_FL_ZERO_RANGE)) -- 2.21.0