cmsfscp doesn't handle sparse files.  I had some files under CMS which
had large chunks of zeros in them, and cmsfscp failed trying to seek to
(-4096).  Problem is that for 4K blocks of zeros, CMS does allocate any
disk space - it just sets the corresponding indirect pointer on disk to
zero.  Attached patch fixes userland cmsfs; havn't looked at the kernel
module.  Maybe it should really try to create a corresponding sparse
file on the unix side, but this fix was good enough for me.

Cheers,
  Richard

--- cmsfsany.c.ori      Fri Nov 22 18:50:33 2002
+++ cmsfsany.c  Fri Nov 22 18:55:37 2002
@@ -643,6 +643,14 @@
         bp += b1 * inode->psize;
         b2 = cmsfsbex(bp,4);

+       /* if the block pointer is null this is a block of zeros and
+        * CMS didn't bother to allocate disk space.  Return a  buffer
+        * of zeros.
+        */
+       if (b2 == 0) {
+               memset(buffer, 0, inode->cmssuper->blksz);
+               break;
+       }
         /*  read next block for indirection  */
         rc = cmsfs_bread(inode->cmssuper,buffer,
                 b2-1,inode->cmssuper->blksz);

Reply via email to