Skip to content
This repository has been archived by the owner on Mar 3, 2024. It is now read-only.

Commit

Permalink
exfat: major clean-up
Browse files Browse the repository at this point in the history
 - This is used for exFAT exclusively, remove fat12/16/32.
 - Remove "bigdata" statistics.

Signed-off-by: Park Ju Hyung <qkrwngud825@gmail.com>
  • Loading branch information
arter97 committed Sep 14, 2019
1 parent fe3e725 commit 5fc3ab8
Show file tree
Hide file tree
Showing 15 changed files with 155 additions and 2,514 deletions.
3 changes: 0 additions & 3 deletions Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,4 @@ config EXFAT_DBG_WARNON

endif # if EXFAT_DEBUG

config EXFAT_STATISTICS
bool "enable statistics for bigdata"

endif # if EXFAT_FS
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ ifneq ($(KERNELRELEASE),)
# Called from inline kernel build
obj-$(CONFIG_EXFAT_FS) += exfat.o

exfat-objs := super.o core.o core_fat.o core_exfat.o api.o blkdev.o \
fatent.o amap_smart.o cache.o dfr.o nls.o misc.o \
mpage.o extent.o xattr.o statistics.o
exfat-objs := super.o core.o core_exfat.o api.o blkdev.o fatent.o cache.o \
nls.o misc.o mpage.o extent.o xattr.o
else
# Called from external kernel module build

Expand Down
149 changes: 0 additions & 149 deletions api.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ s32 fsapi_statfs(struct super_block *sb, VOL_INFO_T *info)
return err;
}

info->FatType = fsi->vol_type;
info->ClusterSize = fsi->cluster_size;
info->NumClusters = fsi->num_clusters - 2; /* clu 0 & 1 */
info->UsedClusters = fsi->used_clusters + fsi->reserved_clusters;
Expand Down Expand Up @@ -485,152 +484,4 @@ s32 fsapi_check_bdi_valid(struct super_block *sb)
}
EXPORT_SYMBOL(fsapi_check_bdi_valid);



#ifdef CONFIG_EXFAT_DFR
/*----------------------------------------------------------------------*/
/* Defragmentation related */
/*----------------------------------------------------------------------*/
s32 fsapi_dfr_get_info(struct super_block *sb, void *arg)
{
/* volume lock is not required */
return defrag_get_info(sb, (struct defrag_info_arg *)arg);
}
EXPORT_SYMBOL(fsapi_dfr_get_info);

s32 fsapi_dfr_scan_dir(struct super_block *sb, void *args)
{
s32 err;

/* check the validity of pointer parameters */
ASSERT(args);

mutex_lock(&(EXFAT_SB(sb)->s_vlock));
err = defrag_scan_dir(sb, (struct defrag_trav_arg *)args);
mutex_unlock(&(EXFAT_SB(sb)->s_vlock));
return err;
}
EXPORT_SYMBOL(fsapi_dfr_scan_dir);

s32 fsapi_dfr_validate_clus(struct inode *inode, void *chunk, int skip_prev)
{
s32 err;
struct super_block *sb = inode->i_sb;

mutex_lock(&(EXFAT_SB(sb)->s_vlock));
err = defrag_validate_cluster(inode,
(struct defrag_chunk_info *)chunk, skip_prev);
mutex_unlock(&(EXFAT_SB(sb)->s_vlock));
return err;
}
EXPORT_SYMBOL(fsapi_dfr_validate_clus);

s32 fsapi_dfr_reserve_clus(struct super_block *sb, s32 nr_clus)
{
s32 err;

mutex_lock(&(EXFAT_SB(sb)->s_vlock));
err = defrag_reserve_clusters(sb, nr_clus);
mutex_unlock(&(EXFAT_SB(sb)->s_vlock));
return err;
}
EXPORT_SYMBOL(fsapi_dfr_reserve_clus);

s32 fsapi_dfr_mark_ignore(struct super_block *sb, unsigned int clus)
{
/* volume lock is not required */
return defrag_mark_ignore(sb, clus);
}
EXPORT_SYMBOL(fsapi_dfr_mark_ignore);

void fsapi_dfr_unmark_ignore_all(struct super_block *sb)
{
/* volume lock is not required */
defrag_unmark_ignore_all(sb);
}
EXPORT_SYMBOL(fsapi_dfr_unmark_ignore_all);

s32 fsapi_dfr_map_clus(struct inode *inode, u32 clu_offset, u32 *clu)
{
s32 err;
struct super_block *sb = inode->i_sb;

/* check the validity of pointer parameters */
ASSERT(clu);

mutex_lock(&(EXFAT_SB(sb)->s_vlock));
err = defrag_map_cluster(inode, clu_offset, clu);
mutex_unlock(&(EXFAT_SB(sb)->s_vlock));

return err;
}
EXPORT_SYMBOL(fsapi_dfr_map_clus);

