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

Commit ced7acdc authored by Kevin F. Haggerty's avatar Kevin F. Haggerty Committed by TARKZiM
Browse files

fs: sdfat: Update to version 2.4.5



* Samsung source G981USQU1CTKH

Signed-off-by: default avatarKevin F. Haggerty <haggertk@lineageos.org>
Change-Id: I79b75d2e47e9be33b311b8d72ac92c66b45a7df1
parent 0312df1b
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -69,15 +69,18 @@ config SDFAT_CHECK_RO_ATTR

config SDFAT_ALIGNED_MPAGE_WRITE
	bool "Enable supporting aligned mpage_write"
	default y
	default y if SDFAT_FS=y
	default n if SDFAT_FS=m
	depends on SDFAT_FS

config SDFAT_VIRTUAL_XATTR
	bool "Virtual xattr support for sdFAT"
	default y
	default n
	depends on SDFAT_FS
	help
	  To support virtual xattr.
	  If you enable this feature, it supports virtual xattr.
	  This feature will be deprecated because it might be the same with
	  "context" mount option.

config SDFAT_VIRTUAL_XATTR_SELINUX_LABEL
	string "Default string for SELinux label"
+2 −1
Original line number Diff line number Diff line
@@ -705,7 +705,8 @@ static inline AU_INFO_T *amap_get_packing_au(AMAP_T *amap, int dest, int num_to_
		}
	}

	if ((PACKING_HARDLIMIT) && amap->n_need_packing >= PACKING_HARDLIMIT) {
	if ((PACKING_HARDLIMIT != 0) &&
	    amap->n_need_packing >= PACKING_HARDLIMIT) {
		/* Compulsory SLC flushing:
		 * If there was no chance to do best-fit packing
		 * and the # of AU-aligned allocation exceeds HARD threshold,
+22 −8
Original line number Diff line number Diff line
@@ -96,7 +96,6 @@ s32 bdev_check_bdi_valid(struct super_block *sb)
			fsi->prev_eio |= SDFAT_EIO_BDI;
			sdfat_log_msg(sb, KERN_ERR, "%s: block device is "
				"eliminated.(bdi:%p)", __func__, sb->s_bdi);
			sdfat_debug_warn_on(1);
		}
		return -ENXIO;
	}
@@ -104,18 +103,13 @@ s32 bdev_check_bdi_valid(struct super_block *sb)
	return 0;
}


/* Make a readahead request */
s32 bdev_readahead(struct super_block *sb, u64 secno, u64 num_secs)
#if IS_BUILTIN(CONFIG_SDFAT_FS)
static void __bdev_readahead(struct super_block *sb, u64 secno, u64 num_secs)
{
	FS_INFO_T *fsi = &(SDFAT_SB(sb)->fsi);
	u32 sects_per_page = (PAGE_SIZE >> sb->s_blocksize_bits);
	struct blk_plug plug;
	u64 i;

	if (!fsi->bd_opened)
		return -EIO;

	blk_start_plug(&plug);
	for (i = 0; i < num_secs; i++) {
		if (i && !(i & (sects_per_page - 1)))
@@ -123,6 +117,26 @@ s32 bdev_readahead(struct super_block *sb, u64 secno, u64 num_secs)
		sb_breadahead(sb, (sector_t)(secno + i));
	}
	blk_finish_plug(&plug);
}
#else
static void __bdev_readahead(struct super_block *sb, u64 secno, u64 num_secs)
{
	u64 i;

	for (i = 0; i < num_secs; i++)
		sb_breadahead(sb, (sector_t)(secno + i));
}
#endif

/* Make a readahead request */
s32 bdev_readahead(struct super_block *sb, u64 secno, u64 num_secs)
{
	FS_INFO_T *fsi = &(SDFAT_SB(sb)->fsi);

	if (!fsi->bd_opened)
		return -EIO;

	__bdev_readahead(sb, secno, num_secs);

	return 0;
}
+17 −22
Original line number Diff line number Diff line
@@ -158,7 +158,7 @@ static s32 __fs_set_vol_flags(struct super_block *sb, u16 new_flag, s32 always_s
	/* skip updating volume dirty flag,
	 * if this volume has been mounted with read-only
	 */
	if (sb->s_flags & MS_RDONLY)
	if (sb_rdonly(sb))
		return 0;

	if (!fsi->pbr_bh) {
@@ -177,7 +177,8 @@ static s32 __fs_set_vol_flags(struct super_block *sb, u16 new_flag, s32 always_s
		bpb->bsx.state = new_flag & VOL_DIRTY ? FAT_VOL_DIRTY : 0x00;
	} else { /* FAT16/12 */
		pbr16_t *bpb = (pbr16_t *) fsi->pbr_bh->b_data;
		bpb->bpb.state = new_flag & VOL_DIRTY ? FAT_VOL_DIRTY : 0x00;
		bpb->bpb.f16.state = new_flag & VOL_DIRTY ?
				     FAT_VOL_DIRTY : 0x00;
	}

	if (always_sync)
@@ -1655,7 +1656,7 @@ static bool is_exfat(pbr_t *pbr)

static bool is_fat32(pbr_t *pbr)
{
	if (le16_to_cpu(pbr->bpb.f16.num_fat_sectors))
	if (le16_to_cpu(pbr->bpb.fat.num_fat_sectors))
		return false;
	return true;
}
@@ -1668,7 +1669,7 @@ pbr_t *read_pbr_with_logical_sector(struct super_block *sb, struct buffer_head *
	if (is_exfat(p_pbr))
		logical_sect = 1 << p_pbr->bsx.f64.sect_size_bits;
	else
		logical_sect = get_unaligned_le16(&p_pbr->bpb.f16.sect_size);
		logical_sect = get_unaligned_le16(&p_pbr->bpb.fat.sect_size);

	/* is x a power of 2?
	 * (x) != 0 && (((x) & ((x) - 1)) == 0)
@@ -1780,7 +1781,7 @@ s32 fscore_mount(struct super_block *sb)
		opts->improved_allocation = 0;
		opts->defrag = 0;
		ret = mount_exfat(sb, p_pbr);
	} else if (is_fat32(p_pbr)) {
	} else {
		if (opts->fs_type && opts->fs_type != FS_TYPE_VFAT) {
			sdfat_log_msg(sb, KERN_ERR,
				"not specified filesystem type "
@@ -1791,22 +1792,15 @@ s32 fscore_mount(struct super_block *sb)
		}
		/* set maximum file size for FAT */
		sb->s_maxbytes = 0xffffffff;

		if (is_fat32(p_pbr)) {
			ret = mount_fat32(sb, p_pbr);
		} else {
		if (opts->fs_type && opts->fs_type != FS_TYPE_VFAT) {
			sdfat_log_msg(sb, KERN_ERR,
				"not specified filesystem type "
				"(media:vfat, opts:%s)",
				FS_TYPE_STR[opts->fs_type]);
			ret = -EINVAL;
			goto free_bh;
		}
		/* set maximum file size for FAT */
		sb->s_maxbytes = 0xffffffff;
			opts->improved_allocation = 0;
			opts->defrag = 0;
			ret = mount_fat16(sb, p_pbr);
		}
	}
free_bh:
	brelse(tmp_bh);
	if (ret) {
@@ -1817,8 +1811,9 @@ free_bh:
	/* warn misaligned data data start sector must be a multiple of clu_size */
	sdfat_log_msg(sb, KERN_INFO,
		"detected volume info     : %s "
		"(bps : %lu, spc : %u, data start : %llu, %s)",
		"(%04hX-%04hX, bps : %lu, spc : %u, data start : %llu, %s)",
		sdfat_get_vol_type_str(fsi->vol_type),
		(fsi->vol_id >> 16) & 0xffff, fsi->vol_id & 0xffff,
		sb->s_blocksize, fsi->sect_per_clus, fsi->data_start_sector,
		(fsi->data_start_sector & (fsi->sect_per_clus - 1)) ?
		"misaligned" : "aligned");
@@ -2374,7 +2369,7 @@ s32 fscore_write_link(struct inode *inode, FILE_ID_T *fid, void *buffer, u64 cou
		ep2 = ep;
	}

	fsi->fs_func->set_entry_time(ep, tm_now(SDFAT_SB(sb), &tm), TM_MODIFY);
	fsi->fs_func->set_entry_time(ep, tm_now(inode, &tm), TM_MODIFY);
	fsi->fs_func->set_entry_attr(ep, fid->attr);

	if (modified) {
@@ -2581,7 +2576,7 @@ s32 fscore_truncate(struct inode *inode, u64 old_size, u64 new_size)
			ep2 = ep;
		}

		fsi->fs_func->set_entry_time(ep, tm_now(SDFAT_SB(sb), &tm), TM_MODIFY);
		fsi->fs_func->set_entry_time(ep, tm_now(inode, &tm), TM_MODIFY);
		fsi->fs_func->set_entry_attr(ep, fid->attr);

		/*
+9 −1
Original line number Diff line number Diff line
@@ -60,7 +60,15 @@ typedef struct {
	void	*__buf;		// __buf should be the last member
} ENTRY_SET_CACHE_T;


/*----------------------------------------------------------------------*/
/*  Inline Functions                                                    */
/*----------------------------------------------------------------------*/
static inline bool is_valid_clus(FS_INFO_T *fsi, u32 clus)
{
	if (clus < CLUS_BASE || fsi->num_clusters <= clus)
		return false;
	return true;
}

/*----------------------------------------------------------------------*/
/*  External Function Declarations                                      */
Loading