Kernel: readi() now does direct transfers only if CONFIG_LARGE_IO_DIRECT
authorWill Sowerbutts <will@sowerbutts.com>
Thu, 12 Feb 2015 14:33:57 +0000 (14:33 +0000)
committerWill Sowerbutts <will@sowerbutts.com>
Fri, 13 Feb 2015 15:31:30 +0000 (15:31 +0000)
is defined in the platform config.h

Kernel/inode.c
Kernel/platform-n8vem-mark4/config.h
Kernel/platform-p112/config.h

index 22e883a..d64195e 100644 (file)
@@ -11,8 +11,6 @@ void readi(inoptr ino, uint8_t flag)
        unsigned char *bp;
        uint16_t dev;
        bool ispipe;
-       off_t uostash;
-       usize_t ucstash;
 
        dev = ino->c_dev;
        ispipe = false;
@@ -56,8 +54,11 @@ void readi(inoptr ino, uint8_t flag)
                        amount = min(toread, BLKSIZE - (udata.u_offset&BLKMASK));
                        pblk = bmap(ino, udata.u_offset >> BLKSHIFT, 1);
 
+#ifdef CONFIG_LARGE_IO_DIRECT
                        if(!ispipe && amount == BLKSIZE && !udata.u_sysio && bfind(dev, pblk) == 0){
                                /* we can transfer direct from disk to the userspace buffer */
+                               off_t uostash;
+                               usize_t ucstash;
                                uostash = udata.u_offset;                   /* stash file offset */
                                ucstash = udata.u_count;                    /* stash byte count */
                                udata.u_count = amount;                     /* transfer one sector */
@@ -65,7 +66,9 @@ void readi(inoptr ino, uint8_t flag)
                                ((*dev_tab[major(dev)].dev_read) (minor(dev), 1, 0)); /* read */
                                udata.u_offset = uostash;                   /* restore file offset */
                                udata.u_count = ucstash;                    /* restore byte count */
-                       }else{
+                       }else
+#endif
+                       {
                                /* we transfer through the buffer pool */
                                if (pblk == NULLBLK)
                                        bp = zerobuf();
index 75cb75b..38bb6ac 100644 (file)
@@ -12,6 +12,8 @@
 #undef CONFIG_CPM_EMU
 /* Fixed banking */
 #define CONFIG_BANK_FIXED
+/* Permit large I/O requests to bypass cache and go direct to userspace */
+#define CONFIG_LARGE_IO_DIRECT
 /* 8 60K banks, 1 is kernel */
 #define MAX_MAPS       8
 #define MAP_SIZE       0xF000U
index 72aa2b5..d1b06d0 100644 (file)
@@ -12,6 +12,8 @@
 #undef CONFIG_CPM_EMU
 /* Fixed banking */
 #define CONFIG_BANK_FIXED
+/* Permit large I/O requests to bypass cache and go direct to userspace */
+#define CONFIG_LARGE_IO_DIRECT
 /* 8 60K banks, 1 is kernel */
 #define MAX_MAPS       16
 #define MAP_SIZE       0xF000U