Lines Matching +full:cluster +full:- +full:index
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Copyright (C) 2012-2013 Samsung Electronics Co., Ltd.
52 (ES_IDX_FIRST_FILENAME + EXFAT_FILENAME_ENTRY_NUM(name_len) - 1)
78 #define MAX_CHARSET_SIZE 6 /* max size of multi-byte character */
82 #define EXFAT_HINT_NONE -1
86 * helpers for cluster size to byte conversion.
88 #define EXFAT_CLU_TO_B(b, sbi) ((b) << (sbi)->cluster_size_bits)
89 #define EXFAT_B_TO_CLU(b, sbi) ((b) >> (sbi)->cluster_size_bits)
91 (((b - 1) >> (sbi)->cluster_size_bits) + 1)
92 #define EXFAT_CLU_OFFSET(off, sbi) ((off) & ((sbi)->cluster_size - 1))
97 #define EXFAT_BLK_TO_B(b, sb) ((b) << (sb)->s_blocksize_bits)
98 #define EXFAT_B_TO_BLK(b, sb) ((b) >> (sb)->s_blocksize_bits)
100 (((b - 1) >> (sb)->s_blocksize_bits) + 1)
101 #define EXFAT_BLK_OFFSET(off, sb) ((off) & ((sb)->s_blocksize - 1))
110 * helpers for cluster size to dentry size conversion.
113 ((clu) << ((sbi)->cluster_size_bits - DENTRY_SIZE_BITS))
115 ((dentry) >> ((sbi)->cluster_size_bits - DENTRY_SIZE_BITS))
122 #define FAT_ENT_OFFSET_SECTOR(sb, loc) (EXFAT_SB(sb)->FAT1_start_sector + \
123 (((u64)loc << FAT_ENT_SIZE_BITS) >> sb->s_blocksize_bits))
125 ((loc << FAT_ENT_SIZE_BITS) & (sb->s_blocksize - 1))
130 #define CLUSTER_TO_BITMAP_ENT(clu) ((clu) - EXFAT_RESERVED_CLUSTERS)
132 #define BITS_PER_SECTOR(sb) ((sb)->s_blocksize * BITS_PER_BYTE)
133 #define BITS_PER_SECTOR_MASK(sb) (BITS_PER_SECTOR(sb) - 1)
135 ((ent / BITS_PER_BYTE) >> (sb)->s_blocksize_bits)
138 ((ent / BITS_PER_BYTE) & ((sb)->s_blocksize - 1))
139 #define IGNORED_BITS_REMAINED(clu, clu_base) ((1UL << ((clu) - (clu_base))) - 1)
177 /* entry index of a directory */
181 /* the cluster that first empty slot exists in */
189 unsigned int off; /* cluster offset */
190 int eidx; /* entry index */
204 #define IS_DYNAMIC_ES(es) ((es)->__bh != (es)->bh)
223 * exfat mount in-memory data
234 /* on error: continue, panic, remount-ro */
236 unsigned utf8:1, /* Use of UTF-8 character set */
241 /* Support creating zero-size directory, default: false */
246 * EXFAT file system superblock in-memory data
251 unsigned int cluster_size; /* cluster size in bytes */
253 unsigned int sect_per_clus; /* cluster size in sectors */
259 unsigned int root_dir; /* root dir cluster */
260 unsigned int dentries_per_clu; /* num of dentries per cluster */
265 unsigned int map_clu; /* allocation bitmap start cluster */
271 unsigned int clu_srch_ptr; /* cluster search pointer */
290 * EXFAT file system inode in-memory data
305 /* hint for cluster last accessed */
307 /* hint for entry index we try to lookup next time */
318 /* on-disk position of directory entry or 0 */
332 return sb->s_fs_info; in EXFAT_SB()
342 return test_bit(EXFAT_FLAGS_SHUTDOWN, &EXFAT_SB(sb)->s_exfat_flags); in exfat_forced_shutdown()
346 * If ->i_mode can't hold 0222 (i.e. ATTR_RO), we use ->i_attrs to
347 * save ATTR_RO instead of ->i_mode.
349 * If it's directory and !sbi->options.rodir, ATTR_RO isn't read-only
354 struct exfat_sb_info *sbi = EXFAT_SB(inode->i_sb); in exfat_mode_can_hold_ro()
356 if (S_ISDIR(inode->i_mode)) in exfat_mode_can_hold_ro()
359 if ((~sbi->options.fs_fmask) & 0222) in exfat_mode_can_hold_ro()
372 return (mode & ~sbi->options.fs_dmask) | S_IFDIR; in exfat_make_mode()
374 return (mode & ~sbi->options.fs_fmask) | S_IFREG; in exfat_make_mode()
380 unsigned short attr = EXFAT_I(inode)->attr; in exfat_make_attr()
382 if (S_ISDIR(inode->i_mode)) in exfat_make_attr()
384 if (exfat_mode_can_hold_ro(inode) && !(inode->i_mode & 0222)) in exfat_make_attr()
392 EXFAT_I(inode)->attr = attr & (EXFAT_ATTR_RWMASK | EXFAT_ATTR_READONLY); in exfat_save_attr()
394 EXFAT_I(inode)->attr = attr & EXFAT_ATTR_RWMASK; in exfat_save_attr()
400 return ((sec - sbi->data_start_sector + 1) & in exfat_is_last_sector_in_cluster()
401 ((1 << sbi->sect_per_clus_bits) - 1)) == 0; in exfat_is_last_sector_in_cluster()
407 return ((sector_t)(clus - EXFAT_RESERVED_CLUSTERS) << sbi->sect_per_clus_bits) + in exfat_cluster_to_sector()
408 sbi->data_start_sector; in exfat_cluster_to_sector()
414 return ((sec - sbi->data_start_sector) >> sbi->sect_per_clus_bits) + in exfat_sector_to_cluster()
421 return clus >= EXFAT_FIRST_CLUSTER && clus < sbi->num_clusters; in is_valid_cluster()
426 return ((loff_t)inode->i_blocks) << 9; in exfat_ondisk_size()
483 int exfat_get_cluster(struct inode *inode, unsigned int cluster,
549 __exfat_fs_error(sb, __ratelimit(&EXFAT_SB(sb)->ratelimit), \
554 pr_err("exFAT-fs (%s): " fmt "\n", (sb)->s_id, ##__VA_ARGS__)
556 pr_warn("exFAT-fs (%s): " fmt "\n", (sb)->s_id, ##__VA_ARGS__)
558 pr_info("exFAT-fs (%s): " fmt "\n", (sb)->s_id, ##__VA_ARGS__)
560 pr_debug("exFAT-fs (%s): " fmt "\n", (sb)->s_id, ##__VA_ARGS__)