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

Commit 694a3577 authored by Vincent Zvikaramba's avatar Vincent Zvikaramba
Browse files

Revert "kernel: Update sdfat filesystem"

This reverts commit 6b390e82.
parent 6b390e82
Loading
Loading
Loading
Loading
+2 −7
Original line number Diff line number Diff line
@@ -253,15 +253,9 @@ void sdfat_time_unix2fat(struct sdfat_sb_info *sbi, struct timespec *ts,

TIMESTAMP_T *tm_now(struct sdfat_sb_info *sbi, TIMESTAMP_T *tp)
{
	struct timespec ts;
	struct timespec ts = CURRENT_TIME_SEC;
	DATE_TIME_T dt;

#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
	ts = CURRENT_TIME_SEC;
#else
	ktime_get_real_ts(&ts);
#endif

	sdfat_time_unix2fat(sbi, &ts, &dt);

	tp->year = dt.Year;
@@ -384,3 +378,4 @@ void __sdfat_dmsg(int level, const char *fmt, ...)
#endif
}
#endif
+1 −16
Original line number Diff line number Diff line
@@ -94,11 +94,7 @@ static inline void __sdfat_submit_bio_write2(int flags, struct bio *bio)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0)
static void  mpage_write_end_io(struct bio *bio)
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0)
	__mpage_write_end_io(bio, bio->bi_status);
#else /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) */
	__mpage_write_end_io(bio, bio->bi_error);
#endif
}
#else /* LINUX_VERSION_CODE < KERNEL_VERSION(4,3,0) */
static void mpage_write_end_io(struct bio *bio, int err)
@@ -281,11 +277,7 @@ mpage_alloc(struct block_device *bdev,
	}

	if (bio) {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)
		bio_set_dev(bio, bdev);
#else
		bio->bi_bdev = bdev;
#endif
		__sdfat_set_bio_sector(bio, first_sector);
	}
	return bio;
@@ -369,11 +361,7 @@ static int sdfat_mpage_writepage(struct page *page,

				if (buffer_new(bh)) {
					clear_buffer_new(bh);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
					clean_bdev_bh_alias(bh);
#else /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) */
					unmap_underlying_metadata(bh->b_bdev, bh->b_blocknr);
#endif
				}
			}

@@ -423,12 +411,8 @@ static int sdfat_mpage_writepage(struct page *page,
			goto confused;

		if (buffer_new(&map_bh))
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
			clean_bdev_bh_alias(&map_bh);
#else /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) */
			unmap_underlying_metadata(map_bh.b_bdev,
					map_bh.b_blocknr);
#endif
		if (buffer_boundary(&map_bh)) {
			boundary_block = map_bh.b_blocknr;
			boundary_bdev = map_bh.b_bdev;
@@ -620,3 +604,4 @@ int sdfat_mpage_writepages(struct address_space *mapping,
}

#endif /* CONFIG_SDFAT_ALIGNED_MPAGE_WRITE */
+39 −45
Original line number Diff line number Diff line
@@ -68,9 +68,6 @@
/* skip iterating emit_dots when dir is empty */
#define ITER_POS_FILLED_DOTS	(2)

#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
#define current_time(x)	(CURRENT_TIME_SEC)
#endif
/* type index declare at sdfat.h */
const char *FS_TYPE_STR[] = {
	"auto",
@@ -222,11 +219,7 @@ static inline void inode_unlock(struct inode *inode)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0)
static void sdfat_writepage_end_io(struct bio *bio)
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0)
	__sdfat_writepage_end_io(bio, bio->bi_status);
#else /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) */
	__sdfat_writepage_end_io(bio, bio->bi_error);
#endif
}
#else /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) */
static void sdfat_writepage_end_io(struct bio *bio, int err)
@@ -2313,6 +2306,7 @@ static int __sdfat_create(struct inode *dir, struct dentry *dentry)
{
	struct super_block *sb = dir->i_sb;
	struct inode *inode;
	struct timespec ts;
	FILE_ID_T fid;
	loff_t i_pos;
	int err;
@@ -2321,6 +2315,8 @@ static int __sdfat_create(struct inode *dir, struct dentry *dentry)

	TMSG("%s entered\n", __func__);

	ts = CURRENT_TIME_SEC;

	err = fsapi_create(dir, (u8 *) dentry->d_name.name, FM_REGULAR, &fid);
	if (err)
		goto out;
@@ -2328,7 +2324,7 @@ static int __sdfat_create(struct inode *dir, struct dentry *dentry)
	__lock_d_revalidate(dentry);

	dir->i_version++;
	dir->i_ctime = dir->i_mtime = dir->i_atime = current_time(dir);
	dir->i_ctime = dir->i_mtime = dir->i_atime = ts;
	if (IS_DIRSYNC(dir))
		(void) sdfat_sync_inode(dir);
	else
@@ -2341,7 +2337,7 @@ static int __sdfat_create(struct inode *dir, struct dentry *dentry)
		goto out;
	}
	inode->i_version++;
	inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
	inode->i_mtime = inode->i_atime = inode->i_ctime = ts;
	/* timestamp is already written, so mark_inode_dirty() is unneeded. */

	d_instantiate(dentry, inode);
