Commit f09d4bf9 authored by Vincent Zvikaramba's avatar Vincent Zvikaramba

Revert "fs: sdfat: Update to version 2.0.6-lineage"

This reverts commit f32030da.
parent 5e059ae6
......@@ -367,7 +367,7 @@ int amap_create(struct super_block *sb, u32 pack_ratio, u32 sect_per_au, u32 hid
/* data start sector must be a multiple of clu_size */
if (fsi->data_start_sector & (fsi->sect_per_clus - 1)) {
sdfat_msg(sb, KERN_ERR,
"misaligned data area (start sect : %llu, "
"misaligned data area (start sect : %u, "
"sect_per_clus : %u) "
"please re-format for performance.",
fsi->data_start_sector, fsi->sect_per_clus);
......@@ -882,7 +882,7 @@ ret_new_cold:
}
/* Put and update target AU */
void amap_put_target_au(AMAP_T *amap, TARGET_AU_T *cur, unsigned int num_allocated)
void amap_put_target_au(AMAP_T *amap, TARGET_AU_T *cur, int num_allocated)
{
/* Update AMAP info vars. */
if (num_allocated > 0 &&
......@@ -973,33 +973,37 @@ static inline int amap_skip_cluster(struct super_block *sb, TARGET_AU_T *cur, in
/* AMAP-based allocation function for FAT32 */
s32 amap_fat_alloc_cluster(struct super_block *sb, u32 num_alloc, CHAIN_T *p_chain, s32 dest)
s32 amap_fat_alloc_cluster(struct super_block *sb, s32 num_alloc, CHAIN_T *p_chain, int dest)
{
AMAP_T *amap = SDFAT_SB(sb)->fsi.amap;
TARGET_AU_T *cur = NULL;
AU_INFO_T *target_au = NULL; /* Allocation target AU */
s32 ret = -ENOSPC;
u32 last_clu = CLUS_EOF, read_clu;
u32 new_clu, total_cnt;
u32 num_allocated = 0, num_allocated_each = 0;
s32 new_clu; // Max. 2G 개의 clusters
s32 num_allocated = 0, num_allocated_each = 0;
FS_INFO_T *fsi = &(SDFAT_SB(sb)->fsi);
BUG_ON(!amap);
BUG_ON(IS_CLUS_EOF(fsi->used_clusters));
total_cnt = fsi->num_clusters - CLUS_BASE;
p_chain->dir = CLUS_EOF;
if (unlikely(total_cnt < fsi->used_clusters)) {
sdfat_fs_error_ratelimit(sb,
"AMAP(%s): invalid used clusters(t:%u,u:%u)\n",
__func__, total_cnt, fsi->used_clusters);
return -EIO;
}
if ((fsi->used_clusters + num_alloc) > (fsi->num_clusters - CLUS_BASE)) {
/* Reserved count management error
* or called by dir. management function on fully filled disk
*/
num_alloc = fsi->num_clusters - fsi->used_clusters - CLUS_BASE;
if (num_alloc > total_cnt - fsi->used_clusters)
return -ENOSPC;
if (unlikely(num_alloc < 0)) {
sdfat_fs_error_ratelimit(sb,
"AMAP(%s): invalid used clusters(t:%u,u:%u)\n",
__func__, fsi->num_clusters, fsi->used_clusters);
return -EIO;
}
p_chain->dir = CLUS_EOF;
if (!num_alloc)
return 0;
}
set_sb_dirty(sb);
......@@ -1011,15 +1015,13 @@ retry_alloc:
if (unlikely(!cur)) {
// There is no available AU (only ignored-AU are left)
sdfat_msg(sb, KERN_ERR, "AMAP Allocator: no avaialble AU.");
goto error;
return 0;
}
/* If there are clusters to skip */
if (cur->clu_to_skip > 0) {
if (amap_skip_cluster(sb, &amap->cur_cold, cur->clu_to_skip)) {
ret = -EIO;
goto error;
}
if (amap_skip_cluster(sb, &amap->cur_cold, cur->clu_to_skip))
return -EIO;
cur->clu_to_skip = 0;
}
......@@ -1039,31 +1041,24 @@ retry_alloc:
do {
/* Allocate at the target AU */
if ((new_clu >= CLUS_BASE) && (new_clu < fsi->num_clusters)) {
if (fat_ent_get(sb, new_clu, &read_clu)) {
if (fat_ent_get(sb, new_clu, &read_clu))
// spin_unlock(&amap->amap_lock);
ret = -EIO;
goto error;
}
return -EIO; // goto err_and_return
if (IS_CLUS_FREE(read_clu)) {
BUG_ON(GET_AU(amap, i_AU_of_CLU(amap, new_clu)) != target_au);
/* Free cluster found */
if (fat_ent_set(sb, new_clu, CLUS_EOF)) {
ret = -EIO;
goto error;
}
if (fat_ent_set(sb, new_clu, CLUS_EOF))
return -EIO;
num_allocated_each++;
if (IS_CLUS_EOF(p_chain->dir)) {
if (IS_CLUS_EOF(p_chain->dir))
p_chain->dir = new_clu;
} else {
if (fat_ent_set(sb, last_clu, new_clu)) {
ret = -EIO;
goto error;
}
}
else
if (fat_ent_set(sb, last_clu, new_clu))
return -EIO;
last_clu = new_clu;
/* Update au info */
......@@ -1093,11 +1088,7 @@ retry_alloc:
goto retry_alloc;
// spin_unlock(&amap->amap_lock);
return 0;
error:
if (num_allocated)
fsi->fs_func->free_cluster(sb, p_chain, 0);
return ret;
return num_allocated;
}
......@@ -1126,8 +1117,8 @@ s32 amap_release_cluster(struct super_block *sb, u32 clu)
au = GET_AU(amap, i_au);
if (au->free_clusters >= amap->clusters_per_au) {
sdfat_fs_error(sb, "%s, au->free_clusters(%hd) is "
"greater than or equal to amap->clusters_per_au(%hd)",
__func__, au->free_clusters, amap->clusters_per_au);
"greater than or equal to amap->clusters_per_au(%hd)"
, __func__, au->free_clusters, amap->clusters_per_au);
return -EIO;
}
......
......@@ -94,7 +94,7 @@ typedef struct __AMAP_T {
int fclu_hint; /* maximum # of free clusters in an AU */
/* Hot AU list */
unsigned int total_fclu_hot; /* Free clusters in hot list */
int total_fclu_hot; /* Free clusters in hot list */
struct slist_head slist_hot; /* Hot AU list */
/* Ignored AU list */
......
......@@ -328,7 +328,7 @@ s32 fsapi_write_inode(struct inode *inode, DIR_ENTRY_T *info, int sync)
EXPORT_SYMBOL(fsapi_write_inode);
/* return the cluster number in the given cluster offset */
s32 fsapi_map_clus(struct inode *inode, u32 clu_offset, u32 *clu, int dest)
s32 fsapi_map_clus(struct inode *inode, s32 clu_offset, u32 *clu, int dest)
{
s32 err;
struct super_block *sb = inode->i_sb;
......
......@@ -119,13 +119,13 @@ typedef struct {
} DATE_TIME_T;
typedef struct {
u64 Offset; // start sector number of the partition
u64 Size; // in sectors
u32 Offset; // start sector number of the partition
u32 Size; // in sectors
} PART_INFO_T;
typedef struct {
u32 SecSize; // sector size in bytes
u64 DevSize; // block device size in sectors
u32 DevSize; // block device size in sectors
} DEV_INFO_T;
typedef struct {
......@@ -139,7 +139,7 @@ typedef struct {
/* directory structure */
typedef struct {
u32 dir;
u32 size;
s32 size;
u8 flags;
} CHAIN_T;
......@@ -147,7 +147,7 @@ typedef struct {
typedef struct {
u32 clu;
union {
u32 off; // cluster offset
s32 off; // cluster offset
s32 eidx; // entry index
};
} HINT_T;
......@@ -209,7 +209,7 @@ typedef struct __cache_entry {
struct __cache_entry *next;
struct __cache_entry *prev;
} hash;
u64 sec;
u32 sec;
u32 flag;
struct buffer_head *bh;
} cache_ent_t;
......@@ -223,7 +223,7 @@ typedef struct __FATENT_OPS_T {
} FATENT_OPS_T;
typedef struct {
s32 (*alloc_cluster)(struct super_block *, u32, CHAIN_T *, s32);
s32 (*alloc_cluster)(struct super_block *, s32, CHAIN_T *, int);
s32 (*free_cluster)(struct super_block *, CHAIN_T *, s32);
s32 (*count_used_clusters)(struct super_block *, u32 *);
s32 (*init_dir_entry)(struct super_block *, CHAIN_T *, s32, u32, u32, u64);
......@@ -253,16 +253,16 @@ 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_sectors; // num of sectors in volume
u32 num_clusters; // num of clusters in volume
u32 cluster_size; // cluster size in bytes
u32 cluster_size_bits;
u32 sect_per_clus; // cluster size in sectors
u32 sect_per_clus_bits;
u64 FAT1_start_sector; // FAT1 start sector
u64 FAT2_start_sector; // FAT2 start sector
u64 root_start_sector; // root dir start sector
u64 data_start_sector; // data area start sector
u32 FAT1_start_sector; // FAT1 start sector
u32 FAT2_start_sector; // FAT2 start sector
u32 root_start_sector; // root dir start sector
u32 data_start_sector; // data area start sector
u32 num_FAT_sectors; // num of FAT sectors
u32 root_dir; // root dir cluster
u32 dentries_in_root; // num of dentries in root dir
......@@ -337,7 +337,7 @@ s32 fsapi_rename(struct inode *old_parent_inode, FILE_ID_T *fid,
s32 fsapi_unlink(struct inode *inode, FILE_ID_T *fid);
s32 fsapi_read_inode(struct inode *inode, DIR_ENTRY_T *info);
s32 fsapi_write_inode(struct inode *inode, DIR_ENTRY_T *info, int sync);
s32 fsapi_map_clus(struct inode *inode, u32 clu_offset, u32 *clu, int dest);
s32 fsapi_map_clus(struct inode *inode, s32 clu_offset, u32 *clu, int dest);
s32 fsapi_reserve_clus(struct inode *inode);
/* directory management functions */
......
......@@ -106,12 +106,12 @@ s32 bdev_check_bdi_valid(struct super_block *sb)
/* Make a readahead request */
s32 bdev_readahead(struct super_block *sb, u64 secno, u64 num_secs)
s32 bdev_readahead(struct super_block *sb, u32 secno, u32 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;
u32 i;
if (!fsi->bd_opened)
return -EIO;
......@@ -120,14 +120,14 @@ s32 bdev_readahead(struct super_block *sb, u64 secno, u64 num_secs)
for (i = 0; i < num_secs; i++) {
if (i && !(i & (sects_per_page - 1)))
blk_flush_plug(current);
sb_breadahead(sb, (sector_t)(secno + i));
sb_breadahead(sb, secno + i);
}
blk_finish_plug(&plug);
return 0;
}
s32 bdev_mread(struct super_block *sb, u64 secno, struct buffer_head **bh, u64 num_secs, s32 read)
s32 bdev_mread(struct super_block *sb, u32 secno, struct buffer_head **bh, u32 num_secs, s32 read)
{
FS_INFO_T *fsi = &(SDFAT_SB(sb)->fsi);
u8 blksize_bits = sb->s_blocksize_bits;
......@@ -145,9 +145,9 @@ s32 bdev_mread(struct super_block *sb, u64 secno, struct buffer_head **bh, u64 n
brelse(*bh);
if (read)
*bh = __bread(sb->s_bdev, (sector_t)secno, num_secs << blksize_bits);
*bh = __bread(sb->s_bdev, secno, num_secs << blksize_bits);
else
*bh = __getblk(sb->s_bdev, (sector_t)secno, num_secs << blksize_bits);
*bh = __getblk(sb->s_bdev, secno, num_secs << blksize_bits);
/* read successfully */
if (*bh)
......@@ -165,9 +165,9 @@ s32 bdev_mread(struct super_block *sb, u64 secno, struct buffer_head **bh, u64 n
return -EIO;
}
s32 bdev_mwrite(struct super_block *sb, u64 secno, struct buffer_head *bh, u64 num_secs, s32 sync)
s32 bdev_mwrite(struct super_block *sb, u32 secno, struct buffer_head *bh, u32 num_secs, s32 sync)
{
u64 count;
s32 count;
struct buffer_head *bh2;
FS_INFO_T *fsi = &(SDFAT_SB(sb)->fsi);
#ifdef CONFIG_SDFAT_DBG_IOCTL
......@@ -189,7 +189,7 @@ s32 bdev_mwrite(struct super_block *sb, u64 secno, struct buffer_head *bh, u64 n
} else {
count = num_secs << sb->s_blocksize_bits;
bh2 = __getblk(sb->s_bdev, (sector_t)secno, count);
bh2 = __getblk(sb->s_bdev, secno, count);
if (!bh2)
goto no_bh;
......@@ -239,39 +239,39 @@ s32 bdev_sync_all(struct super_block *sb)
/*
* Sector Read/Write Functions
*/
s32 read_sect(struct super_block *sb, u64 sec, struct buffer_head **bh, s32 read)
s32 read_sect(struct super_block *sb, u32 sec, struct buffer_head **bh, s32 read)
{
FS_INFO_T *fsi = &(SDFAT_SB(sb)->fsi);
BUG_ON(!bh);
if ((sec >= fsi->num_sectors) && (fsi->num_sectors > 0)) {
sdfat_fs_error_ratelimit(sb,
"%s: out of range (sect:%llu)", __func__, sec);
"%s: out of range (sect:%u)", __func__, sec);
return -EIO;
}
if (bdev_mread(sb, sec, bh, 1, read)) {
sdfat_fs_error_ratelimit(sb,
"%s: I/O error (sect:%llu)", __func__, sec);
"%s: I/O error (sect:%u)", __func__, sec);
return -EIO;
}
return 0;
}
s32 write_sect(struct super_block *sb, u64 sec, struct buffer_head *bh, s32 sync)
s32 write_sect(struct super_block *sb, u32 sec, struct buffer_head *bh, s32 sync)
{
FS_INFO_T *fsi = &(SDFAT_SB(sb)->fsi);
BUG_ON(!bh);
if ((sec >= fsi->num_sectors) && (fsi->num_sectors > 0)) {
sdfat_fs_error_ratelimit(sb,
"%s: out of range (sect:%llu)", __func__, sec);
"%s: out of range (sect:%u)", __func__, sec);
return -EIO;
}
if (bdev_mwrite(sb, sec, bh, 1, sync)) {
sdfat_fs_error_ratelimit(sb, "%s: I/O error (sect:%llu)",
sdfat_fs_error_ratelimit(sb, "%s: I/O error (sect:%u)",
__func__, sec);
return -EIO;
}
......@@ -279,19 +279,19 @@ s32 write_sect(struct super_block *sb, u64 sec, struct buffer_head *bh, s32 sync
return 0;
}
s32 read_msect(struct super_block *sb, u64 sec, struct buffer_head **bh, u64 num_secs, s32 read)
s32 read_msect(struct super_block *sb, u32 sec, struct buffer_head **bh, s32 num_secs, s32 read)
{
FS_INFO_T *fsi = &(SDFAT_SB(sb)->fsi);
BUG_ON(!bh);
if (((sec+num_secs) > fsi->num_sectors) && (fsi->num_sectors > 0)) {
sdfat_fs_error_ratelimit(sb, "%s: out of range(sect:%llu len:%llu)",
sdfat_fs_error_ratelimit(sb, "%s: out of range(sect:%u len:%d)",
__func__, sec, num_secs);
return -EIO;
}
if (bdev_mread(sb, sec, bh, num_secs, read)) {
sdfat_fs_error_ratelimit(sb, "%s: I/O error (sect:%llu len:%llu)",
sdfat_fs_error_ratelimit(sb, "%s: I/O error (sect:%u len:%d)",
__func__, sec, num_secs);
return -EIO;
}
......@@ -299,20 +299,20 @@ s32 read_msect(struct super_block *sb, u64 sec, struct buffer_head **bh, u64 num
return 0;
}
s32 write_msect(struct super_block *sb, u64 sec, struct buffer_head *bh, u64 num_secs, s32 sync)
s32 write_msect(struct super_block *sb, u32 sec, struct buffer_head *bh, s32 num_secs, s32 sync)
{
FS_INFO_T *fsi = &(SDFAT_SB(sb)->fsi);
BUG_ON(!bh);
if (((sec+num_secs) > fsi->num_sectors) && (fsi->num_sectors > 0)) {
sdfat_fs_error_ratelimit(sb, "%s: out of range(sect:%llu len:%llu)",
sdfat_fs_error_ratelimit(sb, "%s: out of range(sect:%u len:%d)",
__func__, sec, num_secs);
return -EIO;
}
if (bdev_mwrite(sb, sec, bh, num_secs, sync)) {
sdfat_fs_error_ratelimit(sb, "%s: I/O error (sect:%llu len:%llu)",
sdfat_fs_error_ratelimit(sb, "%s: I/O error (sect:%u len:%d)",
__func__, sec, num_secs);
return -EIO;
}
......@@ -340,11 +340,11 @@ static inline s32 __blkdev_sync_bhs(struct buffer_head **bhs, s32 nr_bhs)
return err;
}
static inline s32 __buffer_zeroed(struct super_block *sb, u64 blknr, u64 num_secs)
static inline s32 __buffer_zeroed(struct super_block *sb, u32 blknr, s32 num_secs)
{
struct buffer_head *bhs[MAX_BUF_PER_PAGE];
s32 nr_bhs = MAX_BUF_PER_PAGE;
u64 last_blknr = blknr + num_secs;
u32 last_blknr = blknr + num_secs;
s32 err, i, n;
struct blk_plug plug;
......@@ -352,7 +352,7 @@ static inline s32 __buffer_zeroed(struct super_block *sb, u64 blknr, u64 num_sec
n = 0;
blk_start_plug(&plug);
while (blknr < last_blknr) {
bhs[n] = sb_getblk(sb, (sector_t)blknr);
bhs[n] = sb_getblk(sb, blknr);
if (!bhs[n]) {
err = -ENOMEM;
blk_finish_plug(&plug);
......@@ -389,19 +389,19 @@ static inline s32 __buffer_zeroed(struct super_block *sb, u64 blknr, u64 num_sec
return 0;
error:
EMSG("%s: failed zeroed sect %llu\n", __func__, blknr);
EMSG("%s: failed zeroed sect %u\n", __func__, blknr);
for (i = 0; i < n; i++)
bforget(bhs[i]);
return err;
}
s32 write_msect_zero(struct super_block *sb, u64 sec, u64 num_secs)
s32 write_msect_zero(struct super_block *sb, u32 sec, s32 num_secs)
{
FS_INFO_T *fsi = &(SDFAT_SB(sb)->fsi);
if (((sec+num_secs) > fsi->num_sectors) && (fsi->num_sectors > 0)) {
sdfat_fs_error_ratelimit(sb, "%s: out of range(sect:%llu len:%llu)",
sdfat_fs_error_ratelimit(sb, "%s: out of range(sect:%u len:%d)",
__func__, sec, num_secs);
return -EIO;
}
......
......@@ -53,13 +53,13 @@
/*----------------------------------------------------------------------*/
/* Cache handling function declarations */
/*----------------------------------------------------------------------*/
static cache_ent_t *__fcache_find(struct super_block *sb, u64 sec);
static cache_ent_t *__fcache_get(struct super_block *sb);
static cache_ent_t *__fcache_find(struct super_block *sb, u32 sec);
static cache_ent_t *__fcache_get(struct super_block *sb, u32 sec);
static void __fcache_insert_hash(struct super_block *sb, cache_ent_t *bp);
static void __fcache_remove_hash(cache_ent_t *bp);
static cache_ent_t *__dcache_find(struct super_block *sb, u64 sec);
static cache_ent_t *__dcache_get(struct super_block *sb);
static cache_ent_t *__dcache_find(struct super_block *sb, u32 sec);
static cache_ent_t *__dcache_get(struct super_block *sb, u32 sec);
static void __dcache_insert_hash(struct super_block *sb, cache_ent_t *bp);
static void __dcache_remove_hash(cache_ent_t *bp);
......@@ -126,17 +126,17 @@ static inline void __remove_from_hash(cache_ent_t *bp)
* sec: sector No. in FAT1
* bh: bh of sec.
*/
static inline s32 __fat_copy(struct super_block *sb, u64 sec, struct buffer_head *bh, int sync)
static inline s32 __fat_copy(struct super_block *sb, u32 sec, struct buffer_head *bh, int sync)
{
#ifdef CONFIG_SDFAT_FAT_MIRRORING
FS_INFO_T *fsi = &(SDFAT_SB(sb)->fsi);
u64 sec2;
int sec2;
if (fsi->FAT2_start_sector != fsi->FAT1_start_sector) {
sec2 = sec - fsi->FAT1_start_sector + fsi->FAT2_start_sector;
BUG_ON(sec2 != (sec + (u64)fsi->num_FAT_sectors));
BUG_ON(sec2 != (sec + fsi->num_FAT_sectors));
MMSG("BD: fat mirroring (%llu in FAT1, %llu in FAT2)\n", sec, sec2);
MMSG("BD: fat mirroring (%d in FAT1, %d in FAT2)\n", sec, sec2);
if (write_sect(sb, sec2, bh, sync))
return -EIO;
}
......@@ -187,7 +187,7 @@ static s32 __fcache_ent_discard(struct super_block *sb, cache_ent_t *bp)
return 0;
}
u8 *fcache_getblk(struct super_block *sb, u64 sec)
u8 *fcache_getblk(struct super_block *sb, u32 sec)
{
cache_ent_t *bp;
FS_INFO_T *fsi = &(SDFAT_SB(sb)->fsi);
......@@ -204,7 +204,7 @@ u8 *fcache_getblk(struct super_block *sb, u64 sec)
return bp->bh->b_data;
}
bp = __fcache_get(sb);
bp = __fcache_get(sb, sec);
if (!__check_hash_valid(bp))
__fcache_remove_hash(bp);
......@@ -214,7 +214,7 @@ u8 *fcache_getblk(struct super_block *sb, u64 sec)
/* Naive FAT read-ahead (increase I/O unit to page_ra_count) */
if ((sec & (page_ra_count - 1)) == 0)
bdev_readahead(sb, sec, (u64)page_ra_count);
bdev_readahead(sb, sec, page_ra_count);
/*
* patch 1.2.4 : buffer_head null pointer exception problem.
......@@ -247,13 +247,13 @@ static inline int __mark_delayed_dirty(struct super_block *sb, cache_ent_t *bp)
s32 fcache_modify(struct super_block *sb, u64 sec)
s32 fcache_modify(struct super_block *sb, u32 sec)
{
cache_ent_t *bp;
bp = __fcache_find(sb, sec);
if (!bp) {
sdfat_fs_error(sb, "Can`t find fcache (sec 0x%016llx)", sec);
sdfat_fs_error(sb, "Can`t find fcache (sec 0x%08x)", sec);
return -EIO;
}
......@@ -390,7 +390,7 @@ s32 fcache_flush(struct super_block *sb, u32 sync)
return ret;
}
static cache_ent_t *__fcache_find(struct super_block *sb, u64 sec)
static cache_ent_t *__fcache_find(struct super_block *sb, u32 sec)
{
s32 off;
cache_ent_t *bp, *hp;
......@@ -413,7 +413,7 @@ static cache_ent_t *__fcache_find(struct super_block *sb, u64 sec)
return NULL;
}
static cache_ent_t *__fcache_get(struct super_block *sb)
static cache_ent_t *__fcache_get(struct super_block *sb, u32 sec)
{
cache_ent_t *bp;
FS_INFO_T *fsi = &(SDFAT_SB(sb)->fsi);
......@@ -473,7 +473,7 @@ static void __fcache_remove_hash(cache_ent_t *bp)
/* Buffer Read/Write Functions */
/*======================================================================*/
/* Read-ahead a cluster */
s32 dcache_readahead(struct super_block *sb, u64 sec)
s32 dcache_readahead(struct super_block *sb, u32 sec)
{
FS_INFO_T *fsi = &(SDFAT_SB(sb)->fsi);
struct buffer_head *bh;
......@@ -487,7 +487,7 @@ s32 dcache_readahead(struct super_block *sb, u64 sec)
return 0;
if (sec < fsi->data_start_sector) {
EMSG("BD: %s: requested sector is invalid(sect:%llu, root:%llu)\n",
EMSG("BD: %s: requested sector is invalid(sect:%u, root:%u)\n",
__func__, sec, fsi->data_start_sector);
return -EIO;
}
......@@ -498,7 +498,7 @@ s32 dcache_readahead(struct super_block *sb, u64 sec)
bh = sb_find_get_block(sb, sec);
if (!bh || !buffer_uptodate(bh))
bdev_readahead(sb, sec, (u64)ra_count);
bdev_readahead(sb, sec, ra_count);
brelse(bh);
......@@ -531,7 +531,7 @@ static s32 __dcache_ent_discard(struct super_block *sb, cache_ent_t *bp)
{
FS_INFO_T *fsi = &(SDFAT_SB(sb)->fsi);
MMSG("%s : bp[%p] (sec:%016llx flag:%08x bh:%p) list(prev:%p next:%p) "
MMSG("%s : bp[%p] (sec:%08x flag:%08x bh:%p) list(prev:%p next:%p) "
"hash(prev:%p next:%p)\n", __func__,
bp, bp->sec, bp->flag, bp->bh, bp->prev, bp->next,
bp->hash.prev, bp->hash.next);
......@@ -549,7 +549,7 @@ static s32 __dcache_ent_discard(struct super_block *sb, cache_ent_t *bp)
return 0;
}
u8 *dcache_getblk(struct super_block *sb, u64 sec)
u8 *dcache_getblk(struct super_block *sb, u32 sec)
{
cache_ent_t *bp;
FS_INFO_T *fsi = &(SDFAT_SB(sb)->fsi);
......@@ -557,7 +557,7 @@ u8 *dcache_getblk(struct super_block *sb, u64 sec)
bp = __dcache_find(sb, sec);
if (bp) {
if (bdev_check_bdi_valid(sb)) {
MMSG("%s: found cache(%p, sect:%llu). But invalid BDI\n"
MMSG("%s: found cache(%p, sect:%u). But invalid BDI\n"
, __func__, bp, sec);
__dcache_ent_flush(sb, bp, 0);
__dcache_ent_discard(sb, bp);
......@@ -570,7 +570,7 @@ u8 *dcache_getblk(struct super_block *sb, u64 sec)
return bp->bh->b_data;
}
bp = __dcache_get(sb);
bp = __dcache_get(sb, sec);
if (!__check_hash_valid(bp))
__dcache_remove_hash(bp);
......@@ -588,7 +588,7 @@ u8 *dcache_getblk(struct super_block *sb, u64 sec)
}
s32 dcache_modify(struct super_block *sb, u64 sec)
s32 dcache_modify(struct super_block *sb, u32 sec)
{
s32 ret = -EIO;
cache_ent_t *bp;
......@@ -597,7 +597,7 @@ s32 dcache_modify(struct super_block *sb, u64 sec)
bp = __dcache_find(sb, sec);
if (unlikely(!bp)) {
sdfat_fs_error(sb, "Can`t find dcache (sec 0x%016llx)", sec);
sdfat_fs_error(sb, "Can`t find dcache (sec 0x%08x)", sec);
return -EIO;
}
#ifdef CONFIG_SDFAT_DELAYED_META_DIRTY
......@@ -609,14 +609,14 @@ s32 dcache_modify(struct super_block *sb, u64 sec)
ret = write_sect(sb, sec, bp->bh, 0);
if (ret) {
DMSG("%s : failed to modify buffer(err:%d, sec:%llu, bp:0x%p)\n",
DMSG("%s : failed to modify buffer(err:%d, sec:%u, bp:0x%p)\n",
__func__, ret, sec, bp);
}
return ret;
}
s32 dcache_lock(struct super_block *sb, u64 sec)
s32 dcache_lock(struct super_block *sb, u32 sec)
{
cache_ent_t *bp;
......@@ -626,11 +626,11 @@ s32 dcache_lock(struct super_block *sb, u64 sec)
return 0;
}
EMSG("%s : failed to lock buffer(sec:%llu, bp:0x%p)\n", __func__, sec, bp);
EMSG("%s : failed to lock buffer(sec:%u, bp:0x%p)\n", __func__, sec, bp);
return -EIO;
}
s32 dcache_unlock(struct super_block *sb, u64 sec)
s32 dcache_unlock(struct super_block *sb, u32 sec)
{
cache_ent_t *bp;
......@@ -640,11 +640,11 @@ s32 dcache_unlock(struct super_block *sb, u64 sec)
return 0;
}
EMSG("%s : failed to unlock buffer (sec:%llu, bp:0x%p)\n", __func__, sec, bp);
EMSG("%s : failed to unlock buffer (sec:%u, bp:0x%p)\n", __func__, sec, bp);
return -EIO;
}
s32 dcache_release(struct super_block *sb, u64 sec)
s32 dcache_release(struct super_block *sb, u32 sec)
{
cache_ent_t *bp;
FS_INFO_T *fsi = &(SDFAT_SB(sb)->fsi);
......@@ -755,7 +755,7 @@ s32 dcache_flush(struct super_block *sb, u32 sync)
return ret;
}
static cache_ent_t *__dcache_find(struct super_block *sb, u64 sec)
static cache_ent_t *__dcache_find(struct super_block *sb, u32 sec)
{
s32 off;
cache_ent_t *bp, *hp;
......@@ -773,7 +773,7 @@ static cache_ent_t *__dcache_find(struct super_block *sb, u64 sec)
return NULL;
}
static cache_ent_t *__dcache_get(struct super_block *sb)
static cache_ent_t *__dcache_get(struct super_block *sb, u32 sec)
{
cache_ent_t *bp;
FS_INFO_T *fsi = &(SDFAT_SB(sb)->fsi);
......
This diff is collapsed.
......@@ -53,11 +53,12 @@ extern "C" {
#define ES_ALL_ENTRIES 0
typedef struct {
u64 sector; // sector number that contains file_entry
u32 offset; // byte offset in the sector
s32 alloc_flag; // flag in stream entry. 01 for cluster chain, 03 for contig. clusters.
u32 num_entries;
void *__buf; // __buf should be the last member
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;
......@@ -71,7 +72,7 @@ s32 fscore_init(void);
s32 fscore_shutdown(void);
/* chain management */
s32 chain_cont_cluster(struct super_block *sb, u32 chain, u32 len);
s32 chain_cont_cluster(struct super_block *sb, u32 chain, s32 len);
/* volume management functions */
s32 fscore_mount(struct super_block *sb);
......@@ -92,7 +93,7 @@ s32 fscore_rename(struct inode *old_parent_inode, FILE_ID_T *fid,
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, u32 clu_offset, u32 *clu, int dest);
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);
......@@ -108,30 +109,30 @@ s32 fscore_rmdir(struct inode *inode, FILE_ID_T *fid);
/* 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, u64 *sector);
DENTRY_T *get_dentry_in_dir(struct super_block *sb, CHAIN_T *p_dir, s32 entry, u32 *sector);