Merge branch 'master' of ssh://www.aleph1.co.uk/home/aleph1/git/yaffs2
authorCharles Manning <cdhmanning@gmail.com>
Wed, 30 Jun 2010 00:07:01 +0000 (12:07 +1200)
committerCharles Manning <cdhmanning@gmail.com>
Wed, 30 Jun 2010 00:07:01 +0000 (12:07 +1200)
1  2 
direct/yaffsfs.c
yaffs_fs.c

diff --combined direct/yaffsfs.c
index c09513277c270eb2b70c46bb38c23fd6f51cc6c2,2b64bc6be9ee8390b2ed8280ec61d6d5d686352b..041287c1e77405a01ee575bb13a4906928fcf0a2
@@@ -826,10 -826,10 +826,10 @@@ int yaffsfs_do_write(int fd, const voi
                yaffsfs_SetError(-EINVAL);
                totalWritten=-1;
        } else if( h && obj){
-               if(isPwrite)
-                       startPos = offset;
                if(h->append)
                        startPos = yaffs_GetObjectFileLength(obj);
+               else if(isPwrite)
+                       startPos = offset;
                else
                        startPos = h->position;
  
@@@ -1846,7 -1846,7 +1846,7 @@@ int yaffs_inodecount(const YCHAR *path
        yaffsfs_Lock();
        dev = yaffsfs_FindDevice(path,&dummy);
        if(dev  && dev->isMounted) {
 -         int nObjects = dev->nObjectsCreated - dev->nFreeObjects;
 +         int nObjects = dev->nObjects;
           if(nObjects > dev->nHardLinks)
                retVal = nObjects - dev->nHardLinks;
        }
diff --combined yaffs_fs.c
index 91d3a8170c7edaf9dac7833aaa57bfa9ff7a984a,77b51cf9cf655086ba4bb636b43f055488a5839e..9469e1b531d5716a02dd82376b4e5c97658f8381
@@@ -202,8 -202,12 +202,12 @@@ static int yaffs_file_flush(struct fil
  static int yaffs_file_flush(struct file *file);
  #endif
  
+ #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34))
+ static int yaffs_sync_object(struct file *file, int datasync);
+ #else
  static int yaffs_sync_object(struct file *file, struct dentry *dentry,
                                int datasync);
+ #endif
  
  static int yaffs_readdir(struct file *f, void *dirent, filldir_t filldir);
  
@@@ -1742,12 -1746,19 +1746,19 @@@ static int yaffs_symlink(struct inode *
        return -ENOMEM;
  }
  
+ #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34))
+ static int yaffs_sync_object(struct file *file, int datasync)
+ #else
  static int yaffs_sync_object(struct file *file, struct dentry *dentry,
                                int datasync)
+ #endif
  {
  
        yaffs_Object *obj;
        yaffs_Device *dev;
+ #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34))
+       struct dentry *dentry = file->f_path.dentry;
+ #endif
  
        obj = yaffs_DentryToObject(dentry);
  
@@@ -1965,7 -1976,6 +1976,6 @@@ ssize_t yaffs_listxattr(struct dentry *
  
  
        if (error == 0) {
-               int result;
                dev = obj->myDev;
                yaffs_GrossLock(dev);
                error = yaffs_ListXAttributes(obj, buff, size);
@@@ -2217,7 -2227,7 +2227,7 @@@ static int yaffs_BackgroundThread(void 
                if(time_before(expires,now))
                        expires = now + HZ;
  
-               init_timer(&timer);
+               init_timer_on_stack(&timer);
                timer.expires = expires+1;
                timer.data = (unsigned long) current;
                timer.function = yaffs_background_waker;
@@@ -2242,7 -2252,7 +2252,7 @@@ static int yaffs_BackgroundStart(yaffs_
        context->bgRunning = 1;
  
        context->bgThread = kthread_run(yaffs_BackgroundThread,
 -                              (void *)dev,"yaffs-bg");
 +                              (void *)dev,"yaffs-bg-%d",context->mount_id);
  
        if(IS_ERR(context->bgThread)){
                retval = PTR_ERR(context->bgThread);
@@@ -2559,11 -2569,6 +2569,11 @@@ static struct super_block *yaffs_intern
        yaffs_DeviceParam *param;
  
        yaffs_options options;
 +      
 +      unsigned mount_id;
 +      int found;
 +      struct yaffs_LinuxContext *context_iterator;
 +      struct ylist_head *l;
  
        sb->s_magic = YAFFS_MAGIC;
        sb->s_op = &yaffs_super_ops;
        param->skipCheckpointRead = options.skip_checkpoint_read;
        param->skipCheckpointWrite = options.skip_checkpoint_write;
  
 -      /* we assume this is protected by lock_kernel() in mount/umount */
        down(&yaffs_context_lock);
 +      /* Get a mount id */
 +      found = 0;
 +      for(mount_id=0; ! found; mount_id++){
 +              found = 1;
 +              ylist_for_each(l,&yaffs_context_list){
 +                      context_iterator = ylist_entry(l,struct yaffs_LinuxContext,contextList);
 +                      if(context_iterator->mount_id == mount_id)
 +                              found = 0;
 +              }
 +      }
 +      context->mount_id = mount_id;
 +      
        ylist_add_tail(&(yaffs_DeviceToContext(dev)->contextList), &yaffs_context_list);
        up(&yaffs_context_lock);
  
@@@ -3064,8 -3058,10 +3074,8 @@@ static char *yaffs_dump_dev_part1(char 
        buf += sprintf(buf, "nErasedBlocks...... %d\n", dev->nErasedBlocks);
        buf += sprintf(buf, "blocksInCheckpoint. %d\n", dev->blocksInCheckpoint);
        buf += sprintf(buf, "\n");
 -      buf += sprintf(buf, "nTnodesCreated..... %d\n", dev->nTnodesCreated);
 -      buf += sprintf(buf, "nFreeTnodes........ %d\n", dev->nFreeTnodes);
 -      buf += sprintf(buf, "nObjectsCreated.... %d\n", dev->nObjectsCreated);
 -      buf += sprintf(buf, "nFreeObjects....... %d\n", dev->nFreeObjects);
 +      buf += sprintf(buf, "nTnodes............ %d\n", dev->nTnodes);
 +      buf += sprintf(buf, "nObjects........... %d\n", dev->nObjects);
        buf += sprintf(buf, "nFreeChunks........ %d\n", dev->nFreeChunks);
        buf += sprintf(buf, "\n");
        buf += sprintf(buf, "nPageWrites........ %u\n", dev->nPageWrites);
@@@ -3158,13 -3154,18 +3168,13 @@@ static int yaffs_stats_proc_read(char *
                yaffs_Device *dev = dc->dev;
  
                int erasedChunks;
 -              int nObjects;
 -              int nTnodes;
  
                erasedChunks = dev->nErasedBlocks * dev->param.nChunksPerBlock;
 -              nObjects = dev->nObjectsCreated -dev->nFreeObjects;
 -              nTnodes = dev->nTnodesCreated - dev->nFreeTnodes;
 -              
                
 -              buf += sprintf(buf,"%d, %d, %d, %u, %u, %d, %d\n",
 +              buf += sprintf(buf,"%d, %d, %d, %u, %u, %u, %u\n",
                                n, dev->nFreeChunks, erasedChunks,
                                dev->backgroundGCs, dev->oldestDirtyGCs,
 -                              nObjects, nTnodes);
 +                              dev->nObjects, dev->nTnodes);
        }
        up(&yaffs_context_lock);