]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Cache bypass: Only compile bypass code for the Linux kernel
authorMarc Dionne <marc.c.dionne@gmail.com>
Tue, 23 Nov 2010 23:39:33 +0000 (18:39 -0500)
committerDerrick Brashear <shadow@dementia.org>
Wed, 12 Jan 2011 14:15:38 +0000 (06:15 -0800)
Only compile the afs_bypasscache.c code if AFS_LINUX24_ENV is set,
since it's currently the only case where the code is actually used.
Only sections that caused problems for UKERNEL were previously
ifdef'ed.

Besides making the code cleaner, the main effect of this change
is to prevent compiling most of the bypass code for UKERNEL where
it isn't currently used.

If support for bypass is added for other platforms eventually, the
code here would need to be reworked anyway, ideally abstracting out
and moving any OS specific bits into the platform subdirectories.

Reviewed-on: http://gerrit.openafs.org/3374
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit 46a6d6129d80c4027d8a9f0e1d06b32cc12d6367)

Change-Id: I042a30ac2a5e8156a233a0ff0f46aa5cd4fcd675
Reviewed-on: http://gerrit.openafs.org/3646
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
src/afs/afs_bypasscache.c
src/afs/afs_pioctl.c

index a636915f85262e591a1ded1fb233dd0a11a585a9..059714f7ade3a3b70294db2c3ea2dd14fd7aeefc 100644 (file)
@@ -61,7 +61,7 @@
 #include <afsconfig.h>
 #include "afs/param.h"
 
-#if defined(AFS_CACHE_BYPASS)
+#if defined(AFS_CACHE_BYPASS) && defined(AFS_LINUX24_ENV)
 
 #include "afs/afs_bypasscache.h"
 
 #include "afs/nfsclient.h"
 #include "rx/rx_globals.h"
 
-#if defined(AFS_LINUX26_ENV)
-#define LockPage(pp) lock_page(pp)
-#define UnlockPage(pp) unlock_page(pp)
-#endif
-
 #ifndef afs_min
 #define afs_min(A,B) ((A)<(B)) ? (A) : (B)
 #endif
@@ -274,7 +269,6 @@ done:
  * afs_PrefetchNoCache, all of the pages they've been passed need
  * to be unlocked.
  */
-#if defined(AFS_LINUX24_ENV)
 #define unlock_and_release_pages(auio) \
     do { \
        struct iovec *ciov;     \
@@ -287,7 +281,7 @@ done:
        while(1) { \
            if (pp) { \
                if (PageLocked(pp)) \
-                   UnlockPage(pp);     \
+                   unlock_page(pp);    \
                put_page(pp); /* decrement refcount */ \
            } \
            iovno++; \
@@ -297,14 +291,6 @@ done:
            pp = (struct page*) ciov->iov_base; \
        } \
     } while(0)
-#else
-#ifdef UKERNEL
-#define unlock_and_release_pages(auio) \
-        do { } while(0)
-#else
-#error AFS_CACHE_BYPASS not implemented on this platform
-#endif
-#endif
 
 /* no-cache prefetch routine */
 static afs_int32
