Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2318aa27 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull f2fs bug fixes from Jaegeuk Kim:
 "This patch-set includes two major bug fixes:
   - incorrect IUsed provided by *df -i*, and
   - lookup failure of parent inodes in corner cases.

  [Other Bug Fixes]
   - Fix error handling routines
   - Trigger recovery process correctly
   - Resolve build failures due to missing header files

  [Etc]
   - Add a MAINTAINERS entry for f2fs
   - Fix and clean up variables, functions, and equations
   - Avoid warnings during compilation"

* tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs:
  f2fs: unify string length declarations and usage
  f2fs: clean up unused variables and return values
  f2fs: clean up the start_bidx_of_node function
  f2fs: remove unneeded variable from f2fs_sync_fs
  f2fs: fix fsync_inode list addition logic and avoid invalid access to memory
  f2fs: remove unneeded initialization of nr_dirty in dirty_seglist_info
  f2fs: handle error from f2fs_iget_nowait
  f2fs: fix equation of has_not_enough_free_secs()
  f2fs: add MAINTAINERS entry
  f2fs: return a default value for non-void function
  f2fs: invalidate the node page if allocation is failed
  f2fs: add missing #include <linux/prefetch.h>
  f2fs: do f2fs_balance_fs in front of dir operations
  f2fs: should recover orphan and fsync data
  f2fs: fix handling errors got by f2fs_write_inode
  f2fs: fix up f2fs_get_parent issue to retrieve correct parent inode number
  f2fs: fix wrong calculation on f_files in statfs
  f2fs: remove set_page_dirty for atomic f2fs_end_io_write
parents ed4e6a94 9836b8b9
Loading
Loading
Loading
Loading
+10 −0
Original line number Original line Diff line number Diff line
@@ -3273,6 +3273,16 @@ F: Documentation/filesystems/caching/
F:	fs/fscache/
F:	fs/fscache/
F:	include/linux/fscache*.h
F:	include/linux/fscache*.h


F2FS FILE SYSTEM
M:	Jaegeuk Kim <jaegeuk.kim@samsung.com>
L:	linux-f2fs-devel@lists.sourceforge.net
W:	http://en.wikipedia.org/wiki/F2FS
T:	git git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git
S:	Maintained
F:	Documentation/filesystems/f2fs.txt
F:	fs/f2fs/
F:	include/linux/f2fs_fs.h

FUJITSU FR-V (FRV) PORT
FUJITSU FR-V (FRV) PORT
M:	David Howells <dhowells@redhat.com>
M:	David Howells <dhowells@redhat.com>
S:	Maintained
S:	Maintained
+1 −0
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@
#include <linux/backing-dev.h>
#include <linux/backing-dev.h>
#include <linux/blkdev.h>
#include <linux/blkdev.h>
#include <linux/bio.h>
#include <linux/bio.h>
#include <linux/prefetch.h>


#include "f2fs.h"
#include "f2fs.h"
#include "node.h"
#include "node.h"
+9 −7
Original line number Original line Diff line number Diff line
@@ -11,6 +11,7 @@
#include <linux/fs.h>
#include <linux/fs.h>
#include <linux/f2fs_fs.h>
#include <linux/f2fs_fs.h>
#include "f2fs.h"
#include "f2fs.h"
#include "node.h"
#include "acl.h"
#include "acl.h"


static unsigned long dir_blocks(struct inode *inode)
static unsigned long dir_blocks(struct inode *inode)
@@ -74,7 +75,7 @@ static unsigned long dir_block_index(unsigned int level, unsigned int idx)
	return bidx;
	return bidx;
}
}


