Commit 30e077c9 authored by Vincent Zvikaramba's avatar Vincent Zvikaramba

Revert "fs: Add sdfat"

This reverts commit 57366ab9.
parent 0972e5c9
......@@ -96,7 +96,6 @@ menu "DOS/FAT/NT Filesystems"
source "fs/fat/Kconfig"
source "fs/ntfs/Kconfig"
source "fs/sdfat/Kconfig"
endmenu
endif # BLOCK
......
......@@ -79,7 +79,6 @@ obj-$(CONFIG_HUGETLBFS) += hugetlbfs/
obj-$(CONFIG_CODA_FS) += coda/
obj-$(CONFIG_MINIX_FS) += minix/
obj-$(CONFIG_FAT_FS) += fat/
obj-$(CONFIG_SDFAT_FS) += sdfat/
obj-$(CONFIG_BFS_FS) += bfs/
obj-$(CONFIG_ISO9660_FS) += isofs/
obj-$(CONFIG_HFSPLUS_FS) += hfsplus/ # Before hfs to find wrapped HFS+
......
config SDFAT_FS
tristate
default y
select NLS
select NLS_UTF8
select NLS_CODEPAGE_437
select NLS_ISO8859_1
help
If you want to use the sdFAT file system, then you must say Y or M
here to inlucde sdFAT support.
sdFAT is unified FAT-based file system which supports not only fat12/
16/32 with vfat but also exfat. sdFAT supports winnt short-name rule.
(winnt: emulate the Windows NT rule for display/create.)
To compile this as a module, choose M here: the module will be called
sdfat_core and sdfat_fs.
config SDFAT_DELAYED_META_DIRTY
bool "Enable delayed metadata dirty"
default y
depends on SDFAT_FS
help
If you enable this feature, metadata(FAT/Directory entry) is updated
by flush thread.
config SDFAT_SUPPORT_DIR_SYNC
bool "Enable supporting dir sync"
default n
depends on SDFAT_FS
help
If you enable this feature, the modification for directory operation
is written to a storage at once.
config SDFAT_DEFAULT_CODEPAGE
int "Default codepage for sdFAT"
default 437
depends on SDFAT_FS
help
This option should be set to the codepage of your sdFAT filesystems.
config SDFAT_DEFAULT_IOCHARSET
string "Default iocharset for sdFAT"
default "utf8"
depends on SDFAT_FS
help
Set this to the default input/output character set you'd
like sdFAT to use. It should probably match the character set
that most of your sdFAT filesystems use, and can be overridden
with the "iocharset" mount option for sdFAT filesystems.
config SDFAT_CHECK_RO_ATTR
bool "Check read-only attribute"
default n
depends on SDFAT_FS
config SDFAT_ALIGNED_MPAGE_WRITE
bool "Enable supporting aligned mpage_write"
default y
depends on SDFAT_FS
config SDFAT_VIRTUAL_XATTR
bool "Virtual xattr support for sdFAT"
default y
depends on SDFAT_FS
help
To support virtual xattr.
config SDFAT_VIRTUAL_XATTR_SELINUX_LABEL
string "Default string for SELinux label"
default "u:object_r:sdcard_external:s0"
depends on SDFAT_FS && SDFAT_VIRTUAL_XATTR
help
Set this to the default string for SELinux label.
config SDFAT_SUPPORT_STLOG
bool "Enable storage log"
default y
depends on SDFAT_FS && PROC_STLOG
config SDFAT_DEBUG
bool "enable debug features"
depends on SDFAT_FS
default y
config SDFAT_DBG_IOCTL
bool "enable debug-ioctl features"
depends on SDFAT_FS && SDFAT_DEBUG
default n
config SDFAT_DBG_MSG
bool "enable debug messages"
depends on SDFAT_FS && SDFAT_DEBUG
default y
config SDFAT_DBG_BUGON
bool "enable strict BUG_ON() for debugging"
depends on SDFAT_FS && SDFAT_DEBUG
default n
config SDFAT_STATISTICS
bool "enable statistics for bigdata"
depends on SDFAT_FS
default y
#
# Makefile for the linux FAT12/16/32(VFAT)/64(exFAT) filesystem driver.
#
obj-$(CONFIG_SDFAT_FS) += sdfat_fs.o
sdfat_fs-objs := sdfat.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
sdfat_fs-$(CONFIG_SDFAT_VIRTUAL_XATTR) += xattr.o
sdfat_fs-$(CONFIG_SDFAT_STATISTICS) += statistics.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
cscope:
rm -rf cscope.files cscope.files
find $(PWD) \( -name '*.c' -o -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.s' -o -name '*.S' \) -print > cscope.files
cscope
This diff is collapsed.
/*
* Copyright (C) 2012-2013 Samsung Electronics Co., Ltd.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _SDFAT_AMAP_H
#define _SDFAT_AMAP_H
#include <linux/fs.h>
#include <linux/list.h>
#include <linux/rbtree.h>
/* AMAP Configuration Variable */
#define SMART_ALLOC_N_HOT_AU (5)
/* Allocating Destination (for smart allocator):
* moved to sdfat.h
*/
/*
* #define ALLOC_COLD_ALIGNED (1)
* #define ALLOC_COLD_PACKING (2)
* #define ALLOC_COLD_SEQ (4)
*/
/* Minimum sectors for support AMAP create */
#define AMAP_MIN_SUPPORT_SECTORS (1048576)
#define amap_add_hot_au(amap, au) amap_insert_to_list(au, &amap->slist_hot)
/* singly linked list */
struct slist_head {
struct slist_head *next;
struct slist_head *head;
};
/* AU entry type */
typedef struct __AU_INFO_T {
uint16_t idx; /* the index of the AU (0, 1, 2, ... ) */
uint16_t free_clusters; /* # of available cluster */
union {
struct list_head head;
struct slist_head shead;/* singly linked list head for hot list */
};
} AU_INFO_T;
/* Allocation Target AU */
typedef struct __TARGET_AU_T {
AU_INFO_T *au; /* Working AU */
uint16_t idx; /* Intra-AU cluster index */
uint16_t clu_to_skip; /* Clusters to skip */
} TARGET_AU_T;
/* AMAP free-clusters-based node */
typedef struct {
struct list_head head; /* the list of AUs */
} FCLU_NODE_T;
/* AMAP options */
typedef struct {
unsigned int packing_ratio; /* Tunable packing ratio */
unsigned int au_size; /* AU size in sectors */
unsigned int au_align_factor; /* Hidden sectors % au_size */
} AMAP_OPT_T;
typedef struct __AMAP_T {
spinlock_t amap_lock; /* obsolete */
struct super_block *sb;
int n_au;
int n_clean_au, n_full_au;
int clu_align_bias;
uint16_t clusters_per_au;
AU_INFO_T **au_table; /* An array of AU_INFO entries */
AMAP_OPT_T option;
/* Size-based AU management pool (cold) */
FCLU_NODE_T *fclu_nodes; /* An array of listheads */
int fclu_order; /* Page order that fclu_nodes needs */
int fclu_hint; /* maximum # of free clusters in an AU */
/* Hot AU list */
int total_fclu_hot; /* Free clusters in hot list */
struct slist_head slist_hot; /* Hot AU list */
/* Ignored AU list */
struct slist_head slist_ignored;
/* Allocator variables (keep 2 AUs at maximum) */
TARGET_AU_T cur_cold;
TARGET_AU_T cur_hot;
int n_need_packing;
} AMAP_T;
/* AU table */
#define N_AU_PER_TABLE (int)(PAGE_SIZE / sizeof(AU_INFO_T))
#define GET_AU(amap, i_AU) (amap->au_table[(i_AU) / N_AU_PER_TABLE] + ((i_AU) % N_AU_PER_TABLE))
//#define MAX_CLU_PER_AU (int)(PAGE_SIZE / sizeof(FCLU_NODE_T))
#define MAX_CLU_PER_AU (1024)
/* Cold AU bucket <-> # of freeclusters */
#define NODE_CLEAN(amap) (&amap->fclu_nodes[amap->clusters_per_au - 1])
#define NODE(fclu, amap) (&amap->fclu_nodes[fclu - 1])
#define FREE_CLUSTERS(node, amap) ((int)(node - amap->fclu_nodes) + 1)
/* AU status */
#define MAGIC_WORKING ((struct slist_head *)0xFFFF5091)
#define IS_AU_HOT(au, amap) (au->shead.head == &amap->slist_hot)
#define IS_AU_IGNORED(au, amap) (au->shead.head == &amap->slist_ignored)
#define IS_AU_WORKING(au, amap) (au->shead.head == MAGIC_WORKING)
#define SET_AU_WORKING(au) (au->shead.head = MAGIC_WORKING)
/* AU <-> cluster */
#define i_AU_of_CLU(amap, clu) ((amap->clu_align_bias + clu) / amap->clusters_per_au)
#define CLU_of_i_AU(amap, i_au, idx) \
((uint32_t)(i_au) * (uint32_t)amap->clusters_per_au + (idx) - amap->clu_align_bias)
/*
* NOTE : AMAP internal functions are moved to core.h
*/
#endif /* _SDFAT_AMAP_H */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* Copyright (C) 2012-2013 Samsung Electronics Co., Ltd.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _SDFAT_CONFIG_H
#define _SDFAT_CONFIG_H
/*======================================================================*/
/* */
/* FFS CONFIGURATIONS */
/* (CHANGE THIS PART IF REQUIRED) */
/* */
/*======================================================================*/
/*----------------------------------------------------------------------*/
/* Feature Config */
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* Debug/Experimental Config */
/*----------------------------------------------------------------------*/
//#define CONFIG_SDFAT_TRACE_IO
//#define CONFIG_SDFAT_TRACE_LOCK /* Trace elapsed time in lock_super(sb) */
/*----------------------------------------------------------------------*/
/* Defragmentation Config */
/*----------------------------------------------------------------------*/
//#define CONFIG_SDFAT_DFR
//#define CONFIG_SDFAT_DFR_PACKING
//#define CONFIG_SDFAT_DFR_DEBUG
/*----------------------------------------------------------------------*/
/* Config for Kernel equal or newer than 3.7 */
/*----------------------------------------------------------------------*/
#ifndef CONFIG_SDFAT_WRITE_SB_INTERVAL_CSECS
#define CONFIG_SDFAT_WRITE_SB_INTERVAL_CSECS (dirty_writeback_interval)
#endif
/*----------------------------------------------------------------------*/
/* Default Kconfig */
/*----------------------------------------------------------------------*/
/* default mount options */
#ifndef CONFIG_SDFAT_DEFAULT_CODEPAGE /* if Kconfig lacked codepage */
#define CONFIG_SDFAT_DEFAULT_CODEPAGE 437
#endif
#ifndef CONFIG_SDFAT_DEFAULT_IOCHARSET /* if Kconfig lacked iocharset */
#define CONFIG_SDFAT_DEFAULT_IOCHARSET "utf8"
#endif
#ifndef CONFIG_SDFAT_FAT32_SHORTNAME_SEQ /* Shortname ~1, ... ~9 have higher
* priority (WIN32/VFAT-like)
*/
//#define CONFIG_SDFAT_FAT32_SHORTNAME_SEQ
#endif
#ifndef CONFIG_SDFAT_ALIGNED_MPAGE_WRITE
//#define CONFIG_SDFAT_ALIGNED_MPAGE_WRITE
#endif
#ifndef CONFIG_SDFAT_FAT_MIRRORING /* if Kconfig lacked fat-mirroring option */
#define CONFIG_SDFAT_FAT_MIRRORING /* Write FAT 1, FAT 2 simultaneously */
#endif
#ifndef CONFIG_SDFAT_DELAYED_META_DIRTY
//#define CONFIG_SDFAT_DELAYED_META_DIRTY /* delayed DIR/FAT dirty support */
#endif
#ifndef CONFIG_SDFAT_SUPPORT_DIR_SYNC
//#define CONFIG_SDFAT_SUPPORT_DIR_SYNC /* support DIR_SYNC */
#endif
#ifndef CONFIG_SDFAT_CHECK_RO_ATTR
//#define CONFIG_SDFAT_CHECK_RO_ATTR
#endif
#ifndef CONFIG_SDFAT_RESTRICT_EXT_ONLY_SFN
#define CONFIG_SDFAT_RESTRICT_EXT_ONLY_SFN
#endif
#ifndef CONFIG_SDFAT_ALLOW_LOOKUP_LOSSY_SFN
//#define CONFIG_SDFAT_ALLOW_LOOKUP_LOSSY_SFN
#endif
#ifndef CONFIG_SDFAT_DBG_SHOW_PID
//#define CONFIG_SDFAT_DBG_SHOW_PID
#endif
#ifndef CONFIG_SDFAT_VIRTUAL_XATTR
//#define CONFIG_SDFAT_VIRTUAL_XATTR
#endif
#ifndef CONFIG_SDFAT_SUPPORT_STLOG
//#define CONFIG_SDFAT_SUPPORT_STLOG
#endif
#ifndef CONFIG_SDFAT_DEBUG
//{
//#define CONFIG_SDFAT_DEBUG
#ifndef CONFIG_SDFAT_DBG_IOCTL
//#define CONFIG_SDFAT_DBG_IOCTL
#endif
#ifndef CONFIG_SDFAT_DBG_MSG
//#define CONFIG_SDFAT_DBG_MSG
#endif
#ifndef CONFIG_SDFAT_DBG_CAREFUL
//#define CONFIG_SDFAT_DBG_CAREFUL
#endif
#ifndef CONFIG_SDFAT_DBG_BUGON
//#define CONFIG_SDFAT_DBG_BUGON
#endif
#ifndef CONFIG_SDFAT_DBG_WARNON
//#define CONFIG_SDFAT_DBG_WARNON
#endif
//}
#endif /* CONFIG_SDFAT_DEBUG */
#ifndef CONFIG_SDFAT_TRACE_SB_LOCK
//#define CONFIG_SDFAT_TRACE_SB_LOCK
#endif
#ifndef CONFIG_SDFAT_TRACE_ELAPSED_TIME
//#define CONFIG_SDFAT_TRACE_ELAPSED_TIME
#endif
#endif /* _SDFAT_CONFIG_H */
/* end of config.h */
This diff is collapsed.
/*
* Copyright (C) 2012-2013 Samsung Electronics Co., Ltd.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _SDFAT_CORE_H
#define _SDFAT_CORE_H
#include <asm/byteorder.h>
#include "config.h"
#include "api.h"
#include "upcase.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/*----------------------------------------------------------------------*/
/* Constant & Macro Definitions */
/*----------------------------------------------------------------------*/
#define get_next_clus(sb, pclu) fat_ent_get(sb, *(pclu), pclu)
#define get_next_clus_safe(sb, pclu) fat_ent_get_safe(sb, *(pclu), pclu)
/* file status */
/* this prevents
* fscore_write_inode, fscore_map_clus, ... with the unlinked inodes
* from corrupting on-disk dentry data.
*
* The fid->dir value of unlinked inode will be DIR_DELETED
* and those functions must check if fid->dir is valid prior to
* the calling of get_dentry_in_dir()
*/
#define DIR_DELETED 0xFFFF0321
/*----------------------------------------------------------------------*/
/* Type Definitions */
/*----------------------------------------------------------------------*/
#define ES_2_ENTRIES 2
#define ES_3_ENTRIES 3
#define ES_ALL_ENTRIES 0
typedef struct {
u32 sector; // sector number that contains file_entry
s32 offset; // byte offset in the sector
s32 alloc_flag; // flag in stream entry. 01 for cluster chain, 03 for contig. clusteres.
u32 num_entries;
// __buf should be the last member
void *__buf;
} ENTRY_SET_CACHE_T;
/*----------------------------------------------------------------------*/
/* External Function Declarations */
/*----------------------------------------------------------------------*/
/* file system initialization & shutdown functions */
s32 fscore_init(void);
s32 fscore_shutdown(void);
/* chain management */
s32 chain_cont_cluster(struct super_block *sb, u32 chain, s32 len);
/* volume management functions */
s32 fscore_mount(struct super_block *sb);
s32 fscore_umount(struct super_block *sb);
s32 fscore_statfs(struct super_block *sb, VOL_INFO_T *info);
s32 fscore_sync_fs(struct super_block *sb, s32 do_sync);
s32 fscore_set_vol_flags(struct super_block *sb, u16 new_flag, s32 always_sync);
u32 fscore_get_au_stat(struct super_block *sb, s32 mode);
/* file management functions */
s32 fscore_lookup(struct inode *inode, u8 *path, FILE_ID_T *fid);
s32 fscore_create(struct inode *inode, u8 *path, u8 mode, FILE_ID_T *fid);
s32 fscore_read_link(struct inode *inode, FILE_ID_T *fid, void *buffer, u64 count, u64 *rcount);
s32 fscore_write_link(struct inode *inode, FILE_ID_T *fid, void *buffer, u64 count, u64 *wcount);
s32 fscore_truncate(struct inode *inode, u64 old_size, u64 new_size);
s32 fscore_rename(struct inode *old_parent_inode, FILE_ID_T *fid,
struct inode *new_parent_inode, struct dentry *new_dentry);
s32 fscore_remove(struct inode *inode, FILE_ID_T *fid);
s32 fscore_read_inode(struct inode *inode, DIR_ENTRY_T *info);
s32 fscore_write_inode(struct inode *inode, DIR_ENTRY_T *info, int sync);
s32 fscore_map_clus(struct inode *inode, s32 clu_offset, u32 *clu, int dest);
s32 fscore_reserve_clus(struct inode *inode);
s32 fscore_unlink(struct inode *inode, FILE_ID_T *fid);
/* directory management functions */
s32 fscore_mkdir(struct inode *inode, u8 *path, FILE_ID_T *fid);
s32 fscore_readdir(struct inode *inode, DIR_ENTRY_T *dir_ent);
s32 fscore_rmdir(struct inode *inode, FILE_ID_T *fid);
/*----------------------------------------------------------------------*/
/* External Function Declarations (NOT TO UPPER LAYER) */
/*----------------------------------------------------------------------*/
/* core.c : core code for common */
/* dir entry management functions */
DENTRY_T *get_dentry_in_dir(struct super_block *sb, CHAIN_T *p_dir, s32 entry, u32 *sector);
/* name conversion functions */
void get_uniname_from_dos_entry(struct super_block *sb, DOS_DENTRY_T *ep, UNI_NAME_T *p_uniname, u8 mode);
/* file operation functions */
s32 walk_fat_chain(struct super_block *sb, CHAIN_T *p_dir, s32 byte_offset, u32 *clu);
/* sdfat/cache.c */
s32 meta_cache_init(struct super_block *sb);
s32 meta_cache_shutdown(struct super_block *sb);
u8 *fcache_getblk(struct super_block *sb, u32 sec);
s32 fcache_modify(struct super_block *sb, u32 sec);
s32 fcache_release_all(struct super_block *sb);
s32 fcache_flush(struct super_block *sb, u32 sync);
u8 *dcache_getblk(struct super_block *sb, u32 sec);
s32 dcache_modify(struct super_block *sb, u32 sec);
s32 dcache_lock(struct super_block *sb, u32 sec);
s32 dcache_unlock(struct super_block *sb, u32 sec);
s32 dcache_release(struct super_block *sb, u32 sec);
s32 dcache_release_all(struct super_block *sb);
s32 dcache_flush(struct super_block *sb, u32 sync);
s32 dcache_readahead(struct super_block *sb, u32 sec);
/* fatent.c */
s32 fat_ent_ops_init(struct super_block *sb);
s32 fat_ent_get(struct super_block *sb, u32 loc, u32 *content);
s32 fat_ent_set(struct super_block *sb, u32 loc, u32 content);
s32 fat_ent_get_safe(struct super_block *sb, u32 loc, u32 *content);
/* core_fat.c : core code for fat */
s32 fat_generate_dos_name_new(struct super_block *sb, CHAIN_T *p_dir, DOS_NAME_T *p_dosname, s32 n_entries);
s32 mount_fat16(struct super_block *sb, pbr_t *p_pbr);
s32 mount_fat32(struct super_block *sb, pbr_t *p_pbr);
/* core_exfat.c : core code for exfat */
s32 load_alloc_bmp(struct super_block *sb);
void free_alloc_bmp(struct super_block *sb);
ENTRY_SET_CACHE_T *get_dentry_set_in_dir(struct super_block *sb,
CHAIN_T *p_dir, s32 entry, u32 type, DENTRY_T **file_ep);
void release_dentry_set(ENTRY_SET_CACHE_T *es);
s32 update_dir_chksum(struct super_block *sb, CHAIN_T *p_dir, s32 entry);
s32 update_dir_chksum_with_entry_set(struct super_block *sb, ENTRY_SET_CACHE_T *es);
bool is_dir_empty(struct super_block *sb, CHAIN_T *p_dir);
s32 mount_exfat(struct super_block *sb, pbr_t *p_pbr);
/* amap_smart.c : creation on mount / destroy on umount */
int amap_create(struct super_block *sb, u32 pack_ratio, u32 sect_per_au, u32 hidden_sect);
void amap_destroy(struct super_block *sb);
/* amap_smart.c : (de)allocation functions */
s32 amap_fat_alloc_cluster(struct super_block *sb, s32 num_alloc, CHAIN_T *p_chain, int dest);
s32 amap_free_cluster(struct super_block *sb, CHAIN_T *p_chain, s32 do_relse);/* Not impelmented */
s32 amap_release_cluster(struct super_block *sb, u32 clu); /* Only update AMAP */
/* amap_smart.c : misc (for defrag) */
s32 amap_mark_ignore(struct super_block *sb, u32 clu);
s32 amap_unmark_ignore(struct super_block *sb, u32 clu);
s32 amap_unmark_ignore_all(struct super_block *sb);
s32 amap_check_working(struct super_block *sb, u32 clu);
s32 amap_get_freeclus(struct super_block *sb, u32 clu);
/* amap_smart.c : stat AU */
u32 amap_get_au_stat(struct super_block *sb, s32 mode);
/* blkdev.c */
s32 bdev_open_dev(struct super_block *sb);
s32 bdev_close_dev(struct super_block *sb);
s32 bdev_check_bdi_valid(struct super_block *sb);
s32 bdev_readahead(struct super_block *sb, u32 secno, u32 num_secs);
s32 bdev_mread(struct super_block *sb, u32 secno, struct buffer_head **bh, u32 num_secs, s32 read);
s32 bdev_mwrite(struct super_block *sb, u32 secno, struct buffer_head *bh, u32 num_secs, s32 sync);
s32 bdev_sync_all(struct super_block *sb);
/* blkdev.c : sector read/write functions */
s32 read_sect(struct super_block *sb, u32 sec, struct buffer_head **bh, s32 read);
s32 write_sect(struct super_block *sb, u32 sec, struct buffer_head *bh, s32 sync);
s32 read_msect(struct super_block *sb, u32 sec, struct buffer_head **bh, s32 num_secs, s32 read);
s32 write_msect(struct super_block *sb, u32 sec, struct buffer_head *bh, s32 num_secs, s32 sync);
s32 write_msect_zero(struct super_block *sb, u32 sec, s32 num_secs);
/* misc.c */
u8 calc_chksum_1byte(void *data, s32 len, u8 chksum);
u16 calc_chksum_2byte(void *data, s32 len, u16 chksum, s32 type);
/* extent.c */
s32 extent_cache_init(void);
void extent_cache_shutdown(void);
void extent_cache_init_inode(struct inode *inode);
void extent_cache_inval_inode(struct inode *inode);
s32 extent_get_clus(struct inode *inode, s32 cluster, s32 *fclus,
u32 *dclus, u32 *last_dclus, s32 allow_eof);
/*----------------------------------------------------------------------*/
/* Wrapper Function */
/*----------------------------------------------------------------------*/
void set_sb_dirty(struct super_block *sb);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* _SDFAT_CORE_H */
/* end of core.h */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* Copyright (C) 2012-2013 Samsung Electronics Co., Ltd.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _SDFAT_DEFRAG_H
#define _SDFAT_DEFRAG_H
#ifdef CONFIG_SDFAT_DFR
/* Tuning parameters */
#define DFR_MIN_TIMEOUT (1 * HZ) // Minimum timeout for forced-sync
#define DFR_DEFAULT_TIMEOUT (10 * HZ) // Default timeout for forced-sync
#define DFR_DEFAULT_CLEAN_RATIO (50) // Wake-up daemon when clean AU ratio under 50%
#define DFR_DEFAULT_WAKEUP_RATIO (10) // Wake-up daemon when clean AU ratio under 10%, regardless of frag_ratio
#define DFR_DEFAULT_FRAG_RATIO (130) // Wake-up daemon when frag_ratio over 130%
#define DFR_DEFAULT_PACKING_RATIO (10) // Call allocator with PACKING flag, when clean AU ratio under 10%
#define DFR_DEFAULT_STOP_RATIO (98) // Stop defrag_daemon when disk used ratio over 98%
#define DFR_FULL_RATIO (100)
#define DFR_MAX_AU_MOVED (16) // Maximum # of AUs for a request
/* Debugging support*/
#define dfr_err(fmt, args...) pr_err("DFR: " fmt "\n", args)
#ifdef CONFIG_SDFAT_DFR_DEBUG
#define dfr_debug(fmt, args...) pr_debug("DFR: " fmt "\n", args)
#else
#define dfr_debug(fmt, args...)
#endif
/* Error handling */
#define ERR_HANDLE(err) { \
if (err) { \
dfr_debug("err %d", err); \
goto error; \
} \
}
#define ERR_HANDLE2(cond, err, val) { \
if (cond) { \
err = val; \
dfr_debug("err %d", err); \
goto error; \
} \
}
/* Arguments IN-OUT */
#define IN
#define OUT
#define INOUT
/* Macros */
#define GET64_HI(var64) ((unsigned int)((var64) >> 32))
#define GET64_LO(var64) ((unsigned int)(((var64) << 32) >> 32))
#define SET64_HI(dst64, var32) { (dst64) = ((loff_t)(var32) << 32) | ((dst64) & 0x00000000ffffffffLL); }
#define SET64_LO(dst64, var32) { (dst64) = ((dst64) & 0xffffffff00000000LL) | ((var32) & 0x00000000ffffffffLL); }
#define GET32_HI(var32) ((unsigned short)((var32) >> 16))
#define GET32_LO(var32) ((unsigned short)(((var32) << 16) >> 16))
#define SET32_HI(dst32, var16) { (dst32) = ((unsigned int)(var16) << 16) | ((dst32) & 0x0000ffff); }
#define SET32_LO(dst32, var16) { (dst32) = ((dst32) & 0xffff0000) | ((unsigned int)(var16) & 0x0000ffff); }
/* FAT32 related */
#define FAT32_EOF (0x0fffffff)
#define FAT32_RESERVED (0x0ffffff7)