@@ -377,13 +363,7 @@ afs_NoCacheFetchProc(struct rx_call *acall,
 
            clen = ciov->iov_len - iovoff;
            tlen = afs_min(length, clen);
-#ifdef AFS_LINUX24_ENV
            address = page_buffer;
-#else
-#ifndef UKERNEL
-#error AFS_CACHE_BYPASS not implemented on this platform
-#endif
-#endif /* LINUX24 */
            COND_GUNLOCK(locked);
            code = rx_Read(acall, address, tlen);
            COND_RE_GLOCK(locked);
@@ -406,33 +386,21 @@ afs_NoCacheFetchProc(struct rx_call *acall,
                iovoff += code;
                address += code;
            } else {
-#ifdef AFS_LINUX24_ENV
                if(pp) {
                    address = kmap_atomic(pp, KM_USER0);
                    memcpy(address, page_buffer, PAGE_SIZE);
                    kunmap_atomic(address, KM_USER0);
                }
-#else
-#ifndef UKERNEL
-#error AFS_CACHE_BYPASS not implemented on this platform
-#endif
-#endif /* LINUX 24 */
                /* we filled a page, conditionally release it */
                if (release_pages && ciov->iov_base) {
                    /* this is appropriate when no caller intends to unlock
                     * and release the page */
-#ifdef AFS_LINUX24_ENV
                     SetPageUptodate(pp);
                     if(PageLocked(pp))
-                        UnlockPage(pp);
+                        unlock_page(pp);
                     else
                         afs_warn("afs_NoCacheFetchProc: page not locked at iovno %d!\n", iovno);
                     put_page(pp); /* decrement refcount */
-#else
-#ifndef UKERNEL
-#error AFS_CACHE_BYPASS not implemented on this platform
-#endif
-#endif /* LINUX24 */
                }
                /* and carry uio_iov */
                iovno++;
@@ -515,13 +483,7 @@ cleanup:
      * do everything that would normally happen when the request was
      * processed, like unlocking the pages and freeing memory.
      */
-#ifdef AFS_LINUX24_ENV
     unlock_and_release_pages(bparms->auio);
-#else
-#ifndef UKERNEL
-#error AFS_CACHE_BYPASS not implemented on this platform
-#endif
-#endif
     osi_Free(areq, sizeof(struct vrequest));
     osi_Free(bparms->auio->uio_iov,
             bparms->auio->uio_iovcnt * sizeof(struct iovec));
@@ -629,13 +591,7 @@ afs_PrefetchNoCache(struct vcache *avc,
        } else {
            afs_warn("BYPASS: No connection.\n");
            code = -1;
-#ifdef AFS_LINUX24_ENV
            unlock_and_release_pages(auio);
-#else
-#ifndef UKERNEL
-#error AFS_CACHE_BYPASS not implemented on this platform
-#endif
-#endif
            goto done;
        }
     } while (afs_Analyze(tc, code, &avc->f.fid, areq,
@@ -656,4 +612,4 @@ done:
     return code;
 }
 
-#endif /* AFS_CACHE_BYPASS */
+#endif /* AFS_CACHE_BYPASS && AFS_LINUX24_ENV */
index c7576b9bd0bf80a3516062b63719e3215b88ea15..86a8abc73ab2c5ed5c28bf72e828b0c6cb12e1c6 100644 (file)
@@ -282,7 +282,7 @@ DECL_PIOCTL(PNFSNukeCreds);
 DECL_PIOCTL(PNewUuid);
 DECL_PIOCTL(PPrecache);
 DECL_PIOCTL(PGetPAG);
-#if defined(AFS_CACHE_BYPASS)
+#if defined(AFS_CACHE_BYPASS) && defined(AFS_LINUX24_ENV)
 DECL_PIOCTL(PSetCachingThreshold);
 #endif
 
@@ -405,7 +405,7 @@ static pioctlFunction CpioctlSw[] = {
 static pioctlFunction OpioctlSw[]  = {
     PBogus,                    /* 0 */
     PNFSNukeCreds,             /* 1 -- nuke all creds for NFS client */
-#if defined(AFS_CACHE_BYPASS)
+#if defined(AFS_CACHE_BYPASS) && defined(AFS_LINUX24_ENV)
     PSetCachingThreshold        /* 2 -- get/set cache-bypass size threshold */
 #else
     PNoop                       /* 2 -- get/set cache-bypass size threshold */
@@ -4988,7 +4988,7 @@ DECL_PIOCTL(PNewUuid)
     return 0;
 }
 
-#if defined(AFS_CACHE_BYPASS)
+#if defined(AFS_CACHE_BYPASS) && defined(AFS_LINUX24_ENV)
 
 DECL_PIOCTL(PSetCachingThreshold)
 {