|
|
1.1 ! root 1: From [email protected] Sun Mar 15 20:01:06 1992 ! 2: Received: from klaava.Helsinki.FI by kruuna.helsinki.fi with SMTP id AA04345 ! 3: (5.65c/IDA-1.4.4 for <[email protected]>); Sun, 15 Mar 1992 20:00:45 +0200 ! 4: Received: from csi.UOttawa.CA (csi0.csi.uottawa.ca) by klaava.Helsinki.FI (4.1/SMI-4.1) ! 5: id AA21712; Sun, 15 Mar 92 20:00:40 +0200 ! 6: Received: by csi.UOttawa.CA id AA00608 ! 7: (5.65+/IDA-1.3.5 for [email protected]); Sun, 15 Mar 92 12:57:47 -0500 ! 8: From: Keith White <[email protected]> ! 9: Message-Id: <[email protected]> ! 10: Subject: reset-floppy fixed, double your disk speed (linux 0.95) ! 11: To: [email protected] (Linus Torvalds) ! 12: Date: Sun, 15 Mar 92 12:57:46 EST ! 13: X-Mailer: ELM [version 2.3 PL11] ! 14: Status: OR ! 15: ! 16: A couple of things. ! 17: ! 18: 1) I must be one of those lucky few who's been able to use linux0.95. ! 19: However I was surprised to see that hard disk speed was slower. This ! 20: was until I remembered that I had patched fs/block_dev.c and ! 21: include/asm/segment.h to support block moves to and from the fs ! 22: segment. These patches (very minimal it must be admitted) give a ! 23: reasonable increase in speed for 'fsck': ! 24: original: 42.62 elapsed ! 25: patched: 22.06 elapsed ! 26: These patches have no effect on sequential disk access (dd if=/dev/hda ! 27: ...) since most time is spent waiting for those small 2 sector ! 28: transfers anyway. The patches are included below. ! 29: ! 30: 2) I don't run DOS so a floppy disk format program is sort of ! 31: essential. Lawrence Foard's (sp?) formatting routines have a few ! 32: problems (nits). ! 33: a) The inter-sector gap should be larger for a format than it ! 34: is for a read or write. ! 35: b) An interleave is not required (at least on my machine, a ! 36: bottom of the line 386SX-16). ! 37: ! 38: 3) I seem to have fixed the dreaded "reset-floppy called" problem -- ! 39: at least it works for me. The posted fix does not work in my case. ! 40: I'd send you these patches as well, but I only have diffs that include ! 41: all the mods I did for the floppy format stuff. The key point (I ! 42: think) was to only reset twice during an error loop. If a track was ! 43: bad, the recalibrate would fail and call reset which would call ! 44: recalibrate ... If you're interested, I could try to separate the ! 45: formatting stuff and all my debugging "printks" from the reset fix ! 46: stuff and send the diffs. ! 47: ! 48: ...keith ([email protected]) ! 49: ! 50: ---cut here--- ! 51: *** 1.1 1992/03/14 16:33:21 ! 52: --- include/asm/segment.h 1992/03/15 17:10:14 ! 53: *************** ! 54: *** 63,65 **** ! 55: --- 63,109 ---- ! 56: __asm__("mov %0,%%fs"::"r" ((unsigned short) val)); ! 57: } ! 58: ! 59: + /* ! 60: + * these routines are added to use the movs instruction with data ! 61: + * in the fs segment. No optimizations are done with regards to using ! 62: + * movsw or movsd ! 63: + * ! 64: + * [email protected] ! 65: + */ ! 66: + ! 67: + #define memcpy_fromfs(dest,src,n) __asm__ (\ ! 68: + "mov %%fs,%%ax; movl %%ax,%%ds\n\ ! 69: + cld; rep; movsb\n\ ! 70: + mov %%es,%%ax; mov %%ax,%%ds" \ ! 71: + ::"D" ((long)(dest)), "S" ((long)(src)), "c" ((long) (n)) \ ! 72: + :"di", "si", "cx", "ax"); ! 73: + #define memcpy_fromfs_w(dest,src,n) __asm__ (\ ! 74: + "mov %%fs,%%ax; movl %%ax,%%ds\n\ ! 75: + cld; rep; movsw\n\ ! 76: + mov %%es,%%ax; mov %%ax,%%ds" \ ! 77: + ::"D" ((long)(dest)), "S" ((long)(src)), "c" ((long) (n)) \ ! 78: + :"di", "si", "cx", "ax"); ! 79: + #define memcpy_fromfs_l(dest,src,n) __asm__ (\ ! 80: + "mov %%fs,%%ax; movl %%ax,%%ds\n\ ! 81: + cld; rep; movsl\n\ ! 82: + mov %%es,%%ax; mov %%ax,%%ds" \ ! 83: + ::"D" ((long)(dest)), "S" ((long)(src)), "c" ((long) (n)) \ ! 84: + :"di", "si", "cx", "ax"); ! 85: + #define memcpy_tofs(dest,src,n) __asm__ (\ ! 86: + "mov %%fs,%%ax; mov %%ax,%%es\n\ ! 87: + cld; rep; movsb\n\ ! 88: + mov %%ds,%%ax; mov %%ax,%%es" \ ! 89: + ::"D" ((long)(dest)), "S" ((long)(src)), "c" ((long) (n)) \ ! 90: + :"di", "si", "cx", "ax"); ! 91: + #define memcpy_tofs_w(dest,src,n) __asm__ (\ ! 92: + "mov %%fs,%%ax; mov %%ax,%%es\n\ ! 93: + cld; rep; movsw\n\ ! 94: + mov %%ds,%%ax; mov %%ax,%%es" \ ! 95: + ::"D" ((long)(dest)), "S" ((long)(src)), "c" ((long) (n)) \ ! 96: + :"di", "si", "cx", "ax"); ! 97: + #define memcpy_tofs_l(dest,src,n) __asm__ (\ ! 98: + "mov %%fs,%%ax; mov %%ax,%%es\n\ ! 99: + cld; rep; movsl\n\ ! 100: + mov %%ds,%%ax; mov %%ax,%%es"\ ! 101: + ::"D" ((long)(dest)), "S" ((long)(src)), "c" ((long) (n)) \ ! 102: + :"di", "si", "cx", "ax"); ! 103: *** 1.1 1992/03/14 16:37:10 ! 104: --- fs/block_dev.c 1992/03/14 16:38:26 ! 105: *************** ! 106: *** 47,54 **** ! 107: --- 47,64 ---- ! 108: filp->f_pos += chars; ! 109: written += chars; ! 110: count -= chars; ! 111: + #ifdef notdef ! 112: while (chars-->0) ! 113: *(p++) = get_fs_byte(buf++); ! 114: + #else ! 115: + if ((chars&1) || ((long)p&1) || ((long)buf&1)) { ! 116: + memcpy_fromfs(p, buf, chars); ! 117: + } ! 118: + else { ! 119: + memcpy_fromfs_w(p, buf, chars>>1); ! 120: + } ! 121: + p += chars; buf += chars; chars = 0; ! 122: + #endif ! 123: bh->b_dirt = 1; ! 124: brelse(bh); ! 125: } ! 126: *************** ! 127: *** 85,92 **** ! 128: --- 95,112 ---- ! 129: filp->f_pos += chars; ! 130: read += chars; ! 131: count -= chars; ! 132: + #ifdef notdef ! 133: while (chars-->0) ! 134: put_fs_byte(*(p++),buf++); ! 135: + #else ! 136: + if ((chars&1) || ((long)buf&1) || ((long)p&1)) { ! 137: + memcpy_tofs(buf, p, chars); ! 138: + } ! 139: + else { ! 140: + memcpy_tofs_w(buf, p, chars>>1); ! 141: + } ! 142: + p += chars; buf += chars; chars = 0; ! 143: + #endif ! 144: brelse(bh); ! 145: } ! 146: return read; ! 147: ---cut here--- ! 148: ! 149: -- ! 150: BITNET: [email protected] (being phased out) ! 151: UUCP: {...,nrcaer,cunews}!uotcsi2!kwhite ! 152: INTERNET: [email protected] ! 153:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.