static bool early_match_name(const char *name, int namelen,
static bool early_match_name(const char *name, size_t namelen,
			f2fs_hash_t namehash, struct f2fs_dir_entry *de)
			f2fs_hash_t namehash, struct f2fs_dir_entry *de)
{
{
	if (le16_to_cpu(de->name_len) != namelen)
	if (le16_to_cpu(de->name_len) != namelen)
@@ -87,7 +88,7 @@ static bool early_match_name(const char *name, int namelen,
}
}


static struct f2fs_dir_entry *find_in_block(struct page *dentry_page,
static struct f2fs_dir_entry *find_in_block(struct page *dentry_page,
			const char *name, int namelen, int *max_slots,
			const char *name, size_t namelen, int *max_slots,
			f2fs_hash_t namehash, struct page **res_page)
			f2fs_hash_t namehash, struct page **res_page)
{
{
	struct f2fs_dir_entry *de;
	struct f2fs_dir_entry *de;
@@ -126,7 +127,7 @@ found:
}
}


static struct f2fs_dir_entry *find_in_level(struct inode *dir,
static struct f2fs_dir_entry *find_in_level(struct inode *dir,
		unsigned int level, const char *name, int namelen,
		unsigned int level, const char *name, size_t namelen,
			f2fs_hash_t namehash, struct page **res_page)
			f2fs_hash_t namehash, struct page **res_page)
{
{
	int s = GET_DENTRY_SLOTS(namelen);
	int s = GET_DENTRY_SLOTS(namelen);
@@ -181,7 +182,7 @@ struct f2fs_dir_entry *f2fs_find_entry(struct inode *dir,
			struct qstr *child, struct page **res_page)
			struct qstr *child, struct page **res_page)
{
{
	const char *name = child->name;
	const char *name = child->name;
	int namelen = child->len;
	size_t namelen = child->len;
	unsigned long npages = dir_blocks(dir);
	unsigned long npages = dir_blocks(dir);
	struct f2fs_dir_entry *de = NULL;
	struct f2fs_dir_entry *de = NULL;
	f2fs_hash_t name_hash;
	f2fs_hash_t name_hash;
@@ -308,6 +309,7 @@ static int init_inode_metadata(struct inode *inode, struct dentry *dentry)
		ipage = get_node_page(F2FS_SB(dir->i_sb), inode->i_ino);
		ipage = get_node_page(F2FS_SB(dir->i_sb), inode->i_ino);
		if (IS_ERR(ipage))
		if (IS_ERR(ipage))
			return PTR_ERR(ipage);
			return PTR_ERR(ipage);
		set_cold_node(inode, ipage);
		init_dent_inode(dentry, ipage);
		init_dent_inode(dentry, ipage);
		f2fs_put_page(ipage, 1);
		f2fs_put_page(ipage, 1);
	}
	}
@@ -381,7 +383,7 @@ int f2fs_add_link(struct dentry *dentry, struct inode *inode)
	struct inode *dir = dentry->d_parent->d_inode;
	struct inode *dir = dentry->d_parent->d_inode;
	struct f2fs_sb_info *sbi = F2FS_SB(dir->i_sb);
	struct f2fs_sb_info *sbi = F2FS_SB(dir->i_sb);
	const char *name = dentry->d_name.name;
	const char *name = dentry->d_name.name;
	int namelen = dentry->d_name.len;
	size_t namelen = dentry->d_name.len;
	struct page *dentry_page = NULL;
	struct page *dentry_page = NULL;
	struct f2fs_dentry_block *dentry_blk = NULL;
	struct f2fs_dentry_block *dentry_blk = NULL;
	int slots = GET_DENTRY_SLOTS(namelen);
	int slots = GET_DENTRY_SLOTS(namelen);
@@ -540,13 +542,13 @@ int f2fs_make_empty(struct inode *inode, struct inode *parent)


	de = &dentry_blk->dentry[0];
	de = &dentry_blk->dentry[0];
	de->name_len = cpu_to_le16(1);
	de->name_len = cpu_to_le16(1);
	de->hash_code = 0;
	de->hash_code = f2fs_dentry_hash(".", 1);
	de->ino = cpu_to_le32(inode->i_ino);
	de->ino = cpu_to_le32(inode->i_ino);
	memcpy(dentry_blk->filename[0], ".", 1);
	memcpy(dentry_blk->filename[0], ".", 1);
	set_de_type(de, inode);
	set_de_type(de, inode);


	de = &dentry_blk->dentry[1];
	de = &dentry_blk->dentry[1];
	de->hash_code = 0;
	de->hash_code = f2fs_dentry_hash("..", 2);
	de->name_len = cpu_to_le16(2);
	de->name_len = cpu_to_le16(2);
	de->ino = cpu_to_le32(parent->i_ino);
	de->ino = cpu_to_le32(parent->i_ino);
	memcpy(dentry_blk->filename[1], "..", 2);
	memcpy(dentry_blk->filename[1], "..", 2);
+1 −1
Original line number Original line Diff line number Diff line
@@ -881,7 +881,7 @@ int f2fs_sync_fs(struct super_block *, int);
/*
/*
 * hash.c
 * hash.c
 */
 */
f2fs_hash_t f2fs_dentry_hash(const char *, int);
f2fs_hash_t f2fs_dentry_hash(const char *, size_t);


/*
/*
 * node.c
 * node.c
+6 −4
Original line number Original line Diff line number Diff line
@@ -160,15 +160,17 @@ int f2fs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
	if (need_to_sync_dir(sbi, inode))
	if (need_to_sync_dir(sbi, inode))
		need_cp = true;
		need_cp = true;


	f2fs_write_inode(inode, NULL);

	if (need_cp) {
	if (need_cp) {
		/* all the dirty node pages should be flushed for POR */
		/* all the dirty node pages should be flushed for POR */
		ret = f2fs_sync_fs(inode->i_sb, 1);
		ret = f2fs_sync_fs(inode->i_sb, 1);
		clear_inode_flag(F2FS_I(inode), FI_NEED_CP);
		clear_inode_flag(F2FS_I(inode), FI_NEED_CP);
	} else {
	} else {
		while (sync_node_pages(sbi, inode->i_ino, &wbc) == 0)
		/* if there is no written node page, write its inode page */
			f2fs_write_inode(inode, NULL);
		while (!sync_node_pages(sbi, inode->i_ino, &wbc)) {
			ret = f2fs_write_inode(inode, NULL);
			if (ret)
				goto out;
		}
		filemap_fdatawait_range(sbi->node_inode->i_mapping,
		filemap_fdatawait_range(sbi->node_inode->i_mapping,
							0, LONG_MAX);
							0, LONG_MAX);
	}
	}
Loading