void fsapi_dfr_writepage_endio(struct page *page)
{
/* volume lock is not required */
defrag_writepage_end_io(page);
}
EXPORT_SYMBOL(fsapi_dfr_writepage_endio);

void fsapi_dfr_update_fat_prev(struct super_block *sb, int force)
{
mutex_lock(&(EXFAT_SB(sb)->s_vlock));
defrag_update_fat_prev(sb, force);
mutex_unlock(&(EXFAT_SB(sb)->s_vlock));
}
EXPORT_SYMBOL(fsapi_dfr_update_fat_prev);

void fsapi_dfr_update_fat_next(struct super_block *sb)
{
mutex_lock(&(EXFAT_SB(sb)->s_vlock));
defrag_update_fat_next(sb);
mutex_unlock(&(EXFAT_SB(sb)->s_vlock));
}
EXPORT_SYMBOL(fsapi_dfr_update_fat_next);

void fsapi_dfr_check_discard(struct super_block *sb)
{
mutex_lock(&(EXFAT_SB(sb)->s_vlock));
defrag_check_discard(sb);
mutex_unlock(&(EXFAT_SB(sb)->s_vlock));
}
EXPORT_SYMBOL(fsapi_dfr_check_discard);

void fsapi_dfr_free_clus(struct super_block *sb, u32 clus)
{
mutex_lock(&(EXFAT_SB(sb)->s_vlock));
defrag_free_cluster(sb, clus);
mutex_unlock(&(EXFAT_SB(sb)->s_vlock));
}
EXPORT_SYMBOL(fsapi_dfr_free_clus);

s32 fsapi_dfr_check_dfr_required(struct super_block *sb, int *totalau, int *cleanau, int *fullau)
{
/* volume lock is not required */
return defrag_check_defrag_required(sb, totalau, cleanau, fullau);
}
EXPORT_SYMBOL(fsapi_dfr_check_dfr_required);

s32 fsapi_dfr_check_dfr_on(struct inode *inode, loff_t start, loff_t end, s32 cancel, const char *caller)
{
/* volume lock is not required */
return defrag_check_defrag_on(inode, start, end, cancel, caller);
}
EXPORT_SYMBOL(fsapi_dfr_check_dfr_on);



#ifdef CONFIG_EXFAT_DFR_DEBUG
void fsapi_dfr_spo_test(struct super_block *sb, int flag, const char *caller)
{
/* volume lock is not required */
defrag_spo_test(sb, flag, caller);
}
EXPORT_SYMBOL(fsapi_dfr_spo_test);
#endif


#endif /* CONFIG_EXFAT_DFR */

/* end of exfat_api.c */
35 changes: 0 additions & 35 deletions api.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ typedef struct {
} DEV_INFO_T;

