Hi Matthew, I had to apply this in this patch, since fio can be reassigned after checking fio->in_list check.
--- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -946,7 +946,6 @@ static bool is_end_zone_blkaddr(struct f2fs_sb_info *sbi, block_t blkaddr) void f2fs_submit_page_write(struct f2fs_io_info *fio) { - struct inode *inode = fio_inode(fio); struct f2fs_sb_info *sbi = fio->sbi; enum page_type btype = PAGE_TYPE_OF_BIO(fio->type); struct f2fs_bio_info *io = sbi->write_io[btype] + fio->temp; @@ -996,13 +995,13 @@ void f2fs_submit_page_write(struct f2fs_io_info *fio) if (io->bio && (!io_is_mergeable(sbi, io->bio, io, fio, io->last_block_in_bio, fio->new_blkaddr) || - !f2fs_crypt_mergeable_bio(io->bio, inode, + !f2fs_crypt_mergeable_bio(io->bio, fio_inode(fio), page_folio(bio_page)->index, fio))) __submit_merged_bio(io); alloc_new: if (io->bio == NULL) { io->bio = __bio_alloc(fio, BIO_MAX_VECS); - f2fs_set_bio_crypt_ctx(io->bio, inode, + f2fs_set_bio_crypt_ctx(io->bio, fio_inode(fio), page_folio(bio_page)->index, fio, GFP_NOIO); io->fio = *fio; } On 03/31, Matthew Wilcox (Oracle) wrote: > This helper returns the inode associated with the f2fs_io_info. That's a > relatively common thing to want, mildly awkward to get and provides one > place to change if we decide to record it directly, or change fio->page > to fio->folio. > > Signed-off-by: Matthew Wilcox (Oracle) <wi...@infradead.org> > --- > fs/f2fs/data.c | 9 +++++---- > fs/f2fs/f2fs.h | 5 +++++ > fs/f2fs/segment.c | 6 +++--- > 3 files changed, 13 insertions(+), 7 deletions(-) > > diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c > index 54f89f0ee69b..597d1e82cb55 100644 > --- a/fs/f2fs/data.c > +++ b/fs/f2fs/data.c > @@ -946,6 +946,7 @@ static bool is_end_zone_blkaddr(struct f2fs_sb_info *sbi, > block_t blkaddr) > > void f2fs_submit_page_write(struct f2fs_io_info *fio) > { > + struct inode *inode = fio_inode(fio); > struct f2fs_sb_info *sbi = fio->sbi; > enum page_type btype = PAGE_TYPE_OF_BIO(fio->type); > struct f2fs_bio_info *io = sbi->write_io[btype] + fio->temp; > @@ -995,13 +996,13 @@ void f2fs_submit_page_write(struct f2fs_io_info *fio) > if (io->bio && > (!io_is_mergeable(sbi, io->bio, io, fio, io->last_block_in_bio, > fio->new_blkaddr) || > - !f2fs_crypt_mergeable_bio(io->bio, fio->page->mapping->host, > + !f2fs_crypt_mergeable_bio(io->bio, inode, > page_folio(bio_page)->index, fio))) > __submit_merged_bio(io); > alloc_new: > if (io->bio == NULL) { > io->bio = __bio_alloc(fio, BIO_MAX_VECS); > - f2fs_set_bio_crypt_ctx(io->bio, fio->page->mapping->host, > + f2fs_set_bio_crypt_ctx(io->bio, inode, > page_folio(bio_page)->index, fio, GFP_NOIO); > io->fio = *fio; > } > @@ -2501,7 +2502,7 @@ static void f2fs_readahead(struct readahead_control > *rac) > > int f2fs_encrypt_one_page(struct f2fs_io_info *fio) > { > - struct inode *inode = fio->page->mapping->host; > + struct inode *inode = fio_inode(fio); > struct page *mpage, *page; > gfp_t gfp_flags = GFP_NOFS; > > @@ -2631,7 +2632,7 @@ bool f2fs_should_update_outplace(struct inode *inode, > struct f2fs_io_info *fio) > > static inline bool need_inplace_update(struct f2fs_io_info *fio) > { > - struct inode *inode = fio->page->mapping->host; > + struct inode *inode = fio_inode(fio); > > if (f2fs_should_update_outplace(inode, fio)) > return false; > diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h > index f1576dc6ec67..c37092e82354 100644 > --- a/fs/f2fs/f2fs.h > +++ b/fs/f2fs/f2fs.h > @@ -3858,6 +3858,11 @@ unsigned int f2fs_usable_blks_in_seg(struct > f2fs_sb_info *sbi, > unsigned long long f2fs_get_section_mtime(struct f2fs_sb_info *sbi, > unsigned int segno); > > +static inline struct inode *fio_inode(struct f2fs_io_info *fio) > +{ > + return page_folio(fio->page)->mapping->host; > +} > + > #define DEF_FRAGMENT_SIZE 4 > #define MIN_FRAGMENT_SIZE 1 > #define MAX_FRAGMENT_SIZE 512 > diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c > index 396ef71f41e3..d2f2f68da098 100644 > --- a/fs/f2fs/segment.c > +++ b/fs/f2fs/segment.c > @@ -3584,7 +3584,7 @@ static int __get_segment_type_2(struct f2fs_io_info > *fio) > static int __get_segment_type_4(struct f2fs_io_info *fio) > { > if (fio->type == DATA) { > - struct inode *inode = fio->page->mapping->host; > + struct inode *inode = fio_inode(fio); > > if (S_ISDIR(inode->i_mode)) > return CURSEG_HOT_DATA; > @@ -3618,7 +3618,7 @@ static int __get_age_segment_type(struct inode *inode, > pgoff_t pgofs) > static int __get_segment_type_6(struct f2fs_io_info *fio) > { > if (fio->type == DATA) { > - struct inode *inode = fio->page->mapping->host; > + struct inode *inode = fio_inode(fio); > int type; > > if (is_inode_flag_set(inode, FI_ALIGNED_WRITE)) > @@ -4023,7 +4023,7 @@ int f2fs_inplace_write_data(struct f2fs_io_info *fio) > if (!err) { > f2fs_update_device_state(fio->sbi, fio->ino, > fio->new_blkaddr, 1); > - f2fs_update_iostat(fio->sbi, fio->page->mapping->host, > + f2fs_update_iostat(fio->sbi, fio_inode(fio), > fio->io_type, F2FS_BLKSIZE); > } > > -- > 2.47.2 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel