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-5.17-rc3-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs

Pull erofs fixes from Gao Xiang:
"Two fixes related to fsdax cleanup in this cycle and ztailpacking to
fix small compressed data inlining. There is also a trivial cleanup to
rearrange code for better reading.

Summary:

- fix fsdax partition offset misbehavior

- clean up z_erofs_decompressqueue_work() declaration

- fix up EOF lcluster inlining, especially for small compressed data"

* tag 'erofs-for-5.17-rc3-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs:
erofs: fix small compressed files inlining
erofs: avoid unnecessary z_erofs_decompressqueue_work() declaration
erofs: fix fsdax partition offset handling

+67 -61
+4 -4
fs/erofs/data.c
··· 252 252 return ret; 253 253 254 254 iomap->offset = map.m_la; 255 - if (flags & IOMAP_DAX) { 255 + if (flags & IOMAP_DAX) 256 256 iomap->dax_dev = mdev.m_daxdev; 257 - iomap->offset += mdev.m_dax_part_off; 258 - } else { 257 + else 259 258 iomap->bdev = mdev.m_bdev; 260 - } 261 259 iomap->length = map.m_llen; 262 260 iomap->flags = 0; 263 261 iomap->private = NULL; ··· 282 284 } else { 283 285 iomap->type = IOMAP_MAPPED; 284 286 iomap->addr = mdev.m_pa; 287 + if (flags & IOMAP_DAX) 288 + iomap->addr += mdev.m_dax_part_off; 285 289 } 286 290 return 0; 287 291 }
+56 -57
fs/erofs/zdata.c
··· 810 810 return false; 811 811 } 812 812 813 - static void z_erofs_decompressqueue_work(struct work_struct *work); 814 - static void z_erofs_decompress_kickoff(struct z_erofs_decompressqueue *io, 815 - bool sync, int bios) 816 - { 817 - struct erofs_sb_info *const sbi = EROFS_SB(io->sb); 818 - 819 - /* wake up the caller thread for sync decompression */ 820 - if (sync) { 821 - unsigned long flags; 822 - 823 - spin_lock_irqsave(&io->u.wait.lock, flags); 824 - if (!atomic_add_return(bios, &io->pending_bios)) 825 - wake_up_locked(&io->u.wait); 826 - spin_unlock_irqrestore(&io->u.wait.lock, flags); 827 - return; 828 - } 829 - 830 - if (atomic_add_return(bios, &io->pending_bios)) 831 - return; 832 - /* Use workqueue and sync decompression for atomic contexts only */ 833 - if (in_atomic() || irqs_disabled()) { 834 - queue_work(z_erofs_workqueue, &io->u.work); 835 - /* enable sync decompression for readahead */ 836 - if (sbi->opt.sync_decompress == EROFS_SYNC_DECOMPRESS_AUTO) 837 - sbi->opt.sync_decompress = EROFS_SYNC_DECOMPRESS_FORCE_ON; 838 - return; 839 - } 840 - z_erofs_decompressqueue_work(&io->u.work); 841 - } 842 - 843 813 static bool z_erofs_page_is_invalidated(struct page *page) 844 814 { 845 815 return !page->mapping && !z_erofs_is_shortlived_page(page); 846 - } 847 - 848 - static void z_erofs_decompressqueue_endio(struct bio *bio) 849 - { 850 - tagptr1_t t = tagptr_init(tagptr1_t, bio->bi_private); 851 - struct z_erofs_decompressqueue *q = tagptr_unfold_ptr(t); 852 - blk_status_t err = bio->bi_status; 853 - struct bio_vec *bvec; 854 - struct bvec_iter_all iter_all; 855 - 856 - bio_for_each_segment_all(bvec, bio, iter_all) { 857 - struct page *page = bvec->bv_page; 858 - 859 - DBG_BUGON(PageUptodate(page)); 860 - DBG_BUGON(z_erofs_page_is_invalidated(page)); 861 - 862 - if (err) 863 - SetPageError(page); 864 - 865 - if (erofs_page_is_managed(EROFS_SB(q->sb), page)) { 866 - if (!err) 867 - SetPageUptodate(page); 868 - unlock_page(page); 869 - } 870 - } 871 - z_erofs_decompress_kickoff(q, tagptr_unfold_tags(t), -1); 872 - bio_put(bio); 873 816 } 874 817 875 818 static int z_erofs_decompress_pcluster(struct super_block *sb, ··· 1066 1123 kvfree(bgq); 1067 1124 } 1068 1125 1126 + static void z_erofs_decompress_kickoff(struct z_erofs_decompressqueue *io, 1127 + bool sync, int bios) 1128 + { 1129 + struct erofs_sb_info *const sbi = EROFS_SB(io->sb); 1130 + 1131 + /* wake up the caller thread for sync decompression */ 1132 + if (sync) { 1133 + unsigned long flags; 1134 + 1135 + spin_lock_irqsave(&io->u.wait.lock, flags); 1136 + if (!atomic_add_return(bios, &io->pending_bios)) 1137 + wake_up_locked(&io->u.wait); 1138 + spin_unlock_irqrestore(&io->u.wait.lock, flags); 1139 + return; 1140 + } 1141 + 1142 + if (atomic_add_return(bios, &io->pending_bios)) 1143 + return; 1144 + /* Use workqueue and sync decompression for atomic contexts only */ 1145 + if (in_atomic() || irqs_disabled()) { 1146 + queue_work(z_erofs_workqueue, &io->u.work); 1147 + /* enable sync decompression for readahead */ 1148 + if (sbi->opt.sync_decompress == EROFS_SYNC_DECOMPRESS_AUTO) 1149 + sbi->opt.sync_decompress = EROFS_SYNC_DECOMPRESS_FORCE_ON; 1150 + return; 1151 + } 1152 + z_erofs_decompressqueue_work(&io->u.work); 1153 + } 1154 + 1069 1155 static struct page *pickup_page_for_submission(struct z_erofs_pcluster *pcl, 1070 1156 unsigned int nr, 1071 1157 struct page **pagepool, ··· 1270 1298 WRITE_ONCE(*bypass_qtail, &pcl->next); 1271 1299 1272 1300 qtail[JQ_BYPASS] = &pcl->next; 1301 + } 1302 + 1303 + static void z_erofs_decompressqueue_endio(struct bio *bio) 1304 + { 1305 + tagptr1_t t = tagptr_init(tagptr1_t, bio->bi_private); 1306 + struct z_erofs_decompressqueue *q = tagptr_unfold_ptr(t); 1307 + blk_status_t err = bio->bi_status; 1308 + struct bio_vec *bvec; 1309 + struct bvec_iter_all iter_all; 1310 + 1311 + bio_for_each_segment_all(bvec, bio, iter_all) { 1312 + struct page *page = bvec->bv_page; 1313 + 1314 + DBG_BUGON(PageUptodate(page)); 1315 + DBG_BUGON(z_erofs_page_is_invalidated(page)); 1316 + 1317 + if (err) 1318 + SetPageError(page); 1319 + 1320 + if (erofs_page_is_managed(EROFS_SB(q->sb), page)) { 1321 + if (!err) 1322 + SetPageUptodate(page); 1323 + unlock_page(page); 1324 + } 1325 + } 1326 + z_erofs_decompress_kickoff(q, tagptr_unfold_tags(t), -1); 1327 + bio_put(bio); 1273 1328 } 1274 1329 1275 1330 static void z_erofs_submit_queue(struct super_block *sb,
+7
fs/erofs/zmap.c
··· 630 630 if (endoff >= m.clusterofs) { 631 631 m.headtype = m.type; 632 632 map->m_la = (m.lcn << lclusterbits) | m.clusterofs; 633 + /* 634 + * For ztailpacking files, in order to inline data more 635 + * effectively, special EOF lclusters are now supported 636 + * which can have three parts at most. 637 + */ 638 + if (ztailpacking && end > inode->i_size) 639 + end = inode->i_size; 633 640 break; 634 641 } 635 642 /* m.lcn should be >= 1 if endoff < m.clusterofs */