diff options
author | Christoph Hellwig <hch@lst.de> | 2019-07-24 03:15:25 -0400 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2019-09-15 16:42:33 -0400 |
commit | 61b875e88a04fd626e68c657400f237af8afa95e (patch) | |
tree | 649e05ab656c518c00688ee5fbf4ebfeb49d11e1 | |
parent | f2538f999345405f7d2e1194c0c8efa4e11f7b3a (diff) |
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>
-rw-r--r-- | fs/jffs2/fs.c | 27 | ||||
-rw-r--r-- | fs/jffs2/gc.c | 21 | ||||
-rw-r--r-- | fs/jffs2/os-linux.h | 3 |
3 files changed, 13 insertions, 38 deletions
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c index 8a20ddd25f2d..a3193c0f3a9b 100644 --- a/fs/jffs2/fs.c +++ b/fs/jffs2/fs.c | |||
@@ -678,33 +678,6 @@ struct jffs2_inode_info *jffs2_gc_fetch_inode(struct jffs2_sb_info *c, | |||
678 | return JFFS2_INODE_INFO(inode); | 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 | static int jffs2_flash_setup(struct jffs2_sb_info *c) { | 681 | static int jffs2_flash_setup(struct jffs2_sb_info *c) { |
709 | int ret = 0; | 682 | int ret = 0; |
710 | 683 | ||
diff --git a/fs/jffs2/gc.c b/fs/jffs2/gc.c index 9ed0f26cf023..373b3b7c9f44 100644 --- a/fs/jffs2/gc.c +++ b/fs/jffs2/gc.c | |||
@@ -1165,12 +1165,13 @@ static int jffs2_garbage_collect_dnode(struct jffs2_sb_info *c, struct jffs2_era | |||
1165 | struct jffs2_inode_info *f, struct jffs2_full_dnode *fn, | 1165 | struct jffs2_inode_info *f, struct jffs2_full_dnode *fn, |
1166 | uint32_t start, uint32_t end) | 1166 | uint32_t start, uint32_t end) |
1167 | { | 1167 | { |
1168 | struct inode *inode = OFNI_EDONI_2SFFJ(f); | ||
1168 | struct jffs2_full_dnode *new_fn; | 1169 | struct jffs2_full_dnode *new_fn; |
1169 | struct jffs2_raw_inode ri; | 1170 | struct jffs2_raw_inode ri; |
1170 | uint32_t alloclen, offset, orig_end, orig_start; | 1171 | uint32_t alloclen, offset, orig_end, orig_start; |
1171 | int ret = 0; | 1172 | int ret = 0; |
1172 | unsigned char *comprbuf = NULL, *writebuf; | 1173 | unsigned char *comprbuf = NULL, *writebuf; |
1173 | unsigned long pg; | 1174 | struct page *page; |
1174 | unsigned char *pg_ptr; | 1175 | unsigned char *pg_ptr; |
1175 | 1176 | ||
1176 | memset(&ri, 0, sizeof(ri)); | 1177 | memset(&ri, 0, sizeof(ri)); |
@@ -1325,15 +1326,18 @@ static int jffs2_garbage_collect_dnode(struct jffs2_sb_info *c, struct jffs2_era | |||
1325 | * end up here trying to GC the *same* page that jffs2_write_begin() is | 1326 | * end up here trying to GC the *same* page that jffs2_write_begin() is |
1326 | * trying to write out, read_cache_page() will not deadlock. */ | 1327 | * trying to write out, read_cache_page() will not deadlock. */ |
1327 | mutex_unlock(&f->sem); | 1328 | mutex_unlock(&f->sem); |
1328 | pg_ptr = jffs2_gc_fetch_page(c, f, start, &pg); | 1329 | page = read_cache_page(inode->i_mapping, start >> PAGE_SHIFT, |
1329 | mutex_lock(&f->sem); | 1330 | jffs2_do_readpage_unlock, inode); |
1330 | 1331 | if (IS_ERR(page)) { | |
1331 | if (IS_ERR(pg_ptr)) { | ||
1332 | pr_warn("read_cache_page() returned error: %ld\n", | 1332 | pr_warn("read_cache_page() returned error: %ld\n", |
1333 | PTR_ERR(pg_ptr)); | 1333 | PTR_ERR(page)); |
1334 | return PTR_ERR(pg_ptr); | 1334 | mutex_lock(&f->sem); |
1335 | return PTR_ERR(page); | ||
1335 | } | 1336 | } |
1336 | 1337 | ||
1338 | pg_ptr = kmap(page); | ||
1339 | mutex_lock(&f->sem); | ||
1340 | |||
1337 | offset = start; | 1341 | offset = start; |
1338 | while(offset < orig_end) { | 1342 | while(offset < orig_end) { |
1339 | uint32_t datalen; | 1343 | uint32_t datalen; |
@@ -1396,6 +1400,7 @@ static int jffs2_garbage_collect_dnode(struct jffs2_sb_info *c, struct jffs2_era | |||
1396 | } | 1400 | } |
1397 | } | 1401 | } |
1398 | 1402 | ||
1399 | jffs2_gc_release_page(c, pg_ptr, &pg); | 1403 | kunmap(page); |
1404 | put_page(page); | ||
1400 | return ret; | 1405 | return ret; |
1401 | } | 1406 | } |
diff --git a/fs/jffs2/os-linux.h b/fs/jffs2/os-linux.h index bd3d5f0ddc34..f4895dda26a3 100644 --- a/fs/jffs2/os-linux.h +++ b/fs/jffs2/os-linux.h | |||
@@ -183,9 +183,6 @@ unsigned char *jffs2_gc_fetch_page(struct jffs2_sb_info *c, | |||
183 | struct jffs2_inode_info *f, | 183 | struct jffs2_inode_info *f, |
184 | unsigned long offset, | 184 | unsigned long offset, |
185 | unsigned long *priv); | 185 | unsigned long *priv); |
186 | void jffs2_gc_release_page(struct jffs2_sb_info *c, | ||
187 | unsigned char *pg, | ||
188 | unsigned long *priv); | ||
189 | void jffs2_flash_cleanup(struct jffs2_sb_info *c); | 186 | void jffs2_flash_cleanup(struct jffs2_sb_info *c); |
190 | 187 | ||
191 | 188 | ||