Lines Matching +full:multi +full:- +full:cluster
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Copyright (C) 2012-2013 Samsung Electronics Co., Ltd.
51 (ES_IDX_FIRST_FILENAME + EXFAT_FILENAME_ENTRY_NUM(name_len) - 1)
77 #define MAX_CHARSET_SIZE 6 /* max size of multi-byte character */
81 #define EXFAT_HINT_NONE -1
85 * helpers for cluster size to byte conversion.
87 #define EXFAT_CLU_TO_B(b, sbi) ((b) << (sbi)->cluster_size_bits)
88 #define EXFAT_B_TO_CLU(b, sbi) ((b) >> (sbi)->cluster_size_bits)
90 (((b - 1) >> (sbi)->cluster_size_bits) + 1)
91 #define EXFAT_CLU_OFFSET(off, sbi) ((off) & ((sbi)->cluster_size - 1))
96 #define EXFAT_BLK_TO_B(b, sb) ((b) << (sb)->s_blocksize_bits)
97 #define EXFAT_B_TO_BLK(b, sb) ((b) >> (sb)->s_blocksize_bits)
99 (((b - 1) >> (sb)->s_blocksize_bits) + 1)
100 #define EXFAT_BLK_OFFSET(off, sb) ((off) & ((sb)->s_blocksize - 1))
109 * helpers for cluster size to dentry size conversion.
112 ((clu) << ((sbi)->cluster_size_bits - DENTRY_SIZE_BITS))
114 ((dentry) >> ((sbi)->cluster_size_bits - DENTRY_SIZE_BITS))
121 #define FAT_ENT_OFFSET_SECTOR(sb, loc) (EXFAT_SB(sb)->FAT1_start_sector + \
122 (((u64)loc << FAT_ENT_SIZE_BITS) >> sb->s_blocksize_bits))
124 ((loc << FAT_ENT_SIZE_BITS) & (sb->s_blocksize - 1))
129 #define CLUSTER_TO_BITMAP_ENT(clu) ((clu) - EXFAT_RESERVED_CLUSTERS)
131 #define BITS_PER_SECTOR(sb) ((sb)->s_blocksize * BITS_PER_BYTE)
132 #define BITS_PER_SECTOR_MASK(sb) (BITS_PER_SECTOR(sb) - 1)
134 ((ent / BITS_PER_BYTE) >> (sb)->s_blocksize_bits)
137 ((ent / BITS_PER_BYTE) & ((sb)->s_blocksize - 1))
139 #define IGNORED_BITS_REMAINED(clu, clu_base) ((1 << ((clu) - (clu_base))) - 1)
178 /* the cluster that first empty slot exists in */
186 unsigned int off; /* cluster offset */
201 #define IS_DYNAMIC_ES(es) ((es)->__bh != (es)->bh)
219 * exfat mount in-memory data
230 /* on error: continue, panic, remount-ro */
232 unsigned utf8:1, /* Use of UTF-8 character set */
240 * EXFAT file system superblock in-memory data
245 unsigned int cluster_size; /* cluster size in bytes */
247 unsigned int sect_per_clus; /* cluster size in sectors */
253 unsigned int root_dir; /* root dir cluster */
254 unsigned int dentries_per_clu; /* num of dentries per cluster */
259 unsigned int map_clu; /* allocation bitmap start cluster */
265 unsigned int clu_srch_ptr; /* cluster search pointer */
281 * EXFAT file system inode in-memory data
296 /* hint for cluster last accessed */
310 * NOTE: i_size_ondisk is 64bits, so must hold ->inode_lock to access.
314 /* block-aligned i_size (used in cont_write_begin) */
316 /* on-disk position of directory entry or 0 */
329 return sb->s_fs_info; in EXFAT_SB()
338 * If ->i_mode can't hold 0222 (i.e. ATTR_RO), we use ->i_attrs to
339 * save ATTR_RO instead of ->i_mode.
341 * If it's directory and !sbi->options.rodir, ATTR_RO isn't read-only
346 struct exfat_sb_info *sbi = EXFAT_SB(inode->i_sb); in exfat_mode_can_hold_ro()
348 if (S_ISDIR(inode->i_mode)) in exfat_mode_can_hold_ro()
351 if ((~sbi->options.fs_fmask) & 0222) in exfat_mode_can_hold_ro()
364 return (mode & ~sbi->options.fs_dmask) | S_IFDIR; in exfat_make_mode()
366 return (mode & ~sbi->options.fs_fmask) | S_IFREG; in exfat_make_mode()
372 unsigned short attr = EXFAT_I(inode)->attr; in exfat_make_attr()
374 if (S_ISDIR(inode->i_mode)) in exfat_make_attr()
376 if (exfat_mode_can_hold_ro(inode) && !(inode->i_mode & 0222)) in exfat_make_attr()
384 EXFAT_I(inode)->attr = attr & (ATTR_RWMASK | ATTR_READONLY); in exfat_save_attr()
386 EXFAT_I(inode)->attr = attr & ATTR_RWMASK; in exfat_save_attr()
392 return ((sec - sbi->data_start_sector + 1) & in exfat_is_last_sector_in_cluster()
393 ((1 << sbi->sect_per_clus_bits) - 1)) == 0; in exfat_is_last_sector_in_cluster()
399 return ((sector_t)(clus - EXFAT_RESERVED_CLUSTERS) << sbi->sect_per_clus_bits) + in exfat_cluster_to_sector()
400 sbi->data_start_sector; in exfat_cluster_to_sector()
406 return ((sec - sbi->data_start_sector) >> sbi->sect_per_clus_bits) + in exfat_sector_to_cluster()
413 return clus >= EXFAT_FIRST_CLUSTER && clus < sbi->num_clusters; in is_valid_cluster()
471 int exfat_get_cluster(struct inode *inode, unsigned int cluster,
536 __exfat_fs_error(sb, __ratelimit(&EXFAT_SB(sb)->ratelimit), \
541 pr_err("exFAT-fs (%s): " fmt "\n", (sb)->s_id, ##__VA_ARGS__)
543 pr_warn("exFAT-fs (%s): " fmt "\n", (sb)->s_id, ##__VA_ARGS__)
545 pr_info("exFAT-fs (%s): " fmt "\n", (sb)->s_id, ##__VA_ARGS__)
547 pr_debug("exFAT-fs (%s): " fmt "\n", (sb)->s_id, ##__VA_ARGS__)