From patchwork Thu Jul 31 17:53:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick X-Patchwork-Id: 4658531 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 65467C0338 for ; Thu, 31 Jul 2014 17:54:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9E331200E5 for ; Thu, 31 Jul 2014 17:54:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0D08420158 for ; Thu, 31 Jul 2014 17:54:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751648AbaGaRxq (ORCPT ); Thu, 31 Jul 2014 13:53:46 -0400 Received: from mail-ig0-f174.google.com ([209.85.213.174]:38986 "EHLO mail-ig0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751066AbaGaRxp (ORCPT ); Thu, 31 Jul 2014 13:53:45 -0400 Received: by mail-ig0-f174.google.com with SMTP id c1so26488igq.13 for ; Thu, 31 Jul 2014 10:53:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=x3VNN+7S/eEVTtWKY/aPxW6YWocaQji2WKhBEf/jDnU=; b=FMABCoBwKiAS2ihCikPfkNiSOaX2F6RFSdmAwJFJESYBn1LGLHmwl+9dG4UKyW85+g c8IxP/jRRa4FWE81cbb+686LSLcvXAV6aE7jHbV50OG+kqi0Co3xrW1fIRW4YR0vcnWX CcvnCsjYRCOYy/7+5hn4Mykc5v1Q+iJ23TdzaK0fsr+1dheVFgWqdd9iOKW1q94QSGfH xr149GxYjwmrNM9Bcp+vEjemKiguOTlzy04E9kmjdNh6JLl/n/6lwqqWx+e3W8vUo7JR T0NweeUU6ilLEpiay6LoOzIfYa6y3s2kHlE7B5jp4RC//5i2Fl5NXzfHgE5j7vfR5Do/ j08w== X-Received: by 10.50.73.198 with SMTP id n6mr70609igv.11.1406829224256; Thu, 31 Jul 2014 10:53:44 -0700 (PDT) Received: from crunchbang.phub.net.cable.rogers.com (CPE0026f3330aca-CM0026f3330ac6.cpe.net.cable.rogers.com. [99.232.64.167]) by mx.google.com with ESMTPSA id vl4sm200692igb.3.2014.07.31.10.53.43 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 31 Jul 2014 10:53:43 -0700 (PDT) From: Nicholas Krause To: clm@fb.com Cc: jbacik@fb.com, linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] Add support to check for FALLOC_FL_COLLAPSE_RANGE and FALLOC_FL_ZERO_RANGE crap modes Date: Thu, 31 Jul 2014 13:53:33 -0400 Message-Id: <1406829213-4759-1-git-send-email-xerofoify@gmail.com> X-Mailer: git-send-email 1.7.10.4 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 This adds checks for the stated modes as if they are crap we will return error not supported. Signed-off-by: Nicholas Krause --- fs/btrfs/file.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 1f2b99c..599495a 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -2490,7 +2490,8 @@ static long btrfs_fallocate(struct file *file, int mode, alloc_end = round_up(offset + len, blocksize); /* Make sure we aren't being give some crap mode */ - if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE)) + if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE| + FALLOC_FL_COLLAPSE_RANGE | FALLOC_FL_ZERO_RANGE)) return -EOPNOTSUPP; if (mode & FALLOC_FL_PUNCH_HOLE)