From patchwork Tue Jun 7 17:27:11 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Rees X-Patchwork-Id: 858032 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p57HQgVV007977 for ; Tue, 7 Jun 2011 17:27:14 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755456Ab1FGR1N (ORCPT ); Tue, 7 Jun 2011 13:27:13 -0400 Received: from int-mailstore01.merit.edu ([207.75.116.232]:52967 "EHLO int-mailstore01.merit.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932074Ab1FGR1N (ORCPT ); Tue, 7 Jun 2011 13:27:13 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by int-mailstore01.merit.edu (Postfix) with ESMTP id AFC4230852CE; Tue, 7 Jun 2011 13:27:12 -0400 (EDT) X-Virus-Scanned: amavisd-new at int-mailstore01.merit.edu Received: from int-mailstore01.merit.edu ([127.0.0.1]) by localhost (int-mailstore01.merit.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qEuJnTgh4l00; Tue, 7 Jun 2011 13:27:12 -0400 (EDT) Received: from merit.edu (host-17.subnet-17.med.umich.edu [141.214.17.17]) by int-mailstore01.merit.edu (Postfix) with ESMTPSA id 181BA305CF58; Tue, 7 Jun 2011 13:27:12 -0400 (EDT) Date: Tue, 7 Jun 2011 13:27:11 -0400 From: Jim Rees To: Benny Halevy Cc: linux-nfs@vger.kernel.org, peter honeyman Subject: [PATCH 11/88] pnfsblock: blocklayout stub Message-ID: <4904fc8cad92728785e9eec0cbefa4559397d805.1307464382.git.rees@umich.edu> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Tue, 07 Jun 2011 17:27:14 +0000 (UTC) From: Fred Isaman Adds the minimal structure for a pnfs block layout driver, with all function pointers aimed at stubs. [pnfsblock: SQUASHME: adjust to API change] Signed-off-by: Fred Isaman [pnfs: move pnfs_layout_type inline in nfs_inode] Signed-off-by: Benny Halevy [blocklayout: encode_layoutcommit implementation] Signed-off-by: Boaz Harrosh Signed-off-by: Benny Halevy --- fs/nfs/blocklayout/Makefile | 4 +- fs/nfs/blocklayout/blocklayout.c | 224 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 226 insertions(+), 2 deletions(-) create mode 100644 fs/nfs/blocklayout/blocklayout.c diff --git a/fs/nfs/blocklayout/Makefile b/fs/nfs/blocklayout/Makefile index f214c1c..6bf49cd 100644 --- a/fs/nfs/blocklayout/Makefile +++ b/fs/nfs/blocklayout/Makefile @@ -1,5 +1,5 @@ # # Makefile for the pNFS block layout driver kernel module # -obj-$(CONFIG_PNFS_BLOCK) += -blocklayoutdriver-objs := +obj-$(CONFIG_PNFS_BLOCK) += blocklayoutdriver.o +blocklayoutdriver-objs := blocklayout.o diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c new file mode 100644 index 0000000..1312849 --- /dev/null +++ b/fs/nfs/blocklayout/blocklayout.c @@ -0,0 +1,224 @@ +/* + * linux/fs/nfs/blocklayout/blocklayout.c + * + * Module for the NFSv4.1 pNFS block layout driver. + * + * Copyright (c) 2006 The Regents of the University of Michigan. + * All rights reserved. + * + * Andy Adamson + * Fred Isaman + * + * permission is granted to use, copy, create derivative works and + * redistribute this software and such derivative works for any purpose, + * so long as the name of the university of michigan is not used in + * any advertising or publicity pertaining to the use or distribution + * of this software without specific, written prior authorization. if + * the above copyright notice or any other identification of the + * university of michigan is included in any copy of any portion of + * this software, then the disclaimer below must also be included. + * + * this software is provided as is, without representation from the + * university of michigan as to its fitness for any purpose, and without + * warranty by the university of michigan of any kind, either express + * or implied, including without limitation the implied warranties of + * merchantability and fitness for a particular purpose. the regents + * of the university of michigan shall not be liable for any damages, + * including special, indirect, incidental, or consequential damages, + * with respect to any claim arising out or in connection with the use + * of the software, even if it has been or is hereafter advised of the + * possibility of such damages. + */ +#include +#include + +#include +#include /* Needed by nfs4_pnfs.h */ +#include + +#define NFSDBG_FACILITY NFSDBG_PNFS_LD + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Andy Adamson "); +MODULE_DESCRIPTION("The NFSv4.1 pNFS Block layout driver"); + +/* Callback operations to the pNFS client */ +struct pnfs_client_operations *pnfs_callback_ops; + +static enum pnfs_try_status +bl_commit(struct pnfs_layout_type *lo, + int sync, + struct nfs_write_data *nfs_data) +{ + dprintk("%s enter\n", __func__); + return PNFS_NOT_ATTEMPTED; +} + +static enum pnfs_try_status +bl_read_pagelist(struct pnfs_layout_type *lo, + struct page **pages, + unsigned int pgbase, + unsigned nr_pages, + loff_t offset, + size_t count, + struct nfs_read_data *nfs_data) +{ + dprintk("%s enter\n", __func__); + return PNFS_NOT_ATTEMPTED; +} + +/* FRED - It can indicate bytes written in wdata->res.count. + * It can indicate error status in wdata->task.tk_status. + */ +static enum pnfs_try_status +bl_write_pagelist(struct pnfs_layout_type *lo, + struct page **pages, + unsigned int pgbase, + unsigned nr_pages, + loff_t offset, + size_t count, + int sync, + struct nfs_write_data *wdata) +{ + dprintk("%s enter - just using nfs\n", __func__); + return PNFS_NOT_ATTEMPTED; +} + +static void +bl_free_layout(void *p) +{ + dprintk("%s enter\n", __func__); + return; +} + +static void * +bl_alloc_layout(struct pnfs_mount_type *mtype, struct inode *inode) +{ + dprintk("%s enter\n", __func__); + return NULL; +} + +static void +bl_free_lseg(struct pnfs_layout_segment *lseg) +{ + dprintk("%s enter\n", __func__); + return; +} + +static struct pnfs_layout_segment * +bl_alloc_lseg(struct pnfs_layout_type *lo, + struct nfs4_pnfs_layoutget_res *lgr) +{ + dprintk("%s enter\n", __func__); + return NULL; +} + +static int +bl_setup_layoutcommit(struct pnfs_layout_type *lo, + struct pnfs_layoutcommit_arg *arg) +{ + dprintk("%s enter\n", __func__); + return 0; +} + +static void +bl_encode_layoutcommit(struct pnfs_layout_type *lo, struct xdr_stream *xdr, + const struct pnfs_layoutcommit_arg *arg) +{ + dprintk("%s enter\n", __func__); +} + +static void +bl_cleanup_layoutcommit(struct pnfs_layout_type *lo, + struct pnfs_layoutcommit_arg *arg, int status) +{ + dprintk("%s enter\n", __func__); +} + +static struct pnfs_mount_type * +bl_initialize_mountpoint(struct super_block *sb, struct nfs_fh *fh) +{ + dprintk("%s enter\n", __func__); + return NULL; +} + +static int +bl_uninitialize_mountpoint(struct pnfs_mount_type *mtype) +{ + dprintk("%s enter\n", __func__); + return 0; +} + +static ssize_t +bl_get_stripesize(struct pnfs_layout_type *lo) +{ + dprintk("%s enter\n", __func__); + return 0; +} + +static ssize_t +bl_get_io_threshold(struct pnfs_layout_type *lo, struct inode *inode) +{ + dprintk("%s enter\n", __func__); + return 0; +} + +/* This is called by nfs_can_coalesce_requests via nfs_pageio_do_add_request. + * Should return False if there is a reason requests can not be coalesced, + * otherwise, should default to returning True. + */ +static int +bl_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev, + struct nfs_page *req) +{ + dprintk("%s enter\n", __func__); + return 1; +} + +static struct layoutdriver_io_operations blocklayout_io_operations = { + .commit = bl_commit, + .read_pagelist = bl_read_pagelist, + .write_pagelist = bl_write_pagelist, + .alloc_layout = bl_alloc_layout, + .free_layout = bl_free_layout, + .alloc_lseg = bl_alloc_lseg, + .free_lseg = bl_free_lseg, + .setup_layoutcommit = bl_setup_layoutcommit, + .encode_layoutcommit = bl_encode_layoutcommit, + .cleanup_layoutcommit = bl_cleanup_layoutcommit, + .initialize_mountpoint = bl_initialize_mountpoint, + .uninitialize_mountpoint = bl_uninitialize_mountpoint, +}; + +static struct layoutdriver_policy_operations blocklayout_policy_operations = { + .get_stripesize = bl_get_stripesize, + .get_read_threshold = bl_get_io_threshold, + .get_write_threshold = bl_get_io_threshold, + .pg_test = bl_pg_test, +}; + +static struct pnfs_layoutdriver_type blocklayout_type = { + .id = LAYOUT_BLOCK_VOLUME, + .name = "LAYOUT_BLOCK_VOLUME", + .ld_io_ops = &blocklayout_io_operations, + .ld_policy_ops = &blocklayout_policy_operations, +}; + +static int __init nfs4blocklayout_init(void) +{ + dprintk("%s: NFSv4 Block Layout Driver Registering...\n", __func__); + + pnfs_callback_ops = pnfs_register_layoutdriver(&blocklayout_type); + return 0; +} + +static void __exit nfs4blocklayout_exit(void) +{ + dprintk("%s: NFSv4 Block Layout Driver Unregistering...\n", + __func__); + + pnfs_unregister_layoutdriver(&blocklayout_type); +} + +module_init(nfs4blocklayout_init); +module_exit(nfs4blocklayout_exit);