Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2340788imm; Thu, 9 Aug 2018 11:09:34 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzQum3D4UNycwqG74d/WWS3jq733PRB6RSKKEqbocNPooK7d3e4w24KPiPqKZET04oNVnkH X-Received: by 2002:a63:de4c:: with SMTP id y12-v6mr3109351pgi.435.1533838174750; Thu, 09 Aug 2018 11:09:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533838174; cv=none; d=google.com; s=arc-20160816; b=NJH1qFCh3AHF6u2C0uGYuHq/vvxKGGujpf09DiYz0yFNCvn0UUJd4sRxJEFo36Qh2Q fJCFLJpVYGt30xB7UBI7ZtWMm4Cxo+h/fpB9PYKSgoO2xYaAwJlLt7i12Wi29p4SVh/N IRpaQziJsbb/SaU9Qq++hcAPohvK/cog9fCka7lU2SZPwrhyZgiYbw8mfVg+w82dXd9C pS4AZhzuYaZOraZkzF+3aN6a9uJV78aXy8Nv6d8UbcelOecp7FCi3mbVPgHIzOuv/G5a UZblQ/DQwDi9nS856DUlVeAGWtNtNF5REVvVMdtguJ9Ww3xlJNk949zLxWKbK0ItuYwH AsCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=th2DL5AhDXI5K/RU49B+KPIKtEk+BoJ2NCXW6+0Iepo=; b=n8jgPcDL9SzR2Iam1Zv9+BbFjDLitbC3nMTndCROeGU5s3D697rwsUmdmxi9MzvQAn uKxK1+3l3mvJ2fGy5Kh/JsE0xoXBK+tV3hoHNBVkO/YYowCPtIibfNgGa1QSzZbaHPQW 5cykIwhzofoUlMcPC+3d7uvIBwRLaMpkOk32GmUs+yfh6w70LCd8tVhprmH7qlr0JRN2 OlTd29YfgdqrIZd+s+WReD0kYJREy7AxCnqjfJ8LhA9ouJ2L2Z8+Dup3qej7pb61wM4o LMmiSdv8Xv8w8fcQI5j0siQxaSuE6heNESql4XC565PjW+1hmCcDUUa5BhgnCIvpbuYd idXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=iQJqXaeL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z4-v6si6073074plk.490.2018.08.09.11.09.20; Thu, 09 Aug 2018 11:09:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=iQJqXaeL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727280AbeHIUcA (ORCPT + 99 others); Thu, 9 Aug 2018 16:32:00 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:43644 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726944AbeHIUb7 (ORCPT ); Thu, 9 Aug 2018 16:31:59 -0400 Received: by mail-pg1-f193.google.com with SMTP id a14-v6so3096035pgv.10; Thu, 09 Aug 2018 11:06:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=th2DL5AhDXI5K/RU49B+KPIKtEk+BoJ2NCXW6+0Iepo=; b=iQJqXaeLIhka/DlpPwd2wv1DhmxZlQGpNNu5gBeW+CnKKKhIRTC1dF3sMe2g9W1sbD YgfphpEXrFq+BUAJBm57L/gYwnZJ9BoN0T1+bmIS9NosNKfmOB2JLQJPmgt79URYIFqX SsB2H+XhLxIDjGjgaH0vHVEQhWgFHNAhr47SPQ0FyFMgyj/HROjLTrG6BxfDYpj4n7tp q/rgeatM/EK6Ahh+dmjFhJLcFBIWNIHGmTv3Vly9yLcIV2ffoZfS8eECYljhNdY4PigB DLjlYei3n4GZeKSNfivGv+uipTugYHabMjoo/Ee2MlZhrJGLDhJVgptHllpeyuEMCF3E 0DTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=th2DL5AhDXI5K/RU49B+KPIKtEk+BoJ2NCXW6+0Iepo=; b=CW+AvIUgm9iuKSObCaU2JgJ1L0FyUU8gvtDbY2Dll0yEd2er6posT3omv63Ker4dMB xk324iSGIFAU+glNeTuGhuhUnHQqQFYWGXt9rSFPN5AjAoC6xnvoqI307u7L7CPHLPEd bNp9yG6DVAtVDBRMZZ5T47eNqBFVcsffkP7ze4NzhPrPIFWnj0GwZgO/IG1euMc3WyV1 klkb8Ksr6KmBqoexikkiiIsmSeYSCI6Maw2LnzDZd70xNwKRlzkB+GWFiLK7hb4WagS8 PogeYXd7e5QmZ4cTJyGi/0JPU1cIJ7cj749UzYWOOlaqq7DMfMDivYyIC61tRdB6nZTN 2ENw== X-Gm-Message-State: AOUpUlEx7plL8RT5FYGlUxvqsGIFA1rFPIdW38vFIbEANWxJmlMeHPbc fTkOE5rnBTGsIEZMs/VEjfk= X-Received: by 2002:a63:8a41:: with SMTP id y62-v6mr3050315pgd.291.1533837960238; Thu, 09 Aug 2018 11:06:00 -0700 (PDT) Received: from localhost (h101-111-148-072.catv02.itscom.jp. [101.111.148.72]) by smtp.gmail.com with ESMTPSA id z184-v6sm10354622pgd.83.2018.08.09.11.05.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Aug 2018 11:05:59 -0700 (PDT) From: Naohiro Aota To: David Sterba , linux-btrfs@vger.kernel.org Cc: Chris Mason , Josef Bacik , linux-kernel@vger.kernel.org, Hannes Reinecke , Damien Le Moal , Bart Van Assche , Matias Bjorling , Naohiro Aota Subject: [RFC PATCH 05/17] btrfs: disable fallocate in HMZONED mode Date: Fri, 10 Aug 2018 03:04:38 +0900 Message-Id: <20180809180450.5091-6-naota@elisp.net> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180809180450.5091-1-naota@elisp.net> References: <20180809180450.5091-1-naota@elisp.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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. 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 095f0bb86bb7..6f4546ccb57d 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -2993,6 +2993,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.18.0