Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'erofs-for-6.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs

Pull erofs updates from Gao Xiang:

- Support FS_IOC_GETFSLABEL ioctl

- Stop meaningless read-more policy on fragment extents

- Remove a duplicate check for ztailpacking inline

* tag 'erofs-for-6.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs:
erofs: drop redundant sanity check for ztailpacking inline
erofs: Add support for FS_IOC_GETFSLABEL
erofs: avoid reading more for fragment maps

+61 -11
+4
fs/erofs/data.c
··· 475 475 const struct file_operations erofs_file_fops = { 476 476 .llseek = erofs_file_llseek, 477 477 .read_iter = erofs_file_read_iter, 478 + .unlocked_ioctl = erofs_ioctl, 479 + #ifdef CONFIG_COMPAT 480 + .compat_ioctl = erofs_compat_ioctl, 481 + #endif 478 482 .mmap_prepare = erofs_file_mmap_prepare, 479 483 .get_unmapped_area = thp_get_unmapped_area, 480 484 .splice_read = filemap_splice_read,
+4
fs/erofs/dir.c
··· 123 123 .llseek = generic_file_llseek, 124 124 .read = generic_read_dir, 125 125 .iterate_shared = erofs_readdir, 126 + .unlocked_ioctl = erofs_ioctl, 127 + #ifdef CONFIG_COMPAT 128 + .compat_ioctl = erofs_compat_ioctl, 129 + #endif 126 130 };
+36 -4
fs/erofs/inode.c
··· 5 5 * Copyright (C) 2021, Alibaba Cloud 6 6 */ 7 7 #include "xattr.h" 8 + #include <linux/compat.h> 8 9 #include <trace/events/erofs.h> 9 10 10 11 static int erofs_fill_symlink(struct inode *inode, void *kaddr, ··· 214 213 switch (inode->i_mode & S_IFMT) { 215 214 case S_IFREG: 216 215 inode->i_op = &erofs_generic_iops; 217 - if (erofs_inode_is_data_compressed(vi->datalayout)) 218 - inode->i_fop = &generic_ro_fops; 219 - else 220 - inode->i_fop = &erofs_file_fops; 216 + inode->i_fop = &erofs_file_fops; 221 217 break; 222 218 case S_IFDIR: 223 219 inode->i_op = &erofs_dir_iops; ··· 338 340 generic_fillattr(idmap, request_mask, inode, stat); 339 341 return 0; 340 342 } 343 + 344 + static int erofs_ioctl_get_volume_label(struct inode *inode, void __user *arg) 345 + { 346 + struct erofs_sb_info *sbi = EROFS_I_SB(inode); 347 + int ret; 348 + 349 + if (!sbi->volume_name) 350 + ret = clear_user(arg, 1); 351 + else 352 + ret = copy_to_user(arg, sbi->volume_name, 353 + strlen(sbi->volume_name)); 354 + return ret ? -EFAULT : 0; 355 + } 356 + 357 + long erofs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) 358 + { 359 + struct inode *inode = file_inode(filp); 360 + void __user *argp = (void __user *)arg; 361 + 362 + switch (cmd) { 363 + case FS_IOC_GETFSLABEL: 364 + return erofs_ioctl_get_volume_label(inode, argp); 365 + default: 366 + return -ENOTTY; 367 + } 368 + } 369 + 370 + #ifdef CONFIG_COMPAT 371 + long erofs_compat_ioctl(struct file *filp, unsigned int cmd, 372 + unsigned long arg) 373 + { 374 + return erofs_ioctl(filp, cmd, (unsigned long)compat_ptr(arg)); 375 + } 376 + #endif 341 377 342 378 const struct inode_operations erofs_generic_iops = { 343 379 .getattr = erofs_getattr,
+5
fs/erofs/internal.h
··· 153 153 /* used for statfs, f_files - f_favail */ 154 154 u64 inos; 155 155 156 + char *volume_name; 156 157 u32 feature_compat; 157 158 u32 feature_incompat; 158 159 ··· 536 535 static inline struct bio *erofs_fscache_bio_alloc(struct erofs_map_dev *mdev) { return NULL; } 537 536 static inline void erofs_fscache_submit_bio(struct bio *bio) {} 538 537 #endif 538 + 539 + long erofs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); 540 + long erofs_compat_ioctl(struct file *filp, unsigned int cmd, 541 + unsigned long arg); 539 542 540 543 #define EFSCORRUPTED EUCLEAN /* Filesystem is corrupted */ 541 544
+8
fs/erofs/super.c
··· 343 343 sbi->fixed_nsec = le32_to_cpu(dsb->fixed_nsec); 344 344 super_set_uuid(sb, (void *)dsb->uuid, sizeof(dsb->uuid)); 345 345 346 + if (dsb->volume_name[0]) { 347 + sbi->volume_name = kstrndup(dsb->volume_name, 348 + sizeof(dsb->volume_name), GFP_KERNEL); 349 + if (!sbi->volume_name) 350 + return -ENOMEM; 351 + } 352 + 346 353 /* parse on-disk compression configurations */ 347 354 ret = z_erofs_parse_cfgs(sb, dsb); 348 355 if (ret < 0) ··· 829 822 kfree(sbi->domain_id); 830 823 if (sbi->dif0.file) 831 824 fput(sbi->dif0.file); 825 + kfree(sbi->volume_name); 832 826 kfree(sbi); 833 827 } 834 828
+2 -5
fs/erofs/zdata.c
··· 823 823 } 824 824 rcu_read_unlock(); 825 825 } 826 - } else if ((map->m_pa & ~PAGE_MASK) + map->m_plen > PAGE_SIZE) { 827 - DBG_BUGON(1); 828 - return -EFSCORRUPTED; 829 826 } 830 827 831 828 if (pcl) { ··· 1832 1835 map->m_la = end; 1833 1836 err = z_erofs_map_blocks_iter(inode, map, 1834 1837 EROFS_GET_BLOCKS_READMORE); 1835 - if (err) 1838 + if (err || !(map->m_flags & EROFS_MAP_ENCODED)) 1836 1839 return; 1837 1840 1838 1841 /* expand ra for the trailing edge if readahead */ ··· 1844 1847 end = round_up(end, PAGE_SIZE); 1845 1848 } else { 1846 1849 end = round_up(map->m_la, PAGE_SIZE); 1847 - if (!map->m_llen) 1850 + if (!(map->m_flags & EROFS_MAP_ENCODED) || !map->m_llen) 1848 1851 return; 1849 1852 } 1850 1853
+2 -2
fs/erofs/zmap.c
··· 462 462 map->m_pa = vi->z_fragmentoff; 463 463 map->m_plen = vi->z_idata_size; 464 464 if (erofs_blkoff(sb, map->m_pa) + map->m_plen > sb->s_blocksize) { 465 - erofs_err(sb, "invalid tail-packing pclustersize %llu", 466 - map->m_plen); 465 + erofs_err(sb, "ztailpacking inline data across blocks @ nid %llu", 466 + vi->nid); 467 467 err = -EFSCORRUPTED; 468 468 goto unmap_out; 469 469 }