aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/jfs/jfs_dtree.c2
-rw-r--r--fs/jfs/jfs_logmgr.c62
-rw-r--r--fs/jfs/jfs_logmgr.h3
3 files changed, 39 insertions, 28 deletions
diff --git a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c
index e357890adfb2..453bace608d1 100644
--- a/fs/jfs/jfs_dtree.c
+++ b/fs/jfs/jfs_dtree.c
@@ -3181,7 +3181,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
3181 d = (struct ldtentry *) & p->slot[stbl[i]]; 3181 d = (struct ldtentry *) & p->slot[stbl[i]];
3182 3182
3183 if (((long) jfs_dirent + d->namlen + 1) > 3183 if (((long) jfs_dirent + d->namlen + 1) >
3184 (dirent_buf + PSIZE)) { 3184 (dirent_buf + PAGE_SIZE)) {
3185 /* DBCS codepages could overrun dirent_buf */ 3185 /* DBCS codepages could overrun dirent_buf */
3186 index = i; 3186 index = i;
3187 overflow = 1; 3187 overflow = 1;
diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c
index b6a6869ebb4f..e0f867ddfd10 100644
--- a/fs/jfs/jfs_logmgr.c
+++ b/fs/jfs/jfs_logmgr.c
@@ -1669,6 +1669,7 @@ int lmLogShutdown(struct jfs_log * log)
1669 lp->h.eor = lp->t.eor = cpu_to_le16(bp->l_eor); 1669 lp->h.eor = lp->t.eor = cpu_to_le16(bp->l_eor);
1670 lbmWrite(log, log->bp, lbmWRITE | lbmRELEASE | lbmSYNC, 0); 1670 lbmWrite(log, log->bp, lbmWRITE | lbmRELEASE | lbmSYNC, 0);
1671 lbmIOWait(log->bp, lbmFREE); 1671 lbmIOWait(log->bp, lbmFREE);
1672 log->bp = NULL;
1672 1673
1673 /* 1674 /*
1674 * synchronous update log superblock 1675 * synchronous update log superblock
@@ -1819,20 +1820,34 @@ static int lbmLogInit(struct jfs_log * log)
1819 1820
1820 log->lbuf_free = NULL; 1821 log->lbuf_free = NULL;
1821 1822
1822 for (i = 0; i < LOGPAGES; i++) { 1823 for (i = 0; i < LOGPAGES;) {
1823 lbuf = kmalloc(sizeof(struct lbuf), GFP_KERNEL); 1824 char *buffer;
1824 if (lbuf == 0) 1825 uint offset;
1825 goto error; 1826 struct page *page;
1826 lbuf->l_ldata = (char *) get_zeroed_page(GFP_KERNEL); 1827
1827 if (lbuf->l_ldata == 0) { 1828 buffer = (char *) get_zeroed_page(GFP_KERNEL);
1828 kfree(lbuf); 1829 if (buffer == NULL)
1829 goto error; 1830 goto error;
1831 page = virt_to_page(buffer);
1832 for (offset = 0; offset < PAGE_SIZE; offset += LOGPSIZE) {
1833 lbuf = kmalloc(sizeof(struct lbuf), GFP_KERNEL);
1834 if (lbuf == NULL) {
1835 if (offset == 0)
1836 free_page((unsigned long) buffer);
1837 goto error;
1838 }
1839 if (offset) /* we already have one reference */
1840 get_page(page);
1841 lbuf->l_offset = offset;
1842 lbuf->l_ldata = buffer + offset;
1843 lbuf->l_page = page;
1844 lbuf->l_log = log;
1845 init_waitqueue_head(&lbuf->l_ioevent);
1846
1847 lbuf->l_freelist = log->lbuf_free;
1848 log->lbuf_free = lbuf;
1849 i++;
1830 } 1850 }
1831 lbuf->l_log = log;
1832 init_waitqueue_head(&lbuf->l_ioevent);
1833
1834 lbuf->l_freelist = log->lbuf_free;
1835 log->lbuf_free = lbuf;
1836 } 1851 }
1837 1852
1838 return (0); 1853 return (0);
@@ -1857,12 +1872,10 @@ static void lbmLogShutdown(struct jfs_log * log)
1857 lbuf = log->lbuf_free; 1872 lbuf = log->lbuf_free;
1858 while (lbuf) { 1873 while (lbuf) {
1859 struct lbuf *next = lbuf->l_freelist; 1874 struct lbuf *next = lbuf->l_freelist;
1860 free_page((unsigned long) lbuf->l_ldata); 1875 __free_page(lbuf->l_page);
1861 kfree(lbuf); 1876 kfree(lbuf);
1862 lbuf = next; 1877 lbuf = next;
1863 } 1878 }
1864
1865 log->bp = NULL;
1866} 1879}
1867 1880
1868 1881
@@ -1974,9 +1987,9 @@ static int lbmRead(struct jfs_log * log, int pn, struct lbuf ** bpp)
1974 1987
1975 bio->bi_sector = bp->l_blkno << (log->l2bsize - 9); 1988 bio->bi_sector = bp->l_blkno << (log->l2bsize - 9);
1976 bio->bi_bdev = log->bdev; 1989 bio->bi_bdev = log->bdev;
1977 bio->bi_io_vec[0].bv_page = virt_to_page(bp->l_ldata); 1990 bio->bi_io_vec[0].bv_page = bp->l_page;
1978 bio->bi_io_vec[0].bv_len = LOGPSIZE; 1991 bio->bi_io_vec[0].bv_len = LOGPSIZE;
1979 bio->bi_io_vec[0].bv_offset = 0; 1992 bio->bi_io_vec[0].bv_offset = bp->l_offset;
1980 1993
1981 bio->bi_vcnt = 1; 1994 bio->bi_vcnt = 1;
1982 bio->bi_idx = 0; 1995 bio->bi_idx = 0;
@@ -2115,9 +2128,9 @@ static void lbmStartIO(struct lbuf * bp)
2115 bio = bio_alloc(GFP_NOFS, 1); 2128 bio = bio_alloc(GFP_NOFS, 1);
2116 bio->bi_sector = bp->l_blkno << (log->l2bsize - 9); 2129 bio->bi_sector = bp->l_blkno << (log->l2bsize - 9);
2117 bio->bi_bdev = log->bdev; 2130 bio->bi_bdev = log->bdev;
2118 bio->bi_io_vec[0].bv_page = virt_to_page(bp->l_ldata); 2131 bio->bi_io_vec[0].bv_page = bp->l_page;
2119 bio->bi_io_vec[0].bv_len = LOGPSIZE; 2132 bio->bi_io_vec[0].bv_len = LOGPSIZE;
2120 bio->bi_io_vec[0].bv_offset = 0; 2133 bio->bi_io_vec[0].bv_offset = bp->l_offset;
2121 2134
2122 bio->bi_vcnt = 1; 2135 bio->bi_vcnt = 1;
2123 bio->bi_idx = 0; 2136 bio->bi_idx = 0;
@@ -2127,16 +2140,13 @@ static void lbmStartIO(struct lbuf * bp)
2127 bio->bi_private = bp; 2140 bio->bi_private = bp;
2128 2141
2129 /* check if journaling to disk has been disabled */ 2142 /* check if journaling to disk has been disabled */
2130 if (!log->no_integrity) { 2143 if (log->no_integrity) {
2144 bio->bi_size = 0;
2145 lbmIODone(bio, 0, 0);
2146 } else {
2131 submit_bio(WRITE_SYNC, bio); 2147 submit_bio(WRITE_SYNC, bio);
2132 INCREMENT(lmStat.submitted); 2148 INCREMENT(lmStat.submitted);
2133 } 2149 }
2134 else {
2135 bio->bi_size = 0;
2136 lbmIODone(bio, 0, 0); /* 2nd argument appears to not be used => 0
2137 * 3rd argument appears to not be used => 0
2138 */
2139 }
2140} 2150}
2141 2151
2142 2152
diff --git a/fs/jfs/jfs_logmgr.h b/fs/jfs/jfs_logmgr.h
index 141ad74010c9..f67146684b7f 100644
--- a/fs/jfs/jfs_logmgr.h
+++ b/fs/jfs/jfs_logmgr.h
@@ -463,9 +463,10 @@ struct lbuf {
463 463
464 s64 l_blkno; /* 8: log page block number */ 464 s64 l_blkno; /* 8: log page block number */
465 caddr_t l_ldata; /* 4: data page */ 465 caddr_t l_ldata; /* 4: data page */
466 struct page *l_page; /* The page itself */
467 uint l_offset; /* Offset of l_ldata within the page */
466 468
467 wait_queue_head_t l_ioevent; /* 4: i/o done event */ 469 wait_queue_head_t l_ioevent; /* 4: i/o done event */
468 struct page *l_page; /* The page itself */
469}; 470};
470 471
471/* Reuse l_freelist for redrive list */ 472/* Reuse l_freelist for redrive list */