From patchwork Mon Jan 10 07:22:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 531524 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 351A2C433FE for ; Mon, 10 Jan 2022 07:26:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239724AbiAJH0e (ORCPT ); Mon, 10 Jan 2022 02:26:34 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:56312 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239414AbiAJHZf (ORCPT ); Mon, 10 Jan 2022 02:25:35 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 71A70B8120C; Mon, 10 Jan 2022 07:25:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD293C36AE9; Mon, 10 Jan 2022 07:25:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1641799532; bh=jEWETEhMt/0iaw7aoQt8w5/flIMiRWUMR0HN+YwOJNE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=whjrXTcXUaZl8cksptAaHHLkqbRFcbHxv224urXG75pUbDDe2gMMmaBaEm4ritg5t MouALQP5F88Bua1S0dXJwCFdP9iFGJnymyECeyggEPsbhrZC16rTQ+z1ukCkNeE0C4 cr0s8mv1aoDus0yp/ytQBjnZCcMQk00MpSyRuvLw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kirill Tkhai , "Darrick J. Wong" , "Darrick J. Wong" , Dave Chinner , Eric Sandeen Subject: [PATCH 4.9 09/21] xfs: map unwritten blocks in XFS_IOC_{ALLOC, FREE}SP just like fallocate Date: Mon, 10 Jan 2022 08:22:56 +0100 Message-Id: <20220110071813.117424262@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220110071812.806606886@linuxfoundation.org> References: <20220110071812.806606886@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Darrick J. Wong commit 983d8e60f50806f90534cc5373d0ce867e5aaf79 upstream. The old ALLOCSP/FREESP ioctls in XFS can be used to preallocate space at the end of files, just like fallocate and RESVSP. Make the behavior consistent with the other ioctls. Reported-by: Kirill Tkhai Signed-off-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Reviewed-by: Dave Chinner Reviewed-by: Eric Sandeen Signed-off-by: Greg Kroah-Hartman --- fs/xfs/xfs_ioctl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/xfs/xfs_ioctl.c +++ b/fs/xfs/xfs_ioctl.c @@ -712,7 +712,8 @@ xfs_ioc_space( flags |= XFS_PREALLOC_CLEAR; if (bf->l_start > XFS_ISIZE(ip)) { error = xfs_alloc_file_space(ip, XFS_ISIZE(ip), - bf->l_start - XFS_ISIZE(ip), 0); + bf->l_start - XFS_ISIZE(ip), + XFS_BMAPI_PREALLOC); if (error) goto out_unlock; }