From patchwork Thu Mar 17 14:30:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Foster X-Patchwork-Id: 8611851 Return-Path: X-Original-To: patchwork-linux-block@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 43343C0553 for ; Thu, 17 Mar 2016 14:31:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 31C2C2035E for ; Thu, 17 Mar 2016 14:31:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 429122021B for ; Thu, 17 Mar 2016 14:31:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966098AbcCQOax (ORCPT ); Thu, 17 Mar 2016 10:30:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57756 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934646AbcCQOaj (ORCPT ); Thu, 17 Mar 2016 10:30:39 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 617B27AE89; Thu, 17 Mar 2016 14:30:39 +0000 (UTC) Received: from bfoster.bfoster (dhcp-41-24.bos.redhat.com [10.18.41.24]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2HEUd7v027764; Thu, 17 Mar 2016 10:30:39 -0400 Received: by bfoster.bfoster (Postfix, from userid 1000) id B18961255F1; Thu, 17 Mar 2016 10:30:37 -0400 (EDT) From: Brian Foster To: xfs@oss.sgi.com Cc: dm-devel@redhat.com, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH 5/9] block: add a block_device_operations method to provision space Date: Thu, 17 Mar 2016 10:30:33 -0400 Message-Id: <1458225037-24155-6-git-send-email-bfoster@redhat.com> In-Reply-To: <1458225037-24155-1-git-send-email-bfoster@redhat.com> References: <1458225037-24155-1-git-send-email-bfoster@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Signed-off-by: Brian Foster --- fs/block_dev.c | 10 ++++++++++ include/linux/blkdev.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/fs/block_dev.c b/fs/block_dev.c index 375a2e4..73e57b9 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -517,6 +517,16 @@ int blk_get_reserved_space(struct block_device *bdev, sector_t *nr_sects) } EXPORT_SYMBOL_GPL(blk_get_reserved_space); +int blk_provision_space(struct block_device *bdev, sector_t offset, sector_t len) +{ + const struct block_device_operations *ops = bdev->bd_disk->fops; + + if (!ops->provision_space) + return -EOPNOTSUPP; + return ops->provision_space(bdev, offset, len); +} +EXPORT_SYMBOL_GPL(blk_provision_space); + /* * pseudo-fs */ diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index f212fe5..d0fa8a35 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1666,6 +1666,7 @@ struct block_device_operations { void (*swap_slot_free_notify) (struct block_device *, unsigned long); int (*reserve_space) (struct block_device *, sector_t); int (*get_reserved_space) (struct block_device *, sector_t *); + int (*provision_space) (struct block_device *, sector_t, sector_t); struct module *owner; const struct pr_ops *pr_ops; }; @@ -1679,6 +1680,7 @@ extern long bdev_direct_access(struct block_device *, struct blk_dax_ctl *); extern int blk_reserve_space(struct block_device *, sector_t); extern int blk_get_reserved_space(struct block_device *, sector_t *); +extern int blk_provision_space(struct block_device *, sector_t, sector_t); #else /* CONFIG_BLOCK */ struct block_device;