typedef struct {
u32 FatType;
u32 ClusterSize;
u32 NumClusters;
u32 FreeClusters;
Expand Down Expand Up @@ -251,7 +250,6 @@ typedef struct {

typedef struct __FS_INFO_T {
s32 bd_opened; // opened or not
u32 vol_type; // volume FAT type
u32 vol_id; // volume serial number
u64 num_sectors; // num of sectors in volume
u32 num_clusters; // num of clusters in volume
Expand Down Expand Up @@ -358,39 +356,6 @@ void fsapi_invalidate_extent(struct inode *inode);
/* bdev management */
s32 fsapi_check_bdi_valid(struct super_block *sb);

#ifdef CONFIG_EXFAT_DFR
/*----------------------------------------------------------------------*/
/* Defragmentation related */
/*----------------------------------------------------------------------*/

s32 fsapi_dfr_get_info(struct super_block *sb, void *arg);

s32 fsapi_dfr_scan_dir(struct super_block *sb, void *args);

s32 fsapi_dfr_validate_clus(struct inode *inode, void *chunk, int skip_prev);
s32 fsapi_dfr_reserve_clus(struct super_block *sb, s32 nr_clus);
s32 fsapi_dfr_mark_ignore(struct super_block *sb, unsigned int clus);
void fsapi_dfr_unmark_ignore_all(struct super_block *sb);

s32 fsapi_dfr_map_clus(struct inode *inode, u32 clu_offset, u32 *clu);
void fsapi_dfr_writepage_endio(struct page *page);

void fsapi_dfr_update_fat_prev(struct super_block *sb, int force);
void fsapi_dfr_update_fat_next(struct super_block *sb);
void fsapi_dfr_check_discard(struct super_block *sb);
void fsapi_dfr_free_clus(struct super_block *sb, u32 clus);

s32 fsapi_dfr_check_dfr_required(struct super_block *sb, int *totalau, int *cleanau, int *fullau);
s32 fsapi_dfr_check_dfr_on(struct inode *inode, loff_t start, loff_t end, s32 cancel, const char *caller);


#ifdef CONFIG_EXFAT_DFR_DEBUG
void fsapi_dfr_spo_test(struct super_block *sb, int flag, const char *caller);
#endif /* CONFIG_EXFAT_DFR_DEBUG */

#endif /* CONFIG_EXFAT_DFR */


#ifdef __cplusplus
}
#endif /* __cplusplus */
Expand Down
30 changes: 0 additions & 30 deletions cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,25 +235,6 @@ u8 *fcache_getblk(struct super_block *sb, u64 sec)
return bp->bh->b_data;
}

static inline int __mark_delayed_dirty(struct super_block *sb, cache_ent_t *bp)
{
struct exfat_sb_info *sbi = EXFAT_SB(sb);

if (sbi->options.delayed_meta) {
FS_INFO_T *fsi = &(sbi->fsi);

if (fsi->vol_type == EXFAT)
return -ENOTSUPP;

bp->flag |= DIRTYBIT;
return 0;
} else {
return -ENOTSUPP;
}
}



s32 fcache_modify(struct super_block *sb, u64 sec)
{
cache_ent_t *bp;
Expand All @@ -264,9 +245,6 @@ s32 fcache_modify(struct super_block *sb, u64 sec)
return -EIO;
}

if (!__mark_delayed_dirty(sb, bp))
return 0;

if (write_sect(sb, sec, bp->bh, 0))
return -EIO;

Expand Down Expand Up @@ -602,7 +580,6 @@ u8 *dcache_getblk(struct super_block *sb, u64 sec)

s32 dcache_modify(struct super_block *sb, u64 sec)
{
struct exfat_sb_info *sbi = EXFAT_SB(sb);
s32 ret = -EIO;
cache_ent_t *bp;

Expand All @@ -614,13 +591,6 @@ s32 dcache_modify(struct super_block *sb, u64 sec)
return -EIO;
}

if (sbi->options.delayed_meta) {
if (EXFAT_SB(sb)->fsi.vol_type != EXFAT) {
bp->flag |= DIRTYBIT;
return 0;
}
}

ret = write_sect(sb, sec, bp->bh, 0);

if (ret) {
Expand Down
31 changes: 1 addition & 30 deletions config.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,40 +17,21 @@

#ifndef _EXFAT_CONFIG_H
#define _EXFAT_CONFIG_H
/*======================================================================*/
/* */
/* FFS CONFIGURATIONS */
/* (CHANGE THIS PART IF REQUIRED) */
/* */
/*======================================================================*/

/*----------------------------------------------------------------------*/
/* Feature Config */
/*----------------------------------------------------------------------*/

/*----------------------------------------------------------------------*/
/* Debug/Experimental Config */
/*----------------------------------------------------------------------*/
//#define CONFIG_EXFAT_TRACE_IO
//#define CONFIG_EXFAT_TRACE_LOCK /* Trace elapsed time in lock_super(sb) */

/*----------------------------------------------------------------------*/
/* Defragmentation Config */
/*----------------------------------------------------------------------*/
//#define CONFIG_EXFAT_DFR
//#define CONFIG_EXFAT_DFR_PACKING
//#define CONFIG_EXFAT_DFR_DEBUG

/*----------------------------------------------------------------------*/
/* Config for Kernel equal or newer than 3.7 */
/*----------------------------------------------------------------------*/
#ifndef CONFIG_EXFAT_WRITE_SB_INTERVAL_CSECS
#define CONFIG_EXFAT_WRITE_SB_INTERVAL_CSECS (dirty_writeback_interval)
#endif

/*----------------------------------------------------------------------*/
/* Default Kconfig */
/*----------------------------------------------------------------------*/

#ifndef CONFIG_EXFAT_DEFAULT_CODEPAGE /* if Kconfig lacked codepage */
#define CONFIG_EXFAT_DEFAULT_CODEPAGE 437
#endif
Expand All @@ -59,12 +40,6 @@
#define CONFIG_EXFAT_DEFAULT_IOCHARSET "utf8"
#endif

#ifndef CONFIG_EXFAT_FAT32_SHORTNAME_SEQ /* Shortname ~1, ... ~9 have higher
* priority (WIN32/VFAT-like)
*/
//#define CONFIG_EXFAT_FAT32_SHORTNAME_SEQ
#endif

#ifndef CONFIG_EXFAT_ALIGNED_MPAGE_WRITE
#define CONFIG_EXFAT_ALIGNED_MPAGE_WRITE
#endif
Expand All @@ -73,10 +48,6 @@
#define CONFIG_EXFAT_FAT_MIRRORING /* Write FAT 1, FAT 2 simultaneously */
#endif

#ifndef CONFIG_EXFAT_RESTRICT_EXT_ONLY_SFN
#define CONFIG_EXFAT_RESTRICT_EXT_ONLY_SFN
#endif

#endif /* _EXFAT_CONFIG_H */

/* end of config.h */
Loading

0 comments on commit 5fc3ab8

Please sign in to comment.