Commit 6951abe8 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'jffs2-for-linus-6.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs

Pull jffs2 updates from Richard Weinberger:

 - Fix illegal memory access in jffs2_free_inode()

 - Kernel-doc fixes

 - print symbolic error names

* tag 'jffs2-for-linus-6.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs:
  jffs2: Fix potential illegal address access in jffs2_free_inode
  jffs2: Simplify the allocation of slab caches
  jffs2: nodemgmt: fix kernel-doc comments
  jffs2: print symbolic error name instead of error code
parents 2313022e af9a8730
...@@ -44,8 +44,8 @@ int jffs2_start_garbage_collect_thread(struct jffs2_sb_info *c) ...@@ -44,8 +44,8 @@ int jffs2_start_garbage_collect_thread(struct jffs2_sb_info *c)
tsk = kthread_run(jffs2_garbage_collect_thread, c, "jffs2_gcd_mtd%d", c->mtd->index); tsk = kthread_run(jffs2_garbage_collect_thread, c, "jffs2_gcd_mtd%d", c->mtd->index);
if (IS_ERR(tsk)) { if (IS_ERR(tsk)) {
pr_warn("fork failed for JFFS2 garbage collect thread: %ld\n", pr_warn("fork failed for JFFS2 garbage collect thread: %pe\n",
-PTR_ERR(tsk)); tsk);
complete(&c->gc_thread_exit); complete(&c->gc_thread_exit);
ret = PTR_ERR(tsk); ret = PTR_ERR(tsk);
} else { } else {
......
...@@ -33,27 +33,19 @@ static struct kmem_cache *xattr_ref_cache; ...@@ -33,27 +33,19 @@ static struct kmem_cache *xattr_ref_cache;
int __init jffs2_create_slab_caches(void) int __init jffs2_create_slab_caches(void)
{ {
full_dnode_slab = kmem_cache_create("jffs2_full_dnode", full_dnode_slab = KMEM_CACHE(jffs2_full_dnode, 0);
sizeof(struct jffs2_full_dnode),
0, 0, NULL);
if (!full_dnode_slab) if (!full_dnode_slab)
goto err; goto err;
raw_dirent_slab = kmem_cache_create("jffs2_raw_dirent", raw_dirent_slab = KMEM_CACHE(jffs2_raw_dirent, SLAB_HWCACHE_ALIGN);
sizeof(struct jffs2_raw_dirent),
0, SLAB_HWCACHE_ALIGN, NULL);
if (!raw_dirent_slab) if (!raw_dirent_slab)
goto err; goto err;
raw_inode_slab = kmem_cache_create("jffs2_raw_inode", raw_inode_slab = KMEM_CACHE(jffs2_raw_inode, SLAB_HWCACHE_ALIGN);
sizeof(struct jffs2_raw_inode),
0, SLAB_HWCACHE_ALIGN, NULL);
if (!raw_inode_slab) if (!raw_inode_slab)
goto err; goto err;
tmp_dnode_info_slab = kmem_cache_create("jffs2_tmp_dnode", tmp_dnode_info_slab = KMEM_CACHE(jffs2_tmp_dnode_info, 0);
sizeof(struct jffs2_tmp_dnode_info),
0, 0, NULL);
if (!tmp_dnode_info_slab) if (!tmp_dnode_info_slab)
goto err; goto err;
...@@ -63,28 +55,20 @@ int __init jffs2_create_slab_caches(void) ...@@ -63,28 +55,20 @@ int __init jffs2_create_slab_caches(void)
if (!raw_node_ref_slab) if (!raw_node_ref_slab)
goto err; goto err;
node_frag_slab = kmem_cache_create("jffs2_node_frag", node_frag_slab = KMEM_CACHE(jffs2_node_frag, 0);
sizeof(struct jffs2_node_frag),
0, 0, NULL);
if (!node_frag_slab) if (!node_frag_slab)
goto err; goto err;
inode_cache_slab = kmem_cache_create("jffs2_inode_cache", inode_cache_slab = KMEM_CACHE(jffs2_inode_cache, 0);
sizeof(struct jffs2_inode_cache),
0, 0, NULL);
if (!inode_cache_slab) if (!inode_cache_slab)
goto err; goto err;
#ifdef CONFIG_JFFS2_FS_XATTR #ifdef CONFIG_JFFS2_FS_XATTR
xattr_datum_cache = kmem_cache_create("jffs2_xattr_datum", xattr_datum_cache = KMEM_CACHE(jffs2_xattr_datum, 0);
sizeof(struct jffs2_xattr_datum),
0, 0, NULL);
if (!xattr_datum_cache) if (!xattr_datum_cache)
goto err; goto err;
xattr_ref_cache = kmem_cache_create("jffs2_xattr_ref", xattr_ref_cache = KMEM_CACHE(jffs2_xattr_ref, 0);
sizeof(struct jffs2_xattr_ref),
0, 0, NULL);
if (!xattr_ref_cache) if (!xattr_ref_cache)
goto err; goto err;
#endif #endif
......
...@@ -49,28 +49,31 @@ static int jffs2_rp_can_write(struct jffs2_sb_info *c) ...@@ -49,28 +49,31 @@ static int jffs2_rp_can_write(struct jffs2_sb_info *c)
return 0; return 0;
} }
static int jffs2_do_reserve_space(struct jffs2_sb_info *c, uint32_t minsize,
uint32_t *len, uint32_t sumsize);
/** /**
* jffs2_reserve_space - request physical space to write nodes to flash * jffs2_reserve_space - request physical space to write nodes to flash
* @c: superblock info * @c: superblock info
* @minsize: Minimum acceptable size of allocation * @minsize: Minimum acceptable size of allocation
* @len: Returned value of allocation length * @len: Returned value of allocation length
* @prio: Allocation type - ALLOC_{NORMAL,DELETION} * @prio: Allocation type - ALLOC_{NORMAL,DELETION}
* @sumsize: summary size requested or JFFS2_SUMMARY_NOSUM_SIZE for no summary
*
* Requests a block of physical space on the flash.
* *
* Requests a block of physical space on the flash. Returns zero for success * Returns: %0 for success and puts 'len' into the appropriate place,
* and puts 'len' into the appropriate place, or returns -ENOSPC or other * or returns -ENOSPC or other error if appropriate.
* error if appropriate. Doesn't return len since that's * Doesn't return len since that's already returned in @len.
* *
* If it returns zero, jffs2_reserve_space() also downs the per-filesystem * If it returns %0, jffs2_reserve_space() also downs the per-filesystem
* allocation semaphore, to prevent more than one allocation from being * allocation semaphore, to prevent more than one allocation from being
* active at any time. The semaphore is later released by jffs2_commit_allocation() * active at any time. The semaphore is later released by jffs2_commit_allocation().
* *
* jffs2_reserve_space() may trigger garbage collection in order to make room * jffs2_reserve_space() may trigger garbage collection in order to make room
* for the requested allocation. * for the requested allocation.
*/ */
static int jffs2_do_reserve_space(struct jffs2_sb_info *c, uint32_t minsize,
uint32_t *len, uint32_t sumsize);
int jffs2_reserve_space(struct jffs2_sb_info *c, uint32_t minsize, int jffs2_reserve_space(struct jffs2_sb_info *c, uint32_t minsize,
uint32_t *len, int prio, uint32_t sumsize) uint32_t *len, int prio, uint32_t sumsize)
{ {
...@@ -488,13 +491,16 @@ static int jffs2_do_reserve_space(struct jffs2_sb_info *c, uint32_t minsize, ...@@ -488,13 +491,16 @@ static int jffs2_do_reserve_space(struct jffs2_sb_info *c, uint32_t minsize,
/** /**
* jffs2_add_physical_node_ref - add a physical node reference to the list * jffs2_add_physical_node_ref - add a physical node reference to the list
* @c: superblock info * @c: superblock info
* @new: new node reference to add * @ofs: offset in the block
* @len: length of this physical node * @len: length of this physical node
* @ic: inode cache pointer
* *
* Should only be used to report nodes for which space has been allocated * Should only be used to report nodes for which space has been allocated
* by jffs2_reserve_space. * by jffs2_reserve_space.
* *
* Must be called with the alloc_sem held. * Must be called with the alloc_sem held.
*
* Returns: pointer to new node on success or -errno code on error
*/ */
struct jffs2_raw_node_ref *jffs2_add_physical_node_ref(struct jffs2_sb_info *c, struct jffs2_raw_node_ref *jffs2_add_physical_node_ref(struct jffs2_sb_info *c,
......
...@@ -58,6 +58,7 @@ static void jffs2_i_init_once(void *foo) ...@@ -58,6 +58,7 @@ static void jffs2_i_init_once(void *foo)
struct jffs2_inode_info *f = foo; struct jffs2_inode_info *f = foo;
mutex_init(&f->sem); mutex_init(&f->sem);
f->target = NULL;
inode_init_once(&f->vfs_inode); inode_init_once(&f->vfs_inode);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment