diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2005-07-27 19:42:22 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-07-27 19:42:22 -0400 |
commit | 49302d0c42592b37f49ae96e0f06a3599cf5a8a0 (patch) | |
tree | f733a7229cd3d62b5a19a2cbbceea1118c31f237 /fs | |
parent | 839c5d2511fadc35cc4e8a8ffa833d76668700b2 (diff) | |
parent | 18190cc08d70a6ec8ef69f0f6ede021f7cb3f9b8 (diff) |
Merge head 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/shaggy/jfs-2.6
Diffstat (limited to 'fs')
-rw-r--r-- | fs/jfs/jfs_dmap.c | 46 | ||||
-rw-r--r-- | fs/jfs/jfs_dtree.c | 13 | ||||
-rw-r--r-- | fs/jfs/jfs_logmgr.c | 3 | ||||
-rw-r--r-- | fs/jfs/jfs_metapage.c | 11 |
4 files changed, 42 insertions, 31 deletions
diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c index 0732f206ca60..c739626f5bf1 100644 --- a/fs/jfs/jfs_dmap.c +++ b/fs/jfs/jfs_dmap.c | |||
@@ -75,7 +75,7 @@ static void dbAllocBits(struct bmap * bmp, struct dmap * dp, s64 blkno, | |||
75 | int nblocks); | 75 | int nblocks); |
76 | static void dbSplit(dmtree_t * tp, int leafno, int splitsz, int newval); | 76 | static void dbSplit(dmtree_t * tp, int leafno, int splitsz, int newval); |
77 | static void dbBackSplit(dmtree_t * tp, int leafno); | 77 | static void dbBackSplit(dmtree_t * tp, int leafno); |
78 | static void dbJoin(dmtree_t * tp, int leafno, int newval); | 78 | static int dbJoin(dmtree_t * tp, int leafno, int newval); |
79 | static void dbAdjTree(dmtree_t * tp, int leafno, int newval); | 79 | static void dbAdjTree(dmtree_t * tp, int leafno, int newval); |
80 | static int dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc, | 80 | static int dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc, |
81 | int level); | 81 | int level); |
@@ -98,8 +98,8 @@ static int dbExtend(struct inode *ip, s64 blkno, s64 nblocks, s64 addnblocks); | |||
98 | static int dbFindBits(u32 word, int l2nb); | 98 | static int dbFindBits(u32 word, int l2nb); |
99 | static int dbFindCtl(struct bmap * bmp, int l2nb, int level, s64 * blkno); | 99 | static int dbFindCtl(struct bmap * bmp, int l2nb, int level, s64 * blkno); |
100 | static int dbFindLeaf(dmtree_t * tp, int l2nb, int *leafidx); | 100 | static int dbFindLeaf(dmtree_t * tp, int l2nb, int *leafidx); |
101 | static void dbFreeBits(struct bmap * bmp, struct dmap * dp, s64 blkno, | 101 | static int dbFreeBits(struct bmap * bmp, struct dmap * dp, s64 blkno, |
102 | int nblocks); | 102 | int nblocks); |
103 | static int dbFreeDmap(struct bmap * bmp, struct dmap * dp, s64 blkno, | 103 | static int dbFreeDmap(struct bmap * bmp, struct dmap * dp, s64 blkno, |
104 | int nblocks); | 104 | int nblocks); |
105 | static int dbMaxBud(u8 * cp); | 105 | static int dbMaxBud(u8 * cp); |
@@ -378,6 +378,7 @@ int dbFree(struct inode *ip, s64 blkno, s64 nblocks) | |||
378 | 378 | ||
379 | /* free the blocks. */ | 379 | /* free the blocks. */ |
380 | if ((rc = dbFreeDmap(bmp, dp, blkno, nb))) { | 380 | if ((rc = dbFreeDmap(bmp, dp, blkno, nb))) { |
381 | jfs_error(ip->i_sb, "dbFree: error in block map\n"); | ||
381 | release_metapage(mp); | 382 | release_metapage(mp); |
382 | IREAD_UNLOCK(ipbmap); | 383 | IREAD_UNLOCK(ipbmap); |
383 | return (rc); | 384 | return (rc); |
@@ -2020,7 +2021,7 @@ static int dbFreeDmap(struct bmap * bmp, struct dmap * dp, s64 blkno, | |||
2020 | int nblocks) | 2021 | int nblocks) |
2021 | { | 2022 | { |
2022 | s8 oldroot; | 2023 | s8 oldroot; |
2023 | int rc, word; | 2024 | int rc = 0, word; |
2024 | 2025 | ||
2025 | /* save the current value of the root (i.e. maximum free string) | 2026 | /* save the current value of the root (i.e. maximum free string) |
2026 | * of the dmap tree. | 2027 | * of the dmap tree. |
@@ -2028,11 +2029,11 @@ static int dbFreeDmap(struct bmap * bmp, struct dmap * dp, s64 blkno, | |||
2028 | oldroot = dp->tree.stree[ROOT]; | 2029 | oldroot = dp->tree.stree[ROOT]; |
2029 | 2030 | ||
2030 | /* free the specified (blocks) bits */ | 2031 | /* free the specified (blocks) bits */ |
2031 | dbFreeBits(bmp, dp, blkno, nblocks); | 2032 | rc = dbFreeBits(bmp, dp, blkno, nblocks); |
2032 | 2033 | ||
2033 | /* if the root has not changed, done. */ | 2034 | /* if error or the root has not changed, done. */ |
2034 | if (dp->tree.stree[ROOT] == oldroot) | 2035 | if (rc || (dp->tree.stree[ROOT] == oldroot)) |
2035 | return (0); | 2036 | return (rc); |
2036 | 2037 | ||
2037 | /* root changed. bubble the change up to the dmap control pages. | 2038 | /* root changed. bubble the change up to the dmap control pages. |
2038 | * if the adjustment of the upper level control pages fails, | 2039 | * if the adjustment of the upper level control pages fails, |
@@ -2221,15 +2222,16 @@ static void dbAllocBits(struct bmap * bmp, struct dmap * dp, s64 blkno, | |||
2221 | * blkno - starting block number of the bits to be freed. | 2222 | * blkno - starting block number of the bits to be freed. |
2222 | * nblocks - number of bits to be freed. | 2223 | * nblocks - number of bits to be freed. |
2223 | * | 2224 | * |
2224 | * RETURN VALUES: none | 2225 | * RETURN VALUES: 0 for success |
2225 | * | 2226 | * |
2226 | * serialization: IREAD_LOCK(ipbmap) or IWRITE_LOCK(ipbmap) held on entry/exit; | 2227 | * serialization: IREAD_LOCK(ipbmap) or IWRITE_LOCK(ipbmap) held on entry/exit; |
2227 | */ | 2228 | */ |
2228 | static void dbFreeBits(struct bmap * bmp, struct dmap * dp, s64 blkno, | 2229 | static int dbFreeBits(struct bmap * bmp, struct dmap * dp, s64 blkno, |
2229 | int nblocks) | 2230 | int nblocks) |
2230 | { | 2231 | { |
2231 | int dbitno, word, rembits, nb, nwords, wbitno, nw, agno; | 2232 | int dbitno, word, rembits, nb, nwords, wbitno, nw, agno; |
2232 | dmtree_t *tp = (dmtree_t *) & dp->tree; | 2233 | dmtree_t *tp = (dmtree_t *) & dp->tree; |
2234 | int rc = 0; | ||
2233 | int size; | 2235 | int size; |
2234 | 2236 | ||
2235 | /* determine the bit number and word within the dmap of the | 2237 | /* determine the bit number and word within the dmap of the |
@@ -2278,8 +2280,10 @@ static void dbFreeBits(struct bmap * bmp, struct dmap * dp, s64 blkno, | |||
2278 | 2280 | ||
2279 | /* update the leaf for this dmap word. | 2281 | /* update the leaf for this dmap word. |
2280 | */ | 2282 | */ |
2281 | dbJoin(tp, word, | 2283 | rc = dbJoin(tp, word, |
2282 | dbMaxBud((u8 *) & dp->wmap[word])); | 2284 | dbMaxBud((u8 *) & dp->wmap[word])); |
2285 | if (rc) | ||
2286 | return rc; | ||
2283 | 2287 | ||
2284 | word += 1; | 2288 | word += 1; |
2285 | } else { | 2289 | } else { |
@@ -2310,7 +2314,9 @@ static void dbFreeBits(struct bmap * bmp, struct dmap * dp, s64 blkno, | |||
2310 | 2314 | ||
2311 | /* update the leaf. | 2315 | /* update the leaf. |
2312 | */ | 2316 | */ |
2313 | dbJoin(tp, word, size); | 2317 | rc = dbJoin(tp, word, size); |
2318 | if (rc) | ||
2319 | return rc; | ||
2314 | 2320 | ||
2315 | /* get the number of dmap words handled. | 2321 | /* get the number of dmap words handled. |
2316 | */ | 2322 | */ |
@@ -2357,6 +2363,8 @@ static void dbFreeBits(struct bmap * bmp, struct dmap * dp, s64 blkno, | |||
2357 | } | 2363 | } |
2358 | 2364 | ||
2359 | BMAP_UNLOCK(bmp); | 2365 | BMAP_UNLOCK(bmp); |
2366 | |||
2367 | return 0; | ||
2360 | } | 2368 | } |
2361 | 2369 | ||
2362 | 2370 | ||
@@ -2464,7 +2472,9 @@ dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc, int level) | |||
2464 | } | 2472 | } |
2465 | dbSplit((dmtree_t *) dcp, leafno, dcp->budmin, newval); | 2473 | dbSplit((dmtree_t *) dcp, leafno, dcp->budmin, newval); |
2466 | } else { | 2474 | } else { |
2467 | dbJoin((dmtree_t *) dcp, leafno, newval); | 2475 | rc = dbJoin((dmtree_t *) dcp, leafno, newval); |
2476 | if (rc) | ||
2477 | return rc; | ||
2468 | } | 2478 | } |
2469 | 2479 | ||
2470 | /* check if the root of the current dmap control page changed due | 2480 | /* check if the root of the current dmap control page changed due |
@@ -2689,7 +2699,7 @@ static void dbBackSplit(dmtree_t * tp, int leafno) | |||
2689 | * | 2699 | * |
2690 | * RETURN VALUES: none | 2700 | * RETURN VALUES: none |
2691 | */ | 2701 | */ |
2692 | static void dbJoin(dmtree_t * tp, int leafno, int newval) | 2702 | static int dbJoin(dmtree_t * tp, int leafno, int newval) |
2693 | { | 2703 | { |
2694 | int budsz, buddy; | 2704 | int budsz, buddy; |
2695 | s8 *leaf; | 2705 | s8 *leaf; |
@@ -2729,7 +2739,9 @@ static void dbJoin(dmtree_t * tp, int leafno, int newval) | |||
2729 | if (newval > leaf[buddy]) | 2739 | if (newval > leaf[buddy]) |
2730 | break; | 2740 | break; |
2731 | 2741 | ||
2732 | assert(newval == leaf[buddy]); | 2742 | /* It shouldn't be less */ |
2743 | if (newval < leaf[buddy]) | ||
2744 | return -EIO; | ||
2733 | 2745 | ||
2734 | /* check which (leafno or buddy) is the left buddy. | 2746 | /* check which (leafno or buddy) is the left buddy. |
2735 | * the left buddy gets to claim the blocks resulting | 2747 | * the left buddy gets to claim the blocks resulting |
@@ -2761,6 +2773,8 @@ static void dbJoin(dmtree_t * tp, int leafno, int newval) | |||
2761 | /* update the leaf value. | 2773 | /* update the leaf value. |
2762 | */ | 2774 | */ |
2763 | dbAdjTree(tp, leafno, newval); | 2775 | dbAdjTree(tp, leafno, newval); |
2776 | |||
2777 | return 0; | ||
2764 | } | 2778 | } |
2765 | 2779 | ||
2766 | 2780 | ||
diff --git a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c index 73b5fc7eda80..404f33eae507 100644 --- a/fs/jfs/jfs_dtree.c +++ b/fs/jfs/jfs_dtree.c | |||
@@ -381,9 +381,12 @@ static u32 add_index(tid_t tid, struct inode *ip, s64 bn, int slot) | |||
381 | * It's time to move the inline table to an external | 381 | * It's time to move the inline table to an external |
382 | * page and begin to build the xtree | 382 | * page and begin to build the xtree |
383 | */ | 383 | */ |
384 | if (DQUOT_ALLOC_BLOCK(ip, sbi->nbperpage) || | 384 | if (DQUOT_ALLOC_BLOCK(ip, sbi->nbperpage)) |
385 | dbAlloc(ip, 0, sbi->nbperpage, &xaddr)) | 385 | goto clean_up; |
386 | goto clean_up; /* No space */ | 386 | if (dbAlloc(ip, 0, sbi->nbperpage, &xaddr)) { |
387 | DQUOT_FREE_BLOCK(ip, sbi->nbperpage); | ||
388 | goto clean_up; | ||
389 | } | ||
387 | 390 | ||
388 | /* | 391 | /* |
389 | * Save the table, we're going to overwrite it with the | 392 | * Save the table, we're going to overwrite it with the |
@@ -397,13 +400,15 @@ static u32 add_index(tid_t tid, struct inode *ip, s64 bn, int slot) | |||
397 | xtInitRoot(tid, ip); | 400 | xtInitRoot(tid, ip); |
398 | 401 | ||
399 | /* | 402 | /* |
400 | * Allocate the first block & add it to the xtree | 403 | * Add the first block to the xtree |
401 | */ | 404 | */ |
402 | if (xtInsert(tid, ip, 0, 0, sbi->nbperpage, &xaddr, 0)) { | 405 | if (xtInsert(tid, ip, 0, 0, sbi->nbperpage, &xaddr, 0)) { |
403 | /* This really shouldn't fail */ | 406 | /* This really shouldn't fail */ |
404 | jfs_warn("add_index: xtInsert failed!"); | 407 | jfs_warn("add_index: xtInsert failed!"); |
405 | memcpy(&jfs_ip->i_dirtable, temp_table, | 408 | memcpy(&jfs_ip->i_dirtable, temp_table, |
406 | sizeof (temp_table)); | 409 | sizeof (temp_table)); |
410 | dbFree(ip, xaddr, sbi->nbperpage); | ||
411 | DQUOT_FREE_BLOCK(ip, sbi->nbperpage); | ||
407 | goto clean_up; | 412 | goto clean_up; |
408 | } | 413 | } |
409 | ip->i_size = PSIZE; | 414 | ip->i_size = PSIZE; |
diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c index 79d07624bfe1..22815e88e7cc 100644 --- a/fs/jfs/jfs_logmgr.c +++ b/fs/jfs/jfs_logmgr.c | |||
@@ -1030,7 +1030,8 @@ static int lmLogSync(struct jfs_log * log, int nosyncwait) | |||
1030 | * starting until all current transactions are completed | 1030 | * starting until all current transactions are completed |
1031 | * by setting syncbarrier flag. | 1031 | * by setting syncbarrier flag. |
1032 | */ | 1032 | */ |
1033 | if (written > LOGSYNC_BARRIER(logsize) && logsize > 32 * LOGPSIZE) { | 1033 | if (!test_bit(log_SYNCBARRIER, &log->flag) && |
1034 | (written > LOGSYNC_BARRIER(logsize)) && log->active) { | ||
1034 | set_bit(log_SYNCBARRIER, &log->flag); | 1035 | set_bit(log_SYNCBARRIER, &log->flag); |
1035 | jfs_info("log barrier on: lsn=0x%x syncpt=0x%x", lsn, | 1036 | jfs_info("log barrier on: lsn=0x%x syncpt=0x%x", lsn, |
1036 | log->syncpt); | 1037 | log->syncpt); |
diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c index 6c5485d16c39..13d7e3f1feb4 100644 --- a/fs/jfs/jfs_metapage.c +++ b/fs/jfs/jfs_metapage.c | |||
@@ -561,7 +561,6 @@ static int metapage_releasepage(struct page *page, int gfp_mask) | |||
561 | dump_mem("page", page, sizeof(struct page)); | 561 | dump_mem("page", page, sizeof(struct page)); |
562 | dump_stack(); | 562 | dump_stack(); |
563 | } | 563 | } |
564 | WARN_ON(mp->lsn); | ||
565 | if (mp->lsn) | 564 | if (mp->lsn) |
566 | remove_from_logsync(mp); | 565 | remove_from_logsync(mp); |
567 | remove_metapage(page, mp); | 566 | remove_metapage(page, mp); |
@@ -641,7 +640,7 @@ struct metapage *__get_metapage(struct inode *inode, unsigned long lblock, | |||
641 | } else { | 640 | } else { |
642 | page = read_cache_page(mapping, page_index, | 641 | page = read_cache_page(mapping, page_index, |
643 | (filler_t *)mapping->a_ops->readpage, NULL); | 642 | (filler_t *)mapping->a_ops->readpage, NULL); |
644 | if (IS_ERR(page)) { | 643 | if (IS_ERR(page) || !PageUptodate(page)) { |
645 | jfs_err("read_cache_page failed!"); | 644 | jfs_err("read_cache_page failed!"); |
646 | return NULL; | 645 | return NULL; |
647 | } | 646 | } |
@@ -783,14 +782,6 @@ void release_metapage(struct metapage * mp) | |||
783 | if (test_bit(META_discard, &mp->flag) && !mp->count) { | 782 | if (test_bit(META_discard, &mp->flag) && !mp->count) { |
784 | clear_page_dirty(page); | 783 | clear_page_dirty(page); |
785 | ClearPageUptodate(page); | 784 | ClearPageUptodate(page); |
786 | #ifdef _NOT_YET | ||
787 | if (page->mapping) { | ||
788 | /* Remove from page cache and page cache reference */ | ||
789 | remove_from_page_cache(page); | ||
790 | page_cache_release(page); | ||
791 | metapage_releasepage(page, 0); | ||
792 | } | ||
793 | #endif | ||
794 | } | 785 | } |
795 | #else | 786 | #else |
796 | /* Try to keep metapages from using up too much memory */ | 787 | /* Try to keep metapages from using up too much memory */ |