1. 25 Apr, 2007 1 commit
    • David Woodhouse's avatar
      [JFFS2] Improve read_inode memory usage, v2. · df8e96f3
      David Woodhouse authored
      We originally used to read every node and allocate a jffs2_tmp_dnode_info
      structure for each, before processing them in (reverse) version order
      and discarding the ones which are obsoleted by later nodes.
      
      With huge logfiles, this behaviour caused memory problems. For example, a
      file involved in OLPC trac #1292 has 1822391 nodes, and would cause the XO
      machine to run out of memory during the first stage of read_inode().
      
      Instead of just inserting nodes into a tree in version order as we find
      them, we now put them into a tree in order of their offset within the
      file, which allows us to immediately discard nodes which are completely
      obsoleted.
      
      We don't use a full tree with 'fragments' pointing to the real data
      structure, as we do in the normal fragtree. We sort only on the start
      address, and add an 'overlapped' flag to the tmp_dnode_info to indicate
      that the node in question is (partially) overlapped by another.
      
      When the scan is complete, we start at the end of the file, adding each
      node to a real fragtree as before. Where the node is non-overlapped, we
      just add it (it doesn't matter that it's not the latest version; there is
      no overlap). When the node at the end of the tree _is_ overlapped, we sort
      it and all its overlapping nodes into version order and then add them to
      the fragtree in that order.
      
      This 'early discard' reduces the peak allocation of tmp_dnode_info
      structures from 1.8M to a mere 62872 (3.5%) in the degenerate case
      referenced above.
      
      This version of the patch also correctly rememembers the highest node
      version# seen for an inode when it's scanned.
      Signed-off-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
      df8e96f3
  2. 23 Apr, 2007 2 commits
    • David Woodhouse's avatar
      [JFFS2] Improve failure mode if inode checking leaves unchecked space. · 44b998e1
      David Woodhouse authored
      We should never find the unchecked size is non-zero after we've finished
      checking all inodes. If it happens, used to BUG(), leaving the alloc_sem
      held and deadlocking. Instead, just return -ENOSPC after complaining. The
      GC thread will die, but read-only operation should be able to continue and
      the file system should be unmountable.
      Signed-off-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
      44b998e1
    • David Woodhouse's avatar
      [JFFS2] Fix cross-endian build. · 566865a2
      David Woodhouse authored
      When compiling a LE-capable JFFS2 on PowerPC, wbuf.c fails to compile:
      
      fs/jffs2/wbuf.c:973: error: braced-group within expression allowed only inside a function
      fs/jffs2/wbuf.c:973: error: initializer element is not constant
      fs/jffs2/wbuf.c:973: error: (near initialization for ‘oob_cleanmarker.magic’)
      fs/jffs2/wbuf.c:974: error: braced-group within expression allowed only inside a function
      fs/jffs2/wbuf.c:974: error: initializer element is not constant
      fs/jffs2/wbuf.c:974: error: (near initialization for ‘oob_cleanmarker.nodetype’)
      fs/jffs2/wbuf.c:975: error: braced-group within expression allowed only inside a function
      fs/jffs2/wbuf.c:976: error: initializer element is not constant
      fs/jffs2/wbuf.c:976: error: (near initialization for ‘oob_cleanmarker.totlen’)
      
      Provide constant_cpu_to_je{16,32} functions, and use them for initialising the
      offending structure.
      Signed-off-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
      566865a2
  3. 22 Apr, 2007 1 commit
  4. 21 Apr, 2007 1 commit
  5. 19 Apr, 2007 2 commits
  6. 17 Apr, 2007 19 commits
  7. 02 Apr, 2007 3 commits
  8. 23 Mar, 2007 3 commits
  9. 10 Mar, 2007 8 commits