@@ -2475,12 +2471,15 @@ static int sdfat_unlink(struct inode *dir, struct dentry *dentry)
{
	struct inode *inode = dentry->d_inode;
	struct super_block *sb = dir->i_sb;
	struct timespec ts;
	int err;

	__lock_super(sb);

	TMSG("%s entered\n", __func__);

	ts = CURRENT_TIME_SEC;

	SDFAT_I(inode)->fid.size = i_size_read(inode);

	__cancel_dfr_work(inode, 0, SDFAT_I(inode)->fid.size, __func__);
@@ -2492,14 +2491,14 @@ static int sdfat_unlink(struct inode *dir, struct dentry *dentry)
	__lock_d_revalidate(dentry);

	dir->i_version++;
	dir->i_mtime = dir->i_atime = current_time(dir);
	dir->i_mtime = dir->i_atime = ts;
	if (IS_DIRSYNC(dir))
		(void) sdfat_sync_inode(dir);
	else
		mark_inode_dirty(dir);

	clear_nlink(inode);
	inode->i_mtime = inode->i_atime = current_time(inode);
	inode->i_mtime = inode->i_atime = ts;
	sdfat_detach(inode);
	dentry->d_time = dir->i_version;
out:
@@ -2513,6 +2512,7 @@ static int sdfat_symlink(struct inode *dir, struct dentry *dentry, const char *t
{
	struct super_block *sb = dir->i_sb;
	struct inode *inode;
	struct timespec ts;
	FILE_ID_T fid;
	loff_t i_pos;
	int err;
@@ -2527,6 +2527,8 @@ static int sdfat_symlink(struct inode *dir, struct dentry *dentry, const char *t

	TMSG("%s entered\n", __func__);

	ts = CURRENT_TIME_SEC;

	err = fsapi_create(dir, (u8 *) dentry->d_name.name, FM_SYMLINK, &fid);
	if (err)
		goto out;
@@ -2541,7 +2543,7 @@ static int sdfat_symlink(struct inode *dir, struct dentry *dentry, const char *t
	__lock_d_revalidate(dentry);

	dir->i_version++;
	dir->i_ctime = dir->i_mtime = dir->i_atime = current_time(dir);
	dir->i_ctime = dir->i_mtime = dir->i_atime = ts;
	if (IS_DIRSYNC(dir))
		(void) sdfat_sync_inode(dir);
	else
@@ -2554,7 +2556,7 @@ static int sdfat_symlink(struct inode *dir, struct dentry *dentry, const char *t
		goto out;
	}
	inode->i_version++;
	inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
	inode->i_mtime = inode->i_atime = inode->i_ctime = ts;
	/* timestamp is already written, so mark_inode_dirty() is unneeded. */

	SDFAT_I(inode)->target = kmalloc((len+1), GFP_KERNEL);
@@ -2577,6 +2579,7 @@ static int __sdfat_mkdir(struct inode *dir, struct dentry *dentry)
{
	struct super_block *sb = dir->i_sb;
	struct inode *inode;
	struct timespec ts;
	FILE_ID_T fid;
	loff_t i_pos;
	int err;
@@ -2585,6 +2588,8 @@ static int __sdfat_mkdir(struct inode *dir, struct dentry *dentry)

	TMSG("%s entered\n", __func__);

	ts = CURRENT_TIME_SEC;

	err = fsapi_mkdir(dir, (u8 *) dentry->d_name.name, &fid);
	if (err)
		goto out;
@@ -2592,7 +2597,7 @@ static int __sdfat_mkdir(struct inode *dir, struct dentry *dentry)
	__lock_d_revalidate(dentry);

	dir->i_version++;
	dir->i_ctime = dir->i_mtime = dir->i_atime = current_time(dir);
	dir->i_ctime = dir->i_mtime = dir->i_atime = ts;
	if (IS_DIRSYNC(dir))
		(void) sdfat_sync_inode(dir);
	else
@@ -2606,7 +2611,7 @@ static int __sdfat_mkdir(struct inode *dir, struct dentry *dentry)
		goto out;
	}
	inode->i_version++;
	inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
	inode->i_mtime = inode->i_atime = inode->i_ctime = ts;
	/* timestamp is already written, so mark_inode_dirty() is unneeded. */

	d_instantiate(dentry, inode);
@@ -2625,12 +2630,15 @@ static int sdfat_rmdir(struct inode *dir, struct dentry *dentry)
{
	struct inode *inode = dentry->d_inode;
	struct super_block *sb = dir->i_sb;
	struct timespec ts;
	int err;

	__lock_super(sb);

	TMSG("%s entered\n", __func__);

	ts = CURRENT_TIME_SEC;

	SDFAT_I(inode)->fid.size = i_size_read(inode);

	err = fsapi_rmdir(dir, &(SDFAT_I(inode)->fid));
@@ -2640,7 +2648,7 @@ static int sdfat_rmdir(struct inode *dir, struct dentry *dentry)
	__lock_d_revalidate(dentry);

	dir->i_version++;
	dir->i_mtime = dir->i_atime = current_time(dir);
	dir->i_mtime = dir->i_atime = ts;
	if (IS_DIRSYNC(dir))
		(void) sdfat_sync_inode(dir);
	else
@@ -2648,7 +2656,7 @@ static int sdfat_rmdir(struct inode *dir, struct dentry *dentry)
	drop_nlink(dir);

	clear_nlink(inode);
	inode->i_mtime = inode->i_atime = current_time(inode);
	inode->i_mtime = inode->i_atime = ts;
	sdfat_detach(inode);
	dentry->d_time = dir->i_version;
out:
@@ -2663,6 +2671,7 @@ static int __sdfat_rename(struct inode *old_dir, struct dentry *old_dentry,
{
	struct inode *old_inode, *new_inode;
	struct super_block *sb = old_dir->i_sb;
	struct timespec ts;
	loff_t i_pos;
	int err;

@@ -2673,6 +2682,8 @@ static int __sdfat_rename(struct inode *old_dir, struct dentry *old_dentry,
	old_inode = old_dentry->d_inode;
	new_inode = new_dentry->d_inode;

	ts = CURRENT_TIME_SEC;

	SDFAT_I(old_inode)->fid.size = i_size_read(old_inode);

	__cancel_dfr_work(old_inode, 0, 1, __func__);
@@ -2685,7 +2696,7 @@ static int __sdfat_rename(struct inode *old_dir, struct dentry *old_dentry,
	__lock_d_revalidate(new_dentry);

	new_dir->i_version++;
	new_dir->i_ctime = new_dir->i_mtime = new_dir->i_atime = current_time(new_dir);
	new_dir->i_ctime = new_dir->i_mtime = new_dir->i_atime = ts;
	if (IS_DIRSYNC(new_dir))
		(void) sdfat_sync_inode(new_dir);
	else
@@ -2706,7 +2717,7 @@ static int __sdfat_rename(struct inode *old_dir, struct dentry *old_dentry,
	}

	old_dir->i_version++;
	old_dir->i_ctime = old_dir->i_mtime = current_time(old_dir);
	old_dir->i_ctime = old_dir->i_mtime = ts;
	if (IS_DIRSYNC(old_dir))
		(void) sdfat_sync_inode(old_dir);
	else
@@ -2725,7 +2736,7 @@ static int __sdfat_rename(struct inode *old_dir, struct dentry *old_dentry,
				__func__);
			WARN_ON(new_inode->i_nlink == 0);
		}
		new_inode->i_ctime = current_time(new_inode);
		new_inode->i_ctime = ts;
#if 0
		(void) sdfat_sync_inode(new_inode);
#endif
@@ -2749,7 +2760,7 @@ static int sdfat_cont_expand(struct inode *inode, loff_t size)
	if (err)
		return err;

	inode->i_ctime = inode->i_mtime = current_time(inode);
	inode->i_ctime = inode->i_mtime = CURRENT_TIME_SEC;
	mark_inode_dirty(inode);

	if (!IS_SYNC(inode))
@@ -2882,15 +2893,9 @@ static int sdfat_setattr(struct dentry *dentry, struct iattr *attr)
	return error;
}

#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
static int sdfat_getattr(const struct path *path, struct kstat *stat, u32 request_mask, unsigned int flags)
{
	struct inode *inode = path->dentry->d_inode;
#else
static int sdfat_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
{
	struct inode *inode = dentry->d_inode;
#endif

	TMSG("%s entered\n", __func__);

@@ -2925,9 +2930,7 @@ static const struct inode_operations sdfat_dir_inode_operations = {
/*  File Operations                                                     */
/*======================================================================*/
static const struct inode_operations sdfat_symlink_inode_operations = {
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
	.readlink    = generic_readlink,
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)
	.get_link = sdfat_follow_link,
#else /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0) */
@@ -3010,7 +3013,7 @@ static void sdfat_truncate(struct inode *inode, loff_t old_size)
	if (err)
		goto out;

	inode->i_ctime = inode->i_mtime = current_time(inode);
	inode->i_ctime = inode->i_mtime = CURRENT_TIME_SEC;
	if (IS_DIRSYNC(inode))
		(void) sdfat_sync_inode(inode);
	else
@@ -3444,11 +3447,7 @@ static inline void sdfat_submit_fullpage_bio(struct block_device *bdev,
	 */
	bio = bio_alloc(GFP_NOIO, 1);

#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)
	bio_set_dev(bio, bdev);
#else
	bio->bi_bdev = bdev;
#endif
	bio->bi_vcnt = 1;
	bio->bi_io_vec[0].bv_page = page;	/* Inline vec */
	bio->bi_io_vec[0].bv_len = length;	/* PAGE_SIZE */
@@ -3539,11 +3538,7 @@ static int sdfat_writepage(struct page *page, struct writeback_control *wbc)

			if (buffer_new(bh)) {
				clear_buffer_new(bh);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
				clean_bdev_bh_alias(bh);
#else /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) */
				unmap_underlying_metadata(bh->b_bdev, bh->b_blocknr);
#endif
			}
		}

@@ -3719,7 +3714,7 @@ static int sdfat_write_end(struct file *file, struct address_space *mapping,
		sdfat_write_failed(mapping, pos+len);

	if (!(err < 0) && !(fid->attr & ATTR_ARCHIVE)) {
		inode->i_mtime = inode->i_ctime = current_time(inode);
		inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
		fid->attr |= ATTR_ARCHIVE;
		mark_inode_dirty(inode);
	}
@@ -4725,9 +4720,12 @@ static int sdfat_read_root(struct inode *inode)
{
	struct super_block *sb = inode->i_sb;
	struct sdfat_sb_info *sbi = SDFAT_SB(sb);
	struct timespec ts;
	FS_INFO_T *fsi = &(sbi->fsi);
	DIR_ENTRY_T info;

	ts = CURRENT_TIME_SEC;

	SDFAT_I(inode)->fid.dir.dir = fsi->root_dir;
	SDFAT_I(inode)->fid.dir.flags = 0x01;
	SDFAT_I(inode)->fid.entry = -1;
@@ -4763,7 +4761,7 @@ static int sdfat_read_root(struct inode *inode)
	SDFAT_I(inode)->i_size_ondisk = i_size_read(inode);

	sdfat_save_attr(inode, ATTR_SUBDIR);
	inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
	inode->i_mtime = inode->i_atime = inode->i_ctime = ts;
	set_nlink(inode, info.NumSubdirs + 2);
	return 0;
}
@@ -4961,11 +4959,6 @@ static int __init sdfat_init_inodecache(void)

static void sdfat_destroy_inodecache(void)
{
	/*
	 * Make sure all delayed rcu free inodes are flushed before we
	 * destroy cache.
	 */
	rcu_barrier();
	kmem_cache_destroy(sdfat_inode_cachep);
}

@@ -5134,3 +5127,4 @@ module_exit(exit_sdfat_fs);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("FAT/exFAT filesystem support");
MODULE_AUTHOR("Samsung Electronics Co., Ltd.");