mirror of
https://github.com/torvalds/linux.git
synced 2026-06-02 19:43:40 +02:00
f2fs: Introduce fio_inode()
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) <willy@infradead.org> [Jaegeuk Kim: fix wrong fio_inode conversion] Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
8cc29b38cb
commit
4e5109c7c5
|
|
@ -995,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, fio->page->mapping->host,
|
||||
!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, fio->page->mapping->host,
|
||||
f2fs_set_bio_crypt_ctx(io->bio, fio_inode(fio),
|
||||
page_folio(bio_page)->index, fio, GFP_NOIO);
|
||||
io->fio = *fio;
|
||||
}
|
||||
|
|
@ -2501,7 +2501,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 +2631,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;
|
||||
|
|
|
|||
|
|
@ -3872,6 +3872,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
|
||||
|
|
|
|||
|
|
@ -3590,7 +3590,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;
|
||||
|
|
@ -3624,7 +3624,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))
|
||||
|
|
@ -4029,7 +4029,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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user