mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-05 15:15:44 +00:00
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>
This commit is contained in:
committed by
Sebastian Huber
parent
9d9bfe5948
commit
cdac3ca64a
@@ -1316,30 +1316,6 @@ int rtems_jffs2_initialize(
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
unsigned char *jffs2_gc_fetch_page(struct jffs2_sb_info *c,
|
||||
struct jffs2_inode_info *f,
|
||||
unsigned long offset,
|
||||
unsigned long *priv)
|
||||
{
|
||||
int ret;
|
||||
struct super_block *sb = OFNI_BS_2SFFJ(c);
|
||||
unsigned char *gc_buffer = &sb->s_gc_buffer[0];
|
||||
|
||||
ret = jffs2_read_inode_range(c, f, gc_buffer,
|
||||
offset & ~(PAGE_CACHE_SIZE-1), PAGE_CACHE_SIZE);
|
||||
if (ret)
|
||||
return ERR_PTR(ret);
|
||||
|
||||
return gc_buffer;
|
||||
}
|
||||
|
||||
void jffs2_gc_release_page(struct jffs2_sb_info *c,
|
||||
unsigned char *ptr,
|
||||
unsigned long *priv)
|
||||
{
|
||||
/* Do nothing */
|
||||
}
|
||||
|
||||
static struct _inode *new_inode(struct super_block *sb)
|
||||
{
|
||||
|
||||
|
||||
@@ -1173,12 +1173,17 @@ static int jffs2_garbage_collect_dnode(struct jffs2_sb_info *c, struct jffs2_era
|
||||
struct jffs2_inode_info *f, struct jffs2_full_dnode *fn,
|
||||
uint32_t start, uint32_t end)
|
||||
{
|
||||
#ifndef __rtems__
|
||||
struct inode *inode = OFNI_EDONI_2SFFJ(f);
|
||||
#endif /* __rtems__ */
|
||||
struct jffs2_full_dnode *new_fn;
|
||||
struct jffs2_raw_inode ri;
|
||||
uint32_t alloclen, offset, orig_end, orig_start;
|
||||
int ret = 0;
|
||||
unsigned char *comprbuf = NULL, *writebuf;
|
||||
unsigned long pg;
|
||||
#ifndef __rtems__
|
||||
struct page *page;
|
||||
#endif /* __rtems__ */
|
||||
unsigned char *pg_ptr;
|
||||
|
||||
memset(&ri, 0, sizeof(ri));
|
||||
@@ -1333,15 +1338,26 @@ static int jffs2_garbage_collect_dnode(struct jffs2_sb_info *c, struct jffs2_era
|
||||
* end up here trying to GC the *same* page that jffs2_write_begin() is
|
||||
* trying to write out, read_cache_page() will not deadlock. */
|
||||
mutex_unlock(&f->sem);
|
||||
pg_ptr = jffs2_gc_fetch_page(c, f, start, &pg);
|
||||
mutex_lock(&f->sem);
|
||||
|
||||
if (IS_ERR(pg_ptr)) {
|
||||
#ifndef __rtems__
|
||||
page = read_cache_page(inode->i_mapping, start >> PAGE_SHIFT,
|
||||
jffs2_do_readpage_unlock, inode);
|
||||
if (IS_ERR(page)) {
|
||||
pr_warn("read_cache_page() returned error: %ld\n",
|
||||
PTR_ERR(pg_ptr));
|
||||
return PTR_ERR(pg_ptr);
|
||||
PTR_ERR(page));
|
||||
mutex_lock(&f->sem);
|
||||
return PTR_ERR(page);
|
||||
}
|
||||
|
||||
pg_ptr = kmap(page);
|
||||
#else /* __rtems__ */
|
||||
pg_ptr = &OFNI_BS_2SFFJ(c)->s_gc_buffer[0];
|
||||
ret = jffs2_read_inode_range(c, f, pg_ptr,
|
||||
start & ~(PAGE_CACHE_SIZE-1), PAGE_CACHE_SIZE);
|
||||
if (ret)
|
||||
return ret;
|
||||
#endif /* __rtems__ */
|
||||
mutex_lock(&f->sem);
|
||||
|
||||
offset = start;
|
||||
while(offset < orig_end) {
|
||||
uint32_t datalen;
|
||||
@@ -1404,6 +1420,9 @@ static int jffs2_garbage_collect_dnode(struct jffs2_sb_info *c, struct jffs2_era
|
||||
}
|
||||
}
|
||||
|
||||
jffs2_gc_release_page(c, pg_ptr, &pg);
|
||||
#ifndef __rtems__
|
||||
kunmap(page);
|
||||
put_page(page);
|
||||
#endif /* __rtems__ */
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -136,9 +136,6 @@ struct _inode *jffs2_iget(struct super_block *sb, cyg_uint32 ino);
|
||||
void jffs2_iput(struct _inode * i);
|
||||
void jffs2_gc_release_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f);
|
||||
struct jffs2_inode_info *jffs2_gc_fetch_inode(struct jffs2_sb_info *c, int inum, int nlink);
|
||||
unsigned char *jffs2_gc_fetch_page(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
|
||||
unsigned long offset, unsigned long *priv);
|
||||
void jffs2_gc_release_page(struct jffs2_sb_info *c, unsigned char *pg, unsigned long *priv);
|
||||
|
||||
/* Avoid polluting RTEMS namespace with names not starting in jffs2_ */
|
||||
#define os_to_jffs2_mode(x) jffs2_from_os_mode(x)
|
||||
|
||||
Reference in New Issue
Block a user