]> pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/shaggy...
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 30 Mar 2009 17:02:36 +0000 (10:02 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 30 Mar 2009 17:02:36 +0000 (10:02 -0700)
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/shaggy/jfs-2.6:
  jfs: needs crc32_le
  jfs: Fix error handling in metapage_writepage()
  jfs: return f_fsid for statfs(2)
  jfs: remove xtLookupList()
  jfs: clean up a dangling comment

1  2 
fs/jfs/jfs_extent.c
fs/jfs/jfs_xtree.c

diff --combined fs/jfs/jfs_extent.c
index 169802ea07f991c85cf3e75f07ba41f701777100,16bc326eeca49e011da67a517b64cd7a3bb13727..bbbd5f202e3740d7e735449eb8e6e9626d56e4f1
@@@ -141,7 -141,7 +141,7 @@@ extAlloc(struct inode *ip, s64 xlen, s6
        }
  
        /* Allocate blocks to quota. */
 -      if (DQUOT_ALLOC_BLOCK(ip, nxlen)) {
 +      if (vfs_dq_alloc_block(ip, nxlen)) {
                dbFree(ip, nxaddr, (s64) nxlen);
                mutex_unlock(&JFS_IP(ip)->commit_mutex);
                return -EDQUOT;
         */
        if (rc) {
                dbFree(ip, nxaddr, nxlen);
 -              DQUOT_FREE_BLOCK(ip, nxlen);
 +              vfs_dq_free_block(ip, nxlen);
                mutex_unlock(&JFS_IP(ip)->commit_mutex);
                return (rc);
        }
@@@ -256,7 -256,7 +256,7 @@@ int extRealloc(struct inode *ip, s64 nx
                goto exit;
  
        /* Allocat blocks to quota. */
 -      if (DQUOT_ALLOC_BLOCK(ip, nxlen)) {
 +      if (vfs_dq_alloc_block(ip, nxlen)) {
                dbFree(ip, nxaddr, (s64) nxlen);
                mutex_unlock(&JFS_IP(ip)->commit_mutex);
                return -EDQUOT;
                /* extend the extent */
                if ((rc = xtExtend(0, ip, xoff + xlen, (int) nextend, 0))) {
                        dbFree(ip, xaddr + xlen, delta);
 -                      DQUOT_FREE_BLOCK(ip, nxlen);
 +                      vfs_dq_free_block(ip, nxlen);
                        goto exit;
                }
        } else {
                 */
                if ((rc = xtTailgate(0, ip, xoff, (int) ntail, nxaddr, 0))) {
                        dbFree(ip, nxaddr, nxlen);
 -                      DQUOT_FREE_BLOCK(ip, nxlen);
 +                      vfs_dq_free_block(ip, nxlen);
                        goto exit;
                }
        }
@@@ -362,11 -362,12 +362,12 @@@ exit
  int extHint(struct inode *ip, s64 offset, xad_t * xp)
  {
        struct super_block *sb = ip->i_sb;
-       struct xadlist xadl;
-       struct lxdlist lxdl;
-       lxd_t lxd;
+       int nbperpage = JFS_SBI(sb)->nbperpage;
        s64 prev;
-       int rc, nbperpage = JFS_SBI(sb)->nbperpage;
+       int rc = 0;
+       s64 xaddr;
+       int xlen;
+       int xflag;
  
        /* init the hint as "no hint provided" */
        XADaddress(xp, 0);
         */
        prev = ((offset & ~POFFSET) >> JFS_SBI(sb)->l2bsize) - nbperpage;
  
-       /* if the offsets in the first page of the file,
-        * no hint provided.
+       /* if the offset is in the first page of the file, no hint provided.
         */
        if (prev < 0)
-               return (0);
-       /* prepare to lookup the previous page's extent info */
-       lxdl.maxnlxd = 1;
-       lxdl.nlxd = 1;
-       lxdl.lxd = &lxd;
-       LXDoffset(&lxd, prev)
-       LXDlength(&lxd, nbperpage);
-       xadl.maxnxad = 1;
-       xadl.nxad = 0;
-       xadl.xad = xp;
-       /* perform the lookup */
-       if ((rc = xtLookupList(ip, &lxdl, &xadl, 0)))
-               return (rc);
-       /* check if no extent exists for the previous page.
-        * this is possible for sparse files.
-        */
-       if (xadl.nxad == 0) {
- //            assert(ISSPARSE(ip));
-               return (0);
-       }
+               goto out;
  
-       /* only preserve the abnr flag within the xad flags
-        * of the returned hint.
-        */
-       xp->flag &= XAD_NOTRECORDED;
+       rc = xtLookup(ip, prev, nbperpage, &xflag, &xaddr, &xlen, 0);
  
-       if(xadl.nxad != 1 || lengthXAD(xp) != nbperpage) {
-               jfs_error(ip->i_sb, "extHint: corrupt xtree");
-               return -EIO;
-       }
+       if ((rc == 0) && xlen) {
+               if (xlen != nbperpage) {
+                       jfs_error(ip->i_sb, "extHint: corrupt xtree");
+                       rc = -EIO;
+               }
+               XADaddress(xp, xaddr);
+               XADlength(xp, xlen);
+               /*
+                * only preserve the abnr flag within the xad flags
+                * of the returned hint.
+                */
+               xp->flag  = xflag & XAD_NOTRECORDED;
+       } else
+               rc = 0;
  
-       return (0);
+ out:
+       return (rc);
  }
  
  
diff --combined fs/jfs/jfs_xtree.c
index a27e26c905687b53157e2ce219eb391f91e360d7,44380fb0d7c28839319a78d2709569554f5fb19c..d654a6458648d1a3427be4924f5463f5d77d5f40
@@@ -164,11 -164,8 +164,8 @@@ int xtLookup(struct inode *ip, s64 lsta
                /* is lookup offset beyond eof ? */
                size = ((u64) ip->i_size + (JFS_SBI(ip->i_sb)->bsize - 1)) >>
                    JFS_SBI(ip->i_sb)->l2bsize;
-               if (lstart >= size) {
-                       jfs_err("xtLookup: lstart (0x%lx) >= size (0x%lx)",
-                               (ulong) lstart, (ulong) size);
+               if (lstart >= size)
                        return 0;
-               }
        }
  
        /*
        return rc;
  }
  
- /*
-  *    xtLookupList()
-  *
-  * function: map a single logical extent into a list of physical extent;
-  *
-  * parameter:
-  *    struct inode    *ip,
-  *    struct lxdlist  *lxdlist,       lxd list (in)
-  *    struct xadlist  *xadlist,       xad list (in/out)
-  *    int             flag)
-  *
-  * coverage of lxd by xad under assumption of
-  * . lxd's are ordered and disjoint.
-  * . xad's are ordered and disjoint.
-  *
-  * return:
-  *    0:      success
-  *
-  * note: a page being written (even a single byte) is backed fully,
-  *    except the last page which is only backed with blocks
-  *    required to cover the last byte;
-  *    the extent backing a page is fully contained within an xad;
-  */
- int xtLookupList(struct inode *ip, struct lxdlist * lxdlist,
-                struct xadlist * xadlist, int flag)
- {
-       int rc = 0;
-       struct btstack btstack;
-       int cmp;
-       s64 bn;
-       struct metapage *mp;
-       xtpage_t *p;
-       int index;
-       lxd_t *lxd;
-       xad_t *xad, *pxd;
-       s64 size, lstart, lend, xstart, xend, pstart;
-       s64 llen, xlen, plen;
-       s64 xaddr, paddr;
-       int nlxd, npxd, maxnpxd;
-       npxd = xadlist->nxad = 0;
-       maxnpxd = xadlist->maxnxad;
-       pxd = xadlist->xad;
-       nlxd = lxdlist->nlxd;
-       lxd = lxdlist->lxd;
-       lstart = offsetLXD(lxd);
-       llen = lengthLXD(lxd);
-       lend = lstart + llen;
-       size = (ip->i_size + (JFS_SBI(ip->i_sb)->bsize - 1)) >>
-           JFS_SBI(ip->i_sb)->l2bsize;
-       /*
-        * search for the xad entry covering the logical extent
-        */
-       search:
-       if (lstart >= size)
-               return 0;
-       if ((rc = xtSearch(ip, lstart, NULL, &cmp, &btstack, 0)))
-               return rc;
-       /*
-        *      compute the physical extent covering logical extent
-        *
-        * N.B. search may have failed (e.g., hole in sparse file),
-        * and returned the index of the next entry.
-        */
- //map:
-       /* retrieve search result */
-       XT_GETSEARCH(ip, btstack.top, bn, mp, p, index);
-       /* is xad on the next sibling page ? */
-       if (index == le16_to_cpu(p->header.nextindex)) {
-               if (p->header.flag & BT_ROOT)
-                       goto mapend;
-               if ((bn = le64_to_cpu(p->header.next)) == 0)
-                       goto mapend;
-               XT_PUTPAGE(mp);
-               /* get next sibling page */
-               XT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
-               if (rc)
-                       return rc;
-               index = XTENTRYSTART;
-       }
-       xad = &p->xad[index];
-       /*
-        * is lxd covered by xad ?
-        */
-       compare:
-       xstart = offsetXAD(xad);
-       xlen = lengthXAD(xad);
-       xend = xstart + xlen;
-       xaddr = addressXAD(xad);
-       compare1:
-       if (xstart < lstart)
-               goto compare2;
-       /* (lstart <= xstart) */
-       /* lxd is NOT covered by xad */
-       if (lend <= xstart) {
-               /*
-                * get next lxd
-                */
-               if (--nlxd == 0)
-                       goto mapend;
-               lxd++;
-               lstart = offsetLXD(lxd);
-               llen = lengthLXD(lxd);
-               lend = lstart + llen;
-               if (lstart >= size)
-                       goto mapend;
-               /* compare with the current xad */
-               goto compare1;
-       }
-       /* lxd is covered by xad */
-       else {                  /* (xstart < lend) */
-               /* initialize new pxd */
-               pstart = xstart;
-               plen = min(lend - xstart, xlen);
-               paddr = xaddr;
-               goto cover;
-       }
-       /* (xstart < lstart) */
-       compare2:
-       /* lxd is covered by xad */
-       if (lstart < xend) {
-               /* initialize new pxd */
-               pstart = lstart;
-               plen = min(xend - lstart, llen);
-               paddr = xaddr + (lstart - xstart);
-               goto cover;
-       }
-       /* lxd is NOT covered by xad */
-       else {                  /* (xend <= lstart) */
-               /*
-                * get next xad
-                *
-                * linear search next xad covering lxd on
-                * the current xad page, and then tree search
-                */
-               if (index == le16_to_cpu(p->header.nextindex) - 1) {
-                       if (p->header.flag & BT_ROOT)
-                               goto mapend;
-                       XT_PUTPAGE(mp);
-                       goto search;
-               } else {
-                       index++;
-                       xad++;
-                       /* compare with new xad */
-                       goto compare;
-               }
-       }
-       /*
-        * lxd is covered by xad and a new pxd has been initialized
-        * (lstart <= xstart < lend) or (xstart < lstart < xend)
-        */
-       cover:
-       /* finalize pxd corresponding to current xad */
-       XT_PUTENTRY(pxd, xad->flag, pstart, plen, paddr);
-       if (++npxd >= maxnpxd)
-               goto mapend;
-       pxd++;
-       /*
-        * lxd is fully covered by xad
-        */
-       if (lend <= xend) {
-               /*
-                * get next lxd
-                */
-               if (--nlxd == 0)
-                       goto mapend;
-               lxd++;
-               lstart = offsetLXD(lxd);
-               llen = lengthLXD(lxd);
-               lend = lstart + llen;
-               if (lstart >= size)
-                       goto mapend;
-               /*
-                * test for old xad covering new lxd
-                * (old xstart < new lstart)
-                */
-               goto compare2;
-       }
-       /*
-        * lxd is partially covered by xad
-        */
-       else {                  /* (xend < lend) */
-               /*
-                * get next xad
-                *
-                * linear search next xad covering lxd on
-                * the current xad page, and then next xad page search
-                */
-               if (index == le16_to_cpu(p->header.nextindex) - 1) {
-                       if (p->header.flag & BT_ROOT)
-                               goto mapend;
-                       if ((bn = le64_to_cpu(p->header.next)) == 0)
-                               goto mapend;
-                       XT_PUTPAGE(mp);
-                       /* get next sibling page */
-                       XT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
-                       if (rc)
-                               return rc;
-                       index = XTENTRYSTART;
-                       xad = &p->xad[index];
-               } else {
-                       index++;
-                       xad++;
-               }
-               /*
-                * test for new xad covering old lxd
-                * (old lstart < new xstart)
-                */
-               goto compare;
-       }
-       mapend:
-       xadlist->nxad = npxd;
- //out:
-       XT_PUTPAGE(mp);
-       return rc;
- }
  /*
   *    xtSearch()
   *
@@@ -846,10 -585,10 +585,10 @@@ int xtInsert(tid_t tid,         /* transactio
                        hint = addressXAD(xad) + lengthXAD(xad) - 1;
                } else
                        hint = 0;
 -              if ((rc = DQUOT_ALLOC_BLOCK(ip, xlen)))
 +              if ((rc = vfs_dq_alloc_block(ip, xlen)))
                        goto out;
                if ((rc = dbAlloc(ip, hint, (s64) xlen, &xaddr))) {
 -                      DQUOT_FREE_BLOCK(ip, xlen);
 +                      vfs_dq_free_block(ip, xlen);
                        goto out;
                }
        }
                        /* undo data extent allocation */
                        if (*xaddrp == 0) {
                                dbFree(ip, xaddr, (s64) xlen);
 -                              DQUOT_FREE_BLOCK(ip, xlen);
 +                              vfs_dq_free_block(ip, xlen);
                        }
                        return rc;
                }
@@@ -1246,7 -985,7 +985,7 @@@ xtSplitPage(tid_t tid, struct inode *ip
        rbn = addressPXD(pxd);
  
        /* Allocate blocks to quota. */
 -      if (DQUOT_ALLOC_BLOCK(ip, lengthPXD(pxd))) {
 +      if (vfs_dq_alloc_block(ip, lengthPXD(pxd))) {
                rc = -EDQUOT;
                goto clean_up;
        }
  
        /* Rollback quota allocation. */
        if (quota_allocation)
 -              DQUOT_FREE_BLOCK(ip, quota_allocation);
 +              vfs_dq_free_block(ip, quota_allocation);
  
        return (rc);
  }
@@@ -1513,7 -1252,7 +1252,7 @@@ xtSplitRoot(tid_t tid
                return -EIO;
  
        /* Allocate blocks to quota. */
 -      if (DQUOT_ALLOC_BLOCK(ip, lengthPXD(pxd))) {
 +      if (vfs_dq_alloc_block(ip, lengthPXD(pxd))) {
                release_metapage(rmp);
                return -EDQUOT;
        }
@@@ -3941,7 -3680,7 +3680,7 @@@ s64 xtTruncate(tid_t tid, struct inode 
                ip->i_size = newsize;
  
        /* update quota allocation to reflect freed blocks */
 -      DQUOT_FREE_BLOCK(ip, nfreed);
 +      vfs_dq_free_block(ip, nfreed);
  
        /*
         * free tlock of invalidated pages