Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

jffs2: Remove jffs2_gc_fetch_page and jffs2_gc_release_page

Merge these two helpers into the only callers to get rid of some
amazingly bad calling conventions.

Suggested-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Richard Weinberger <richard@nod.at>

authored by

Christoph Hellwig and committed by
Richard Weinberger
61b875e8 f2538f99

+13 -38
-27
fs/jffs2/fs.c
··· 678 678 return JFFS2_INODE_INFO(inode); 679 679 } 680 680 681 - unsigned char *jffs2_gc_fetch_page(struct jffs2_sb_info *c, 682 - struct jffs2_inode_info *f, 683 - unsigned long offset, 684 - unsigned long *priv) 685 - { 686 - struct inode *inode = OFNI_EDONI_2SFFJ(f); 687 - struct page *pg; 688 - 689 - pg = read_cache_page(inode->i_mapping, offset >> PAGE_SHIFT, 690 - jffs2_do_readpage_unlock, inode); 691 - if (IS_ERR(pg)) 692 - return (void *)pg; 693 - 694 - *priv = (unsigned long)pg; 695 - return kmap(pg); 696 - } 697 - 698 - void jffs2_gc_release_page(struct jffs2_sb_info *c, 699 - unsigned char *ptr, 700 - unsigned long *priv) 701 - { 702 - struct page *pg = (void *)*priv; 703 - 704 - kunmap(pg); 705 - put_page(pg); 706 - } 707 - 708 681 static int jffs2_flash_setup(struct jffs2_sb_info *c) { 709 682 int ret = 0; 710 683
+13 -8
fs/jffs2/gc.c
··· 1165 1165 struct jffs2_inode_info *f, struct jffs2_full_dnode *fn, 1166 1166 uint32_t start, uint32_t end) 1167 1167 { 1168 + struct inode *inode = OFNI_EDONI_2SFFJ(f); 1168 1169 struct jffs2_full_dnode *new_fn; 1169 1170 struct jffs2_raw_inode ri; 1170 1171 uint32_t alloclen, offset, orig_end, orig_start; 1171 1172 int ret = 0; 1172 1173 unsigned char *comprbuf = NULL, *writebuf; 1173 - unsigned long pg; 1174 + struct page *page; 1174 1175 unsigned char *pg_ptr; 1175 1176 1176 1177 memset(&ri, 0, sizeof(ri)); ··· 1326 1325 * end up here trying to GC the *same* page that jffs2_write_begin() is 1327 1326 * trying to write out, read_cache_page() will not deadlock. */ 1328 1327 mutex_unlock(&f->sem); 1329 - pg_ptr = jffs2_gc_fetch_page(c, f, start, &pg); 1330 - mutex_lock(&f->sem); 1331 - 1332 - if (IS_ERR(pg_ptr)) { 1328 + page = read_cache_page(inode->i_mapping, start >> PAGE_SHIFT, 1329 + jffs2_do_readpage_unlock, inode); 1330 + if (IS_ERR(page)) { 1333 1331 pr_warn("read_cache_page() returned error: %ld\n", 1334 - PTR_ERR(pg_ptr)); 1335 - return PTR_ERR(pg_ptr); 1332 + PTR_ERR(page)); 1333 + mutex_lock(&f->sem); 1334 + return PTR_ERR(page); 1336 1335 } 1336 + 1337 + pg_ptr = kmap(page); 1338 + mutex_lock(&f->sem); 1337 1339 1338 1340 offset = start; 1339 1341 while(offset < orig_end) { ··· 1400 1396 } 1401 1397 } 1402 1398 1403 - jffs2_gc_release_page(c, pg_ptr, &pg); 1399 + kunmap(page); 1400 + put_page(page); 1404 1401 return ret; 1405 1402 }
-3
fs/jffs2/os-linux.h
··· 183 183 struct jffs2_inode_info *f, 184 184 unsigned long offset, 185 185 unsigned long *priv); 186 - void jffs2_gc_release_page(struct jffs2_sb_info *c, 187 - unsigned char *pg, 188 - unsigned long *priv); 189 186 void jffs2_flash_cleanup(struct jffs2_sb_info *c); 190 187 191 188