]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Merge branch 'linux-next' of git://git.infradead.org/ubifs-2.6
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 6 Apr 2009 22:00:19 +0000 (15:00 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 6 Apr 2009 22:00:19 +0000 (15:00 -0700)
* 'linux-next' of git://git.infradead.org/ubifs-2.6:
  UBIFS: fix recovery bug
  UBIFS: add R/O compatibility
  UBIFS: fix compiler warnings
  UBIFS: fully sort GCed nodes
  UBIFS: fix commentaries
  UBIFS: introduce a helpful variable
  UBIFS: use KERN_CONT
  UBIFS: fix lprops committing bug
  UBIFS: fix bogus assertion
  UBIFS: fix bug where page is marked uptodate when out of space
  UBIFS: amend key_hash return value
  UBIFS: improve find function interface
  UBIFS: list usage cleanup
  UBIFS: fix dbg_chk_lpt_sz()

1  2 
fs/ubifs/file.c
fs/ubifs/super.c

diff --combined fs/ubifs/file.c
index 0ff89fe71e5103c3effe3dfd27dc2bac58b8bfc5,4e256b8f56b268e68c1d4da899eed29ab989120d..6d34dc7e33e10c87adb4df4f25ab54c6eb5587fc
@@@ -430,6 -430,7 +430,7 @@@ static int ubifs_write_begin(struct fil
        struct ubifs_inode *ui = ubifs_inode(inode);
        pgoff_t index = pos >> PAGE_CACHE_SHIFT;
        int uninitialized_var(err), appending = !!(pos + len > inode->i_size);
+       int skipped_read = 0;
        struct page *page;
  
        ubifs_assert(ubifs_inode(inode)->ui_size == inode->i_size);
  
        if (!PageUptodate(page)) {
                /* The page is not loaded from the flash */
-               if (!(pos & ~PAGE_CACHE_MASK) && len == PAGE_CACHE_SIZE)
+               if (!(pos & ~PAGE_CACHE_MASK) && len == PAGE_CACHE_SIZE) {
                        /*
                         * We change whole page so no need to load it. But we
                         * have to set the @PG_checked flag to make the further
                         * the media.
                         */
                        SetPageChecked(page);
-               else {
+                       skipped_read = 1;
+               } else {
                        err = do_readpage(page);
                        if (err) {
                                unlock_page(page);
        err = allocate_budget(c, page, ui, appending);
        if (unlikely(err)) {
                ubifs_assert(err == -ENOSPC);
+               /*
+                * If we skipped reading the page because we were going to
+                * write all of it, then it is not up to date.
+                */
+               if (skipped_read) {
+                       ClearPageChecked(page);
+                       ClearPageUptodate(page);
+               }
                /*
                 * Budgeting failed which means it would have to force
                 * write-back but didn't, because we set the @fast flag in the
@@@ -949,7 -959,7 +959,7 @@@ static int do_writepage(struct page *pa
   * whole index and correct all inode sizes, which is long an unacceptable.
   *
   * To prevent situations like this, UBIFS writes pages back only if they are
-  * within last synchronized inode size, i.e. the the size which has been
+  * within the last synchronized inode size, i.e. the size which has been
   * written to the flash media last time. Otherwise, UBIFS forces inode
   * write-back, thus making sure the on-flash inode contains current inode size,
   * and then keeps writing pages back.
@@@ -1434,9 -1444,8 +1444,9 @@@ static int ubifs_releasepage(struct pag
   * mmap()d file has taken write protection fault and is being made
   * writable. UBIFS must ensure page is budgeted for.
   */
 -static int ubifs_vm_page_mkwrite(struct vm_area_struct *vma, struct page *page)
 +static int ubifs_vm_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
  {
 +      struct page *page = vmf->page;
        struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
        struct ubifs_info *c = inode->i_sb->s_fs_info;
        struct timespec now = ubifs_current_time(inode);
        ubifs_assert(!(inode->i_sb->s_flags & MS_RDONLY));
  
        if (unlikely(c->ro_media))
 -              return -EROFS;
 +              return VM_FAULT_SIGBUS; /* -EROFS */
  
        /*
         * We have not locked @page so far so we may budget for changing the
                if (err == -ENOSPC)
                        ubifs_warn("out of space for mmapped file "
                                   "(inode number %lu)", inode->i_ino);
 -              return err;
 +              return VM_FAULT_SIGBUS;
        }
  
        lock_page(page);
  out_unlock:
        unlock_page(page);
        ubifs_release_budget(c, &req);
 +      if (err)
 +              err = VM_FAULT_SIGBUS;
        return err;
  }
  
diff --combined fs/ubifs/super.c
index c5c98355459a5fcfab9312b3719e3695c440aadd,302a2056422ee9bf4966d005af9604fe1f4ec0c7..faa44f90608a26f885208a7b53ff786dcc371f3a
@@@ -421,8 -421,8 +421,8 @@@ static int ubifs_show_options(struct se
                seq_printf(s, ",no_chk_data_crc");
  
        if (c->mount_opts.override_compr) {
-               seq_printf(s, ",compr=");
-               seq_printf(s, ubifs_compr_name(c->mount_opts.compr_type));
+               seq_printf(s, ",compr=%s",
+                          ubifs_compr_name(c->mount_opts.compr_type));
        }
  
        return 0;
@@@ -700,6 -700,8 +700,8 @@@ static int init_constants_sb(struct ubi
        if (err)
                return err;
  
+       /* Initialize effective LEB size used in budgeting calculations */
+       c->idx_leb_size = c->leb_size - c->max_idx_node_sz;
        return 0;
  }
  
@@@ -716,6 -718,7 +718,7 @@@ static void init_constants_master(struc
        long long tmp64;
  
        c->min_idx_lebs = ubifs_calc_min_idx_lebs(c);
+       c->report_rp_size = ubifs_reported_space(c, c->rp_size);
  
        /*
         * Calculate total amount of FS blocks. This number is not used
@@@ -1201,7 -1204,7 +1204,7 @@@ static int mount_ubifs(struct ubifs_inf
                        goto out_cbuf;
  
                /* Create background thread */
-               c->bgt = kthread_create(ubifs_bg_thread, c, c->bgt_name);
+               c->bgt = kthread_create(ubifs_bg_thread, c, "%s", c->bgt_name);
                if (IS_ERR(c->bgt)) {
                        err = PTR_ERR(c->bgt);
                        c->bgt = NULL;
                else {
                        c->need_recovery = 0;
                        ubifs_msg("recovery completed");
-                       /* GC LEB has to be empty and taken at this point */
-                       ubifs_assert(c->lst.taken_empty_lebs == 1);
+                       /*
+                        * GC LEB has to be empty and taken at this point. But
+                        * the journal head LEBs may also be accounted as
+                        * "empty taken" if they are empty.
+                        */
+                       ubifs_assert(c->lst.taken_empty_lebs > 0);
                }
        } else
-               ubifs_assert(c->lst.taken_empty_lebs == 1);
+               ubifs_assert(c->lst.taken_empty_lebs > 0);
  
        err = dbg_check_filesystem(c);
        if (err)
        x = (long long)c->log_lebs * c->leb_size + c->max_bud_bytes;
        ubifs_msg("journal size:       %lld bytes (%lld KiB, %lld MiB, %d "
                  "LEBs)", x, x >> 10, x >> 20, c->log_lebs + c->max_bud_cnt);
-       ubifs_msg("media format:       %d (latest is %d)",
-                 c->fmt_version, UBIFS_FORMAT_VERSION);
+       ubifs_msg("media format:       w%d/r%d (latest is w%d/r%d)",
+                 c->fmt_version, c->ro_compat_version,
+                 UBIFS_FORMAT_VERSION, UBIFS_RO_COMPAT_VERSION);
        ubifs_msg("default compressor: %s", ubifs_compr_name(c->default_compr));
        ubifs_msg("reserved for root:  %llu bytes (%llu KiB)",
                c->report_rp_size, c->report_rp_size >> 10);
@@@ -1485,6 -1493,15 +1493,15 @@@ static int ubifs_remount_rw(struct ubif
  {
        int err, lnum;
  
+       if (c->rw_incompat) {
+               ubifs_err("the file-system is not R/W-compatible");
+               ubifs_msg("on-flash format version is w%d/r%d, but software "
+                         "only supports up to version w%d/r%d", c->fmt_version,
+                         c->ro_compat_version, UBIFS_FORMAT_VERSION,
+                         UBIFS_RO_COMPAT_VERSION);
+               return -EROFS;
+       }
        mutex_lock(&c->umount_mutex);
        dbg_save_space_info(c);
        c->remounting_rw = 1;
        ubifs_create_buds_lists(c);
  
        /* Create background thread */
-       c->bgt = kthread_create(ubifs_bg_thread, c, c->bgt_name);
+       c->bgt = kthread_create(ubifs_bg_thread, c, "%s", c->bgt_name);
        if (IS_ERR(c->bgt)) {
                err = PTR_ERR(c->bgt);
                c->bgt = NULL;
@@@ -1775,7 -1792,7 +1792,7 @@@ static int ubifs_remount_fs(struct supe
                c->bu.buf = NULL;
        }
  
-       ubifs_assert(c->lst.taken_empty_lebs == 1);
+       ubifs_assert(c->lst.taken_empty_lebs > 0);
        return 0;
  }
  
@@@ -2034,8 -2051,7 +2051,8 @@@ static int ubifs_get_sb(struct file_sys
        /* 'fill_super()' opens ubi again so we must close it here */
        ubi_close_volume(ubi);
  
 -      return simple_set_mnt(mnt, sb);
 +      simple_set_mnt(mnt, sb);
 +      return 0;
  
  out_deact:
        up_write(&sb->s_umount);