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

Unverified Commit 0c593672 authored by derfelot's avatar derfelot
Browse files

Revert "fs: sdfat: Update to version 2.4.5"

Even though the merge looks OK, this appears to cause some sdcard corruptions.

Let's revert this for now.

This reverts commit 51aaddc5.
parent dceb669f
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -68,18 +68,15 @@ config SDFAT_CHECK_RO_ATTR

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

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

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

	if ((PACKING_HARDLIMIT != 0) &&
	    amap->n_need_packing >= PACKING_HARDLIMIT) {
	if ((PACKING_HARDLIMIT) && 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,
+8 −22
Original line number Diff line number Diff line
@@ -96,6 +96,7 @@ 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;
	}
@@ -103,13 +104,18 @@ s32 bdev_check_bdi_valid(struct super_block *sb)
	return 0;
}

#if IS_BUILTIN(CONFIG_SDFAT_FS)
static void __bdev_readahead(struct super_block *sb, u64 secno, u64 num_secs)

/* Make a readahead request */
s32 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)))
@@ -117,26 +123,6 @@ static void __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;
}
+22 −17
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_rdonly(sb))
	if (sb->s_flags & MS_RDONLY)
		return 0;

	if (!fsi->pbr_bh) {
@@ -177,8 +177,7 @@ 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.f16.state = new_flag & VOL_DIRTY ?
				     FAT_VOL_DIRTY : 0x00;
		bpb->bpb.state = new_flag & VOL_DIRTY ? FAT_VOL_DIRTY : 0x00;
	}

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

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

	/* is x a power of 2?
	 * (x) != 0 && (((x) & ((x) - 1)) == 0)
@@ -1781,7 +1780,7 @@ s32 fscore_mount(struct super_block *sb)
		opts->improved_allocation = 0;
		opts->defrag = 0;
		ret = mount_exfat(sb, p_pbr);
	} else {
	} else if (is_fat32(p_pbr)) {
		if (opts->fs_type && opts->fs_type != FS_TYPE_VFAT) {
			sdfat_log_msg(sb, KERN_ERR,
				"not specified filesystem type "
@@ -1792,15 +1791,22 @@ 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) {
@@ -1811,9 +1817,8 @@ 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 "
		"(%04hX-%04hX, bps : %lu, spc : %u, data start : %llu, %s)",
		"(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");
@@ -2369,7 +2374,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(inode, &tm), TM_MODIFY);
	fsi->fs_func->set_entry_time(ep, tm_now(SDFAT_SB(sb), &tm), TM_MODIFY);
	fsi->fs_func->set_entry_attr(ep, fid->attr);

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

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

		/*
+1 −9
Original line number Diff line number Diff line
@@ -60,15 +60,7 @@ 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