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.11-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs

Pull more erofs updates from Gao Xiang:

- Support STATX_DIOALIGN and FS_IOC_GETFSSYSFSPATH

- Fix a race of LZ4 decompression due to recent refactoring

- Another multi-page folio adaption in erofs_bread()

* tag 'erofs-for-6.11-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs:
erofs: convert comma to semicolon
erofs: support multi-page folios for erofs_bread()
erofs: add support for FS_IOC_GETFSSYSFSPATH
erofs: fix race in z_erofs_get_gbuf()
erofs: support STATX_DIOALIGN

+49 -21
+12 -18
fs/erofs/data.c
··· 21 21 if (!buf->page) 22 22 return; 23 23 erofs_unmap_metabuf(buf); 24 - put_page(buf->page); 24 + folio_put(page_folio(buf->page)); 25 25 buf->page = NULL; 26 26 } 27 27 28 - /* 29 - * Derive the block size from inode->i_blkbits to make compatible with 30 - * anonymous inode in fscache mode. 31 - */ 32 28 void *erofs_bread(struct erofs_buf *buf, erofs_off_t offset, 33 29 enum erofs_kmap_type type) 34 30 { 35 31 pgoff_t index = offset >> PAGE_SHIFT; 36 - struct page *page = buf->page; 37 - struct folio *folio; 38 - unsigned int nofs_flag; 32 + struct folio *folio = NULL; 39 33 40 - if (!page || page->index != index) { 34 + if (buf->page) { 35 + folio = page_folio(buf->page); 36 + if (folio_file_page(folio, index) != buf->page) 37 + erofs_unmap_metabuf(buf); 38 + } 39 + if (!folio || !folio_contains(folio, index)) { 41 40 erofs_put_metabuf(buf); 42 - 43 - nofs_flag = memalloc_nofs_save(); 44 - folio = read_cache_folio(buf->mapping, index, NULL, NULL); 45 - memalloc_nofs_restore(nofs_flag); 41 + folio = read_mapping_folio(buf->mapping, index, NULL); 46 42 if (IS_ERR(folio)) 47 43 return folio; 48 - 49 - /* should already be PageUptodate, no need to lock page */ 50 - page = folio_file_page(folio, index); 51 - buf->page = page; 52 44 } 45 + buf->page = folio_file_page(folio, index); 46 + 53 47 if (buf->kmap_type == EROFS_NO_KMAP) { 54 48 if (type == EROFS_KMAP) 55 - buf->base = kmap_local_page(page); 49 + buf->base = kmap_local_page(buf->page); 56 50 buf->kmap_type = type; 57 51 } else if (buf->kmap_type != type) { 58 52 DBG_BUGON(1);
+1 -1
fs/erofs/decompressor_lzma.c
··· 188 188 !rq->partial_decoding); 189 189 buf.in_size = min(rq->inputsize, PAGE_SIZE - rq->pageofs_in); 190 190 rq->inputsize -= buf.in_size; 191 - buf.in = dctx.kin + rq->pageofs_in, 191 + buf.in = dctx.kin + rq->pageofs_in; 192 192 dctx.bounce = strm->bounce; 193 193 do { 194 194 dctx.avail_out = buf.out_size - buf.out_pos;
+17 -2
fs/erofs/inode.c
··· 334 334 unsigned int query_flags) 335 335 { 336 336 struct inode *const inode = d_inode(path->dentry); 337 + bool compressed = 338 + erofs_inode_is_data_compressed(EROFS_I(inode)->datalayout); 337 339 338 - if (erofs_inode_is_data_compressed(EROFS_I(inode)->datalayout)) 340 + if (compressed) 339 341 stat->attributes |= STATX_ATTR_COMPRESSED; 340 - 341 342 stat->attributes |= STATX_ATTR_IMMUTABLE; 342 343 stat->attributes_mask |= (STATX_ATTR_COMPRESSED | 343 344 STATX_ATTR_IMMUTABLE); 344 345 346 + /* 347 + * Return the DIO alignment restrictions if requested. 348 + * 349 + * In EROFS, STATX_DIOALIGN is not supported in ondemand mode and 350 + * compressed files, so in these cases we report no DIO support. 351 + */ 352 + if ((request_mask & STATX_DIOALIGN) && S_ISREG(inode->i_mode)) { 353 + stat->result_mask |= STATX_DIOALIGN; 354 + if (!erofs_is_fscache_mode(inode->i_sb) && !compressed) { 355 + stat->dio_mem_align = 356 + bdev_logical_block_size(inode->i_sb->s_bdev); 357 + stat->dio_offset_align = stat->dio_mem_align; 358 + } 359 + } 345 360 generic_fillattr(idmap, request_mask, inode, stat); 346 361 return 0; 347 362 }
+16
fs/erofs/super.c
··· 576 576 .get_parent = erofs_get_parent, 577 577 }; 578 578 579 + static void erofs_set_sysfs_name(struct super_block *sb) 580 + { 581 + struct erofs_sb_info *sbi = EROFS_SB(sb); 582 + 583 + if (erofs_is_fscache_mode(sb)) { 584 + if (sbi->domain_id) 585 + super_set_sysfs_name_generic(sb, "%s,%s",sbi->domain_id, 586 + sbi->fsid); 587 + else 588 + super_set_sysfs_name_generic(sb, "%s", sbi->fsid); 589 + return; 590 + } 591 + super_set_sysfs_name_id(sb); 592 + } 593 + 579 594 static int erofs_fc_fill_super(struct super_block *sb, struct fs_context *fc) 580 595 { 581 596 struct inode *inode; ··· 658 643 sb->s_flags |= SB_POSIXACL; 659 644 else 660 645 sb->s_flags &= ~SB_POSIXACL; 646 + erofs_set_sysfs_name(sb); 661 647 662 648 #ifdef CONFIG_EROFS_FS_ZIP 663 649 xa_init(&sbi->managed_pslots);
+3
fs/erofs/zutil.c
··· 38 38 { 39 39 struct z_erofs_gbuf *gbuf; 40 40 41 + migrate_disable(); 41 42 gbuf = &z_erofs_gbufpool[z_erofs_gbuf_id()]; 42 43 spin_lock(&gbuf->lock); 43 44 /* check if the buffer is too small */ 44 45 if (requiredpages > gbuf->nrpages) { 45 46 spin_unlock(&gbuf->lock); 47 + migrate_enable(); 46 48 /* (for sparse checker) pretend gbuf->lock is still taken */ 47 49 __acquire(gbuf->lock); 48 50 return NULL; ··· 59 57 gbuf = &z_erofs_gbufpool[z_erofs_gbuf_id()]; 60 58 DBG_BUGON(gbuf->ptr != ptr); 61 59 spin_unlock(&gbuf->lock); 60 + migrate_enable(); 62 61 } 63 62 64 63 int z_erofs_gbuf_growsize(unsigned int nrpages)