nfsd: move most of nfsfh.h to fs/nfsd
[safe/jmp/linux-2.6] / fs / ubifs / journal.c
index 3b0fa70..d321bae 100644 (file)
@@ -114,7 +114,7 @@ static inline void zero_trun_node_unused(struct ubifs_trun_node *trun)
  */
 static int reserve_space(struct ubifs_info *c, int jhead, int len)
 {
-       int err = 0, err1, retries = 0, avail, lnum, offs, free, squeeze;
+       int err = 0, err1, retries = 0, avail, lnum, offs, squeeze;
        struct ubifs_wbuf *wbuf = &c->jheads[jhead].wbuf;
 
        /*
@@ -139,10 +139,9 @@ again:
         * Write buffer wasn't seek'ed or there is no enough space - look for an
         * LEB with some empty space.
         */
-       lnum = ubifs_find_free_space(c, len, &free, squeeze);
+       lnum = ubifs_find_free_space(c, len, &offs, squeeze);
        if (lnum >= 0) {
                /* Found an LEB, add it to the journal head */
-               offs = c->leb_size - free;
                err = ubifs_add_bud_to_log(c, jhead, lnum, offs);
                if (err)
                        goto out_return;
@@ -159,7 +158,7 @@ again:
         * some. But the write-buffer mutex has to be unlocked because
         * GC also takes it.
         */
-       dbg_jnl("no free space  jhead %d, run GC", jhead);
+       dbg_jnl("no free space in jhead %s, run GC", dbg_jhead(jhead));
        mutex_unlock(&wbuf->io_mutex);
 
        lnum = ubifs_garbage_collect(c, 0);
@@ -174,7 +173,8 @@ again:
                 * because we dropped @wbuf->io_mutex, so try once
                 * again.
                 */
-               dbg_jnl("GC couldn't make a free LEB for jhead %d", jhead);
+               dbg_jnl("GC couldn't make a free LEB for jhead %s",
+                       dbg_jhead(jhead));
                if (retries++ < 2) {
                        dbg_jnl("retry (%d)", retries);
                        goto again;
@@ -185,13 +185,13 @@ again:
        }
 
        mutex_lock_nested(&wbuf->io_mutex, wbuf->jhead);
-       dbg_jnl("got LEB %d for jhead %d", lnum, jhead);
+       dbg_jnl("got LEB %d for jhead %s", lnum, dbg_jhead(jhead));
        avail = c->leb_size - wbuf->offs - wbuf->used;
 
        if (wbuf->lnum != -1 && avail >= len) {
                /*
                 * Someone else has switched the journal head and we have
-                * enough space now. This happens when more then one process is
+                * enough space now. This happens when more than one process is
                 * trying to write to the same journal head at the same time.
                 */
                dbg_jnl("return LEB %d back, already have LEB %d:%d",
@@ -208,7 +208,7 @@ again:
        offs = 0;
 
 out:
-       err = ubifs_wbuf_seek_nolock(wbuf, lnum, offs, UBI_SHORTTERM);
+       err = ubifs_wbuf_seek_nolock(wbuf, lnum, offs, wbuf->dtype);
        if (err)
                goto out_unlock;
 
@@ -256,7 +256,8 @@ static int write_node(struct ubifs_info *c, int jhead, void *node, int len,
        *lnum = c->jheads[jhead].wbuf.lnum;
        *offs = c->jheads[jhead].wbuf.offs + c->jheads[jhead].wbuf.used;
 
-       dbg_jnl("jhead %d, LEB %d:%d, len %d", jhead, *lnum, *offs, len);
+       dbg_jnl("jhead %s, LEB %d:%d, len %d",
+               dbg_jhead(jhead), *lnum, *offs, len);
        ubifs_prepare_node(c, node, len, 0);
 
        return ubifs_wbuf_write_nolock(wbuf, node, len);
@@ -286,7 +287,8 @@ static int write_head(struct ubifs_info *c, int jhead, void *buf, int len,
 
        *lnum = c->jheads[jhead].wbuf.lnum;
        *offs = c->jheads[jhead].wbuf.offs + c->jheads[jhead].wbuf.used;
-       dbg_jnl("jhead %d, LEB %d:%d, len %d", jhead, *lnum, *offs, len);
+       dbg_jnl("jhead %s, LEB %d:%d, len %d",
+               dbg_jhead(jhead), *lnum, *offs, len);
 
        err = ubifs_wbuf_write_nolock(wbuf, buf, len);
        if (err)
@@ -704,7 +706,7 @@ int ubifs_jnl_write_data(struct ubifs_info *c, const struct inode *inode,
        data->size = cpu_to_le32(len);
        zero_data_node_unused(data);
 
-       if (!(ui->flags && UBIFS_COMPR_FL))
+       if (!(ui->flags & UBIFS_COMPR_FL))
                /* Compression is disabled for this inode */
                compr_type = UBIFS_COMPR_NONE;
        else
@@ -1366,7 +1368,7 @@ out_ro:
  * @host: host inode
  *
  * This function writes the updated version of an extended attribute inode and
- * the host inode tho the journal (to the base head). The host inode is written
+ * the host inode to the journal (to the base head). The host inode is written
  * after the extended attribute inode in order to guarantee that the extended
  * attribute will be flushed when the inode is synchronized by 'fsync()' and
  * consequently, the write-buffer is synchronized. This function returns zero