Commit 6f8cd037 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull exfat fixes from Namjae Jeon:

 - several bug fixes(broken mount discard option, remount failure,
   memory leak)

 - add missing MODULE_ALIAS_FS for automatically loading exfat module.

 - set s_time_gran and truncate atime with exfat timestamp granularity.

* tag 'for-5.7-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/linkinjeon/exfat:
  exfat: truncate atimes to 2s granularity
  exfat: properly set s_time_gran
  exfat: remove 'bps' mount-option
  exfat: Unify access to the boot sector
  exfat: add missing MODULE_ALIAS_FS()
  exfat: Fix discard support
parents 3cda7799 81df1ad4
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -91,7 +91,6 @@ static int exfat_allocate_bitmap(struct super_block *sb,
		}
	}

	sbi->pbr_bh = NULL;
	return 0;
}

@@ -137,8 +136,6 @@ void exfat_free_bitmap(struct exfat_sb_info *sbi)
{
	int i;

	brelse(sbi->pbr_bh);

	for (i = 0; i < sbi->map_sectors; i++)
		__brelse(sbi->vol_amap[i]);

+1 −0
Original line number Diff line number Diff line
@@ -507,6 +507,7 @@ void exfat_msg(struct super_block *sb, const char *lv, const char *fmt, ...)
		__printf(3, 4) __cold;
void exfat_get_entry_time(struct exfat_sb_info *sbi, struct timespec64 *ts,
		u8 tz, __le16 time, __le16 date, u8 time_ms);
void exfat_truncate_atime(struct timespec64 *ts);
void exfat_set_entry_time(struct exfat_sb_info *sbi, struct timespec64 *ts,
		u8 *tz, __le16 *time, __le16 *date, u8 *time_ms);
unsigned short exfat_calc_chksum_2byte(void *data, int len,
+2 −0
Original line number Diff line number Diff line
@@ -273,6 +273,7 @@ int exfat_getattr(const struct path *path, struct kstat *stat,
	struct exfat_inode_info *ei = EXFAT_I(inode);

	generic_fillattr(inode, stat);
	exfat_truncate_atime(&stat->atime);
	stat->result_mask |= STATX_BTIME;
	stat->btime.tv_sec = ei->i_crtime.tv_sec;
	stat->btime.tv_nsec = ei->i_crtime.tv_nsec;
@@ -339,6 +340,7 @@ int exfat_setattr(struct dentry *dentry, struct iattr *attr)
	}

	setattr_copy(inode, attr);
	exfat_truncate_atime(&inode->i_atime);
	mark_inode_dirty(inode);

out:
+13 −1
Original line number Diff line number Diff line
@@ -88,7 +88,8 @@ void exfat_get_entry_time(struct exfat_sb_info *sbi, struct timespec64 *ts,
	if (time_ms) {
		ts->tv_sec += time_ms / 100;
		ts->tv_nsec = (time_ms % 100) * 10 * NSEC_PER_MSEC;
	}
	} else
		ts->tv_nsec = 0;

	if (tz & EXFAT_TZ_VALID)
		/* Adjust timezone to UTC0. */
@@ -124,6 +125,17 @@ void exfat_set_entry_time(struct exfat_sb_info *sbi, struct timespec64 *ts,
	*tz = EXFAT_TZ_VALID;
}

/*
 * The timestamp for access_time has double seconds granularity.
 * (There is no 10msIncrement field for access_time unlike create/modify_time)
 * atime also has only a 2-second resolution.
 */
void exfat_truncate_atime(struct timespec64 *ts)
{
	ts->tv_sec = round_down(ts->tv_sec, 2);
	ts->tv_nsec = 0;
}

unsigned short exfat_calc_chksum_2byte(void *data, int len,
		unsigned short chksum, int type)
{
+7 −0
Original line number Diff line number Diff line
@@ -595,6 +595,7 @@ static int exfat_create(struct inode *dir, struct dentry *dentry, umode_t mode,
	inode_inc_iversion(inode);
	inode->i_mtime = inode->i_atime = inode->i_ctime =
		EXFAT_I(inode)->i_crtime = current_time(inode);
	exfat_truncate_atime(&inode->i_atime);
	/* timestamp is already written, so mark_inode_dirty() is unneeded. */

	d_instantiate(dentry, inode);
@@ -854,6 +855,7 @@ static int exfat_unlink(struct inode *dir, struct dentry *dentry)

	inode_inc_iversion(dir);
	dir->i_mtime = dir->i_atime = current_time(dir);
	exfat_truncate_atime(&dir->i_atime);
	if (IS_DIRSYNC(dir))
		exfat_sync_inode(dir);
	else
@@ -861,6 +863,7 @@ static int exfat_unlink(struct inode *dir, struct dentry *dentry)

	clear_nlink(inode);
	inode->i_mtime = inode->i_atime = current_time(inode);
	exfat_truncate_atime(&inode->i_atime);
	exfat_unhash_inode(inode);
	exfat_d_version_set(dentry, inode_query_iversion(dir));
unlock:
@@ -903,6 +906,7 @@ static int exfat_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
	inode_inc_iversion(inode);
	inode->i_mtime = inode->i_atime = inode->i_ctime =
		EXFAT_I(inode)->i_crtime = current_time(inode);
	exfat_truncate_atime(&inode->i_atime);
	/* timestamp is already written, so mark_inode_dirty() is unneeded. */

	d_instantiate(dentry, inode);
@@ -1019,6 +1023,7 @@ static int exfat_rmdir(struct inode *dir, struct dentry *dentry)

	inode_inc_iversion(dir);
	dir->i_mtime = dir->i_atime = current_time(dir);
	exfat_truncate_atime(&dir->i_atime);
	if (IS_DIRSYNC(dir))
		exfat_sync_inode(dir);
	else
@@ -1027,6 +1032,7 @@ static int exfat_rmdir(struct inode *dir, struct dentry *dentry)

	clear_nlink(inode);
	inode->i_mtime = inode->i_atime = current_time(inode);
	exfat_truncate_atime(&inode->i_atime);
	exfat_unhash_inode(inode);
	exfat_d_version_set(dentry, inode_query_iversion(dir));
unlock:
@@ -1387,6 +1393,7 @@ static int exfat_rename(struct inode *old_dir, struct dentry *old_dentry,
	inode_inc_iversion(new_dir);
	new_dir->i_ctime = new_dir->i_mtime = new_dir->i_atime =
		EXFAT_I(new_dir)->i_crtime = current_time(new_dir);
	exfat_truncate_atime(&new_dir->i_atime);
	if (IS_DIRSYNC(new_dir))
		exfat_sync_inode(new_dir);
	else
Loading