aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jfs/jfs_logmgr.c
diff options
context:
space:
mode:
authorDave Kleikamp <shaggy@austin.ibm.com>2005-05-02 14:24:57 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-03 01:23:53 -0400
commitdc5798d9a7b656550533a5c0177dba17d4ef4990 (patch)
tree3ae0b6a6b4d85efbc4ccae6f9567d1c461292c01 /fs/jfs/jfs_logmgr.c
parentd2e83707edbe6a2520591141421d26a87414a1b9 (diff)
[PATCH] JFS: Changes for larger page size
JFS code has always assumed a page size of 4K. This patch fixes the non-pagecache uses of pages to deal with larger pages. Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/jfs/jfs_logmgr.c')
-rw-r--r--fs/jfs/jfs_logmgr.c62
1 files changed, 36 insertions, 26 deletions
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