From patchwork Thu Mar 17 14:30:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Foster X-Patchwork-Id: 8617641 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: X-Original-To: patchwork-dm-devel@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 5299DC0553 for ; Fri, 18 Mar 2016 10:02:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5D70A2034B for ; Fri, 18 Mar 2016 10:02:17 +0000 (UTC) Received: from mx6-phx2.redhat.com (mx6-phx2.redhat.com [209.132.183.39]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 80AD5202E9 for ; Fri, 18 Mar 2016 10:02:16 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx6-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2I9xSGx029549; Fri, 18 Mar 2016 05:59:28 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u2HEUcKL022689 for ; Thu, 17 Mar 2016 10:30:38 -0400 Received: from bfoster.bfoster (dhcp-41-24.bos.redhat.com [10.18.41.24]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2HEUcqF012256; Thu, 17 Mar 2016 10:30:38 -0400 Received: by bfoster.bfoster (Postfix, from userid 1000) id 6D4C3122E5B; Thu, 17 Mar 2016 10:30:37 -0400 (EDT) From: Brian Foster To: xfs@oss.sgi.com Date: Thu, 17 Mar 2016 10:30:29 -0400 Message-Id: <1458225037-24155-2-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.27 X-loop: dm-devel@redhat.com X-Mailman-Approved-At: Fri, 18 Mar 2016 05:58:54 -0400 Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, dm-devel@redhat.com Subject: [dm-devel] [RFC PATCH 1/9] block: add block_device_operations methods to set and get reserved space X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 From: Mike Snitzer Signed-off-by: Mike Snitzer --- fs/block_dev.c | 20 ++++++++++++++++++++ include/linux/blkdev.h | 5 +++++ 2 files changed, 25 insertions(+) diff --git a/fs/block_dev.c b/fs/block_dev.c index 826b164..375a2e4 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -497,6 +497,26 @@ long bdev_direct_access(struct block_device *bdev, struct blk_dax_ctl *dax) } EXPORT_SYMBOL_GPL(bdev_direct_access); +int blk_reserve_space(struct block_device *bdev, sector_t nr_sects) +{ + const struct block_device_operations *ops = bdev->bd_disk->fops; + + if (!ops->reserve_space) + return -EOPNOTSUPP; + return ops->reserve_space(bdev, nr_sects); +} +EXPORT_SYMBOL_GPL(blk_reserve_space); + +int blk_get_reserved_space(struct block_device *bdev, sector_t *nr_sects) +{ + const struct block_device_operations *ops = bdev->bd_disk->fops; + + if (!ops->get_reserved_space) + return -EOPNOTSUPP; + return ops->get_reserved_space(bdev, nr_sects); +} +EXPORT_SYMBOL_GPL(blk_get_reserved_space); + /* * pseudo-fs */ diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 413c84f..f212fe5 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1664,6 +1664,8 @@ struct block_device_operations { int (*getgeo)(struct block_device *, struct hd_geometry *); /* this callback is with swap_lock and sometimes page table lock held */ 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 *); struct module *owner; const struct pr_ops *pr_ops; }; @@ -1674,6 +1676,9 @@ extern int bdev_read_page(struct block_device *, sector_t, struct page *); extern int bdev_write_page(struct block_device *, sector_t, struct page *, struct writeback_control *); 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 *); #else /* CONFIG_BLOCK */ struct block_device;