From 96a4bee20d42484148d163b85ca049dcc980a7a5 Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Tue, 8 May 2018 19:09:42 -0500 Subject: [PATCH] LINUX: Remove unused osi_fetchstore.c Ever since commit ae5f411c (Linux 4.4: Do not use splice()), most of osi_fetchstore.c has been '#if 0'd out. The only portion that isn't is a function definition that is unreferenced (afs_linux_read_actor). Remove the unused code, and other '#if 0' references to it; the code can always be added back later when we can actually use it. Change-Id: Ifc062d5665393aa6693eb0db63aa23e4feb44df4 Reviewed-on: https://gerrit.openafs.org/13061 Reviewed-by: Michael Meffie Reviewed-by: Benjamin Kaduk Tested-by: BuildBot --- src/afs/LINUX/osi_fetchstore.c | 190 -------------------------------------- src/afs/afs_fetchstore.c | 4 - src/afs/afs_prototypes.h | 6 -- src/libafs/Makefile.common.in | 2 - src/libafs/MakefileProto.LINUX.in | 3 +- 5 files changed, 1 insertion(+), 204 deletions(-) delete mode 100644 src/afs/LINUX/osi_fetchstore.c diff --git a/src/afs/LINUX/osi_fetchstore.c b/src/afs/LINUX/osi_fetchstore.c deleted file mode 100644 index 997c1aa..0000000 --- a/src/afs/LINUX/osi_fetchstore.c +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright (c) 2009 Simon Wilkinson. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* Linux specific store operations - * - * The idea of these operations is to reduce the number of copies - * that data incurs when passing from the disk cache through to the - * RX layer, and vice versa. - * - * In kernels which support it, we use the splice() operation - in - * older kernels, the filesystem's sendpage() operation is used directly. - * Either way, this means that we can get direct access to the page contents, - * rather than getting a copy. - */ - -#include -#include "afs/param.h" - -#include -#if 0 && defined(HAVE_LINUX_SPLICE_DIRECT_TO_ACTOR) -# include -#else -# include -#endif - -#include "afs/sysincludes.h" -#include "afsincludes.h" - -#if 0 && defined(HAVE_LINUX_SPLICE_DIRECT_TO_ACTOR) -static int -afs_linux_splice_actor(struct pipe_inode_info *pipe, - struct pipe_buffer *buf, - struct splice_desc *sd) -{ - struct rxfs_storeVariables *svar = sd->u.data; - size_t size; - int code; - - code = buf->ops->confirm(pipe, buf); - if (code) - return code; - - size = sd->len; - - /* Eventually, this could be rx_WritePage */ - code = rx_Write(svar->call, kmap(buf->page), size); - - if (code != size) - size = -33; /* Can't get a proper rx error out from here */ - - kunmap(buf->page); - - return size; -} - -static int -afs_linux_ds_actor(struct pipe_inode_info *pipe, struct splice_desc *sd) -{ - return __splice_from_pipe(pipe, sd, afs_linux_splice_actor); -} - -/* This is a store proc which uses splice to reduce the number - * of page copies. */ -afs_int32 -afs_linux_storeproc(struct storeOps *ops, void *rock, struct dcache *tdc, - int *shouldwake, afs_size_t *bytesXferred) -{ - struct rxfs_storeVariables *svar = rock; - struct file *cacheFp; - struct splice_desc sd = { - .len = 0, - .total_len = tdc->f.chunkBytes, - .pos = 0, - .u.data = rock - }; - int code; - - /* Open the file, splice its contents */ - AFS_GUNLOCK(); - cacheFp = afs_linux_raw_open(&tdc->f.inode); - code = splice_direct_to_actor(cacheFp, &sd, afs_linux_ds_actor); - filp_close(cacheFp, NULL); - AFS_GLOCK(); - - /* If we're being called from a backing request, then wake up that - * request once the file server says its happy. Potentially, we should - * do this each time we rx_Write, but that would mean acquiring the - * GLOCK in the middle of our actor */ - if (shouldwake && *shouldwake && ((*ops->status)(rock) == 0)) { - *shouldwake = 0; - afs_wakeup(svar->vcache); - } - - if (code > 0) { - *bytesXferred+=code; - return 0; - } - - return code; -} - -# else - -static int -afs_linux_read_actor(read_descriptor_t *desc, struct page *page, - unsigned long offset, unsigned long size) -{ -#ifdef READ_DESCRIPTOR_T_HAS_BUF - struct rxfs_storeVariables *svar = (void *) desc->buf; -#else - struct rxfs_storeVariables *svar = desc->arg.data; -#endif - unsigned long count = desc->count; - int code; - - if (size > count) - size = count; - - /* Eventually, this could be rx_WritePage */ - code = rx_Write(svar->call, kmap(page) + offset, size); - kunmap(page); - - if (code != size) { - return -33; /* Can't get a proper rx error out from here */ - } - - desc->count = count - size; - desc->written += size; - - return size; -} - -#if 0 -afs_int32 -afs_linux_storeproc(struct storeOps *ops, void *rock, struct dcache *tdc, - int *shouldwake, afs_size_t *bytesXferred) -{ - struct rxfs_storeVariables *svar = rock; - struct file *cacheFp; - int code; - loff_t offset = 0; - - /* Open the file, splice its contents */ - AFS_GUNLOCK(); - cacheFp = afs_linux_raw_open(&tdc->f.inode); - code = cacheFp->f_op->sendfile(cacheFp, &offset, tdc->f.chunkBytes, - afs_linux_read_actor, rock); - filp_close(cacheFp, NULL); - AFS_GLOCK(); - - /* If we're being called from a backing request, then wake up that - * request once the file server says its happy. Potentially, we should - * do this each time we rx_Write, but that would mean acquiring the - * GLOCK in the middle of our actor */ - if (shouldwake && *shouldwake && ((*ops->status)(rock) == 0)) { - *shouldwake = 0; - afs_wakeup(svar->vcache); - } - - if (code > 0) { - *bytesXferred+=code; - return 0; - } - - return code; -} -#endif - -#endif diff --git a/src/afs/afs_fetchstore.c b/src/afs/afs_fetchstore.c index c9a73a8..eb32bbe 100644 --- a/src/afs/afs_fetchstore.c +++ b/src/afs/afs_fetchstore.c @@ -324,12 +324,8 @@ struct storeOps rxfs_storeUfsOps = { .padd = rxfs_storePadd, .close = rxfs_storeClose, .destroy = rxfs_storeDestroy, -#if 0 && defined(AFS_LINUX26_ENV) - .storeproc = afs_linux_storeproc -#else .storeproc = afs_GenericStoreProc #endif -#endif }; static diff --git a/src/afs/afs_prototypes.h b/src/afs/afs_prototypes.h index e51f62b..fb8ddf4 100644 --- a/src/afs/afs_prototypes.h +++ b/src/afs/afs_prototypes.h @@ -626,12 +626,6 @@ extern void osi_ReleaseVM(struct vcache *avc, afs_ucred_t *acred); #endif -/* LINUX/osi_fetchstore.c */ -#ifdef AFS_LINUX26_ENV -extern int afs_linux_storeproc(struct storeOps *, void *, struct dcache *, - int *, afs_size_t *); -#endif - /* ARCH/osi_crypto.c */ extern int osi_readRandom(void *, afs_size_t); diff --git a/src/libafs/Makefile.common.in b/src/libafs/Makefile.common.in index 406b8e0..d9bd90b 100644 --- a/src/libafs/Makefile.common.in +++ b/src/libafs/Makefile.common.in @@ -712,8 +712,6 @@ osi_timeout.o: $(TOP_SRCDIR)/afs/$(MKAFS_OSTYPE)/osi_timeout.c $(CRULE_NOOPT) $(TOP_SRCDIR)/afs/$(MKAFS_OSTYPE)/osi_timeout.c osi_pagecopy.o: $(TOP_SRCDIR)/afs/$(MKAFS_OSTYPE)/osi_pagecopy.c $(CRULE_NOOPT) $(TOP_SRCDIR)/afs/$(MKAFS_OSTYPE)/osi_pagecopy.c -osi_fetchstore.o: $(TOP_SRCDIR)/afs/$(MKAFS_OSTYPE)/osi_fetchstore.c - $(CRULE_NOOPT) $(TOP_SRCDIR)/afs/$(MKAFS_OSTYPE)/osi_fetchstore.c osi_vcache.o: $(TOP_SRCDIR)/afs/$(MKAFS_OSTYPE)/osi_vcache.c $(CRULE_NOOPT) $(TOP_SRCDIR)/afs/$(MKAFS_OSTYPE)/osi_vcache.c osi_crypto.o: $(TOP_SRCDIR)/afs/$(MKAFS_OSTYPE)/osi_crypto.c diff --git a/src/libafs/MakefileProto.LINUX.in b/src/libafs/MakefileProto.LINUX.in index 564b2ef..ed687f1 100644 --- a/src/libafs/MakefileProto.LINUX.in +++ b/src/libafs/MakefileProto.LINUX.in @@ -42,8 +42,7 @@ AFS_OS_OBJS = \ osi_ioctl.o \ osi_proc.o \ osi_vnodeops.o \ - osi_pagecopy.o \ - osi_fetchstore.o + osi_pagecopy.o AFS_OS_PAGOBJS = \ osi_alloc.o \ -- 1.9.4