@@ -168,15 +168,15 @@ static struct bio *__bio_alloc(struct f2fs_sb_info *sbi, block_t blk_addr,
168168 return bio ;
169169}
170170
171- static inline void __submit_bio (struct f2fs_sb_info * sbi , int rw ,
172- struct bio * bio , enum page_type type )
171+ static inline void __submit_bio (struct f2fs_sb_info * sbi ,
172+ struct bio * bio , enum page_type type )
173173{
174- if (!is_read_io (rw )) {
174+ if (!is_read_io (bio_op ( bio ) )) {
175175 if (f2fs_sb_mounted_blkzoned (sbi -> sb ) &&
176176 current -> plug && (type == DATA || type == NODE ))
177177 blk_finish_plug (current -> plug );
178178 }
179- submit_bio (rw , bio );
179+ submit_bio (0 , bio );
180180}
181181
182182static void __submit_merged_bio (struct f2fs_bio_info * io )
@@ -186,12 +186,14 @@ static void __submit_merged_bio(struct f2fs_bio_info *io)
186186 if (!io -> bio )
187187 return ;
188188
189- if (is_read_io (fio -> rw ))
189+ if (is_read_io (fio -> op ))
190190 trace_f2fs_submit_read_bio (io -> sbi -> sb , fio , io -> bio );
191191 else
192192 trace_f2fs_submit_write_bio (io -> sbi -> sb , fio , io -> bio );
193193
194- __submit_bio (io -> sbi , fio -> rw , io -> bio , fio -> type );
194+ bio_set_op_attrs (io -> bio , fio -> op , fio -> op_flags );
195+
196+ __submit_bio (io -> sbi , io -> bio , fio -> type );
195197 io -> bio = NULL ;
196198}
197199
@@ -257,10 +259,10 @@ static void __f2fs_submit_merged_bio(struct f2fs_sb_info *sbi,
257259 /* change META to META_FLUSH in the checkpoint procedure */
258260 if (type >= META_FLUSH ) {
259261 io -> fio .type = META_FLUSH ;
260- if ( test_opt ( sbi , NOBARRIER ))
261- io -> fio .rw = WRITE_FLUSH | REQ_META | REQ_PRIO ;
262- else
263- io -> fio .rw = WRITE_FLUSH_FUA | REQ_META | REQ_PRIO ;
262+ io -> fio . op = REQ_OP_WRITE ;
263+ io -> fio .op_flags = WRITE_FLUSH | REQ_META | REQ_PRIO ;
264+ if (! test_opt ( sbi , NOBARRIER ))
265+ io -> fio .op_flags |= REQ_FUA ;
264266 }
265267 __submit_merged_bio (io );
266268out :
@@ -302,14 +304,15 @@ int f2fs_submit_page_bio(struct f2fs_io_info *fio)
302304 f2fs_trace_ios (fio , 0 );
303305
304306 /* Allocate a new bio */
305- bio = __bio_alloc (fio -> sbi , fio -> new_blkaddr , 1 , is_read_io (fio -> rw ));
307+ bio = __bio_alloc (fio -> sbi , fio -> new_blkaddr , 1 , is_read_io (fio -> op ));
306308
307309 if (bio_add_page (bio , page , PAGE_SIZE , 0 ) < PAGE_SIZE ) {
308310 bio_put (bio );
309311 return - EFAULT ;
310312 }
313+ bio_set_op_attrs (bio , fio -> op , fio -> op_flags );
311314
312- __submit_bio (fio -> sbi , fio -> rw , bio , fio -> type );
315+ __submit_bio (fio -> sbi , bio , fio -> type );
313316 return 0 ;
314317}
315318
@@ -318,7 +321,7 @@ void f2fs_submit_page_mbio(struct f2fs_io_info *fio)
318321 struct f2fs_sb_info * sbi = fio -> sbi ;
319322 enum page_type btype = PAGE_TYPE_OF_BIO (fio -> type );
320323 struct f2fs_bio_info * io ;
321- bool is_read = is_read_io (fio -> rw );
324+ bool is_read = is_read_io (fio -> op );
322325 struct page * bio_page ;
323326
324327 io = is_read ? & sbi -> read_io : & sbi -> write_io [btype ];
@@ -335,7 +338,7 @@ void f2fs_submit_page_mbio(struct f2fs_io_info *fio)
335338 down_write (& io -> io_rwsem );
336339
337340 if (io -> bio && (io -> last_block_in_bio != fio -> new_blkaddr - 1 ||
338- (io -> fio .rw != fio -> rw ) ||
341+ (io -> fio .op != fio -> op || io -> fio . op_flags != fio -> op_flags ) ||
339342 !__same_bdev (sbi , fio -> new_blkaddr , io -> bio )))
340343 __submit_merged_bio (io );
341344alloc_new :
@@ -463,7 +466,7 @@ int f2fs_get_block(struct dnode_of_data *dn, pgoff_t index)
463466}
464467
465468struct page * get_read_data_page (struct inode * inode , pgoff_t index ,
466- int rw , bool for_write )
469+ int op_flags , bool for_write )
467470{
468471 struct address_space * mapping = inode -> i_mapping ;
469472 struct dnode_of_data dn ;
@@ -473,7 +476,8 @@ struct page *get_read_data_page(struct inode *inode, pgoff_t index,
473476 struct f2fs_io_info fio = {
474477 .sbi = F2FS_I_SB (inode ),
475478 .type = DATA ,
476- .rw = rw ,
479+ .op = REQ_OP_READ ,
480+ .op_flags = op_flags ,
477481 .encrypted_page = NULL ,
478482 };
479483
@@ -541,7 +545,7 @@ struct page *find_data_page(struct inode *inode, pgoff_t index)
541545 return page ;
542546 f2fs_put_page (page , 0 );
543547
544- page = get_read_data_page (inode , index , READ_SYNC , false);
548+ page = get_read_data_page (inode , index , REQ_SYNC , false);
545549 if (IS_ERR (page ))
546550 return page ;
547551
@@ -567,7 +571,7 @@ struct page *get_lock_data_page(struct inode *inode, pgoff_t index,
567571 struct address_space * mapping = inode -> i_mapping ;
568572 struct page * page ;
569573repeat :
570- page = get_read_data_page (inode , index , READ_SYNC , for_write );
574+ page = get_read_data_page (inode , index , REQ_SYNC , for_write );
571575 if (IS_ERR (page ))
572576 return page ;
573577
@@ -1145,7 +1149,7 @@ static int f2fs_mpage_readpages(struct address_space *mapping,
11451149 if (bio && (last_block_in_bio != block_nr - 1 ||
11461150 !__same_bdev (F2FS_I_SB (inode ), block_nr , bio ))) {
11471151submit_and_realloc :
1148- __submit_bio (F2FS_I_SB (inode ), READ , bio , DATA );
1152+ __submit_bio (F2FS_I_SB (inode ), bio , DATA );
11491153 bio = NULL ;
11501154 }
11511155 if (bio == NULL ) {
@@ -1154,6 +1158,7 @@ static int f2fs_mpage_readpages(struct address_space *mapping,
11541158 bio = NULL ;
11551159 goto set_error_page ;
11561160 }
1161+ bio_set_op_attrs (bio , REQ_OP_READ , 0 );
11571162 }
11581163
11591164 if (bio_add_page (bio , page , blocksize , 0 ) < blocksize )
@@ -1168,7 +1173,7 @@ static int f2fs_mpage_readpages(struct address_space *mapping,
11681173 goto next_page ;
11691174confused :
11701175 if (bio ) {
1171- __submit_bio (F2FS_I_SB (inode ), READ , bio , DATA );
1176+ __submit_bio (F2FS_I_SB (inode ), bio , DATA );
11721177 bio = NULL ;
11731178 }
11741179 unlock_page (page );
@@ -1178,7 +1183,7 @@ static int f2fs_mpage_readpages(struct address_space *mapping,
11781183 }
11791184 BUG_ON (pages && !list_empty (pages ));
11801185 if (bio )
1181- __submit_bio (F2FS_I_SB (inode ), READ , bio , DATA );
1186+ __submit_bio (F2FS_I_SB (inode ), bio , DATA );
11821187 return 0 ;
11831188}
11841189
@@ -1296,7 +1301,8 @@ static int f2fs_write_data_page(struct page *page,
12961301 struct f2fs_io_info fio = {
12971302 .sbi = sbi ,
12981303 .type = DATA ,
1299- .rw = (wbc -> sync_mode == WB_SYNC_ALL ) ? WRITE_SYNC : WRITE ,
1304+ .op = REQ_OP_WRITE ,
1305+ .op_flags = wbc_to_write_flags (wbc ),
13001306 .page = page ,
13011307 .encrypted_page = NULL ,
13021308 };
@@ -1728,14 +1734,14 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping,
17281734 err = PTR_ERR (bio );
17291735 goto fail ;
17301736 }
1731-
1737+ bio -> bi_rw = READ_SYNC ;
17321738 if (bio_add_page (bio , page , PAGE_SIZE , 0 ) < PAGE_SIZE ) {
17331739 bio_put (bio );
17341740 err = - EFAULT ;
17351741 goto fail ;
17361742 }
17371743
1738- __submit_bio (sbi , READ_SYNC , bio , DATA );
1744+ __submit_bio (sbi , bio , DATA );
17391745
17401746 lock_page (page );
17411747 if (unlikely (page -> mapping != mapping )) {
0 commit comments