@@ -231,19 +231,17 @@ static void gfs2_end_log_write(struct bio *bio)
231231/**
232232 * gfs2_log_submit_write - Submit a pending log write bio
233233 * @biop: Address of the bio pointer
234- * @opf: REQ_OP | op_flags
235234 *
236235 * Submit any pending part-built or full bio to the block device. If
237236 * there is no pending bio, then this is a no-op.
238237 */
239238
240- void gfs2_log_submit_write (struct bio * * biop , blk_opf_t opf )
239+ void gfs2_log_submit_write (struct bio * * biop )
241240{
242241 struct bio * bio = * biop ;
243242 if (bio ) {
244243 struct gfs2_sbd * sdp = bio -> bi_private ;
245244 atomic_inc (& sdp -> sd_log_in_flight );
246- bio -> bi_opf = opf ;
247245 submit_bio (bio );
248246 * biop = NULL ;
249247 }
@@ -254,17 +252,18 @@ void gfs2_log_submit_write(struct bio **biop, blk_opf_t opf)
254252 * @sdp: The super block
255253 * @blkno: The device block number we want to write to
256254 * @end_io: The bi_end_io callback
255+ * @opf: REQ_OP | op_flags
257256 *
258257 * Allocate a new bio, initialize it with the given parameters and return it.
259258 *
260259 * Returns: The newly allocated bio
261260 */
262261
263262static struct bio * gfs2_log_alloc_bio (struct gfs2_sbd * sdp , u64 blkno ,
264- bio_end_io_t * end_io )
263+ bio_end_io_t * end_io , blk_opf_t opf )
265264{
266265 struct super_block * sb = sdp -> sd_vfs ;
267- struct bio * bio = bio_alloc (sb -> s_bdev , BIO_MAX_VECS , 0 , GFP_NOIO );
266+ struct bio * bio = bio_alloc (sb -> s_bdev , BIO_MAX_VECS , opf , GFP_NOIO );
268267
269268 bio -> bi_iter .bi_sector = blkno << sdp -> sd_fsb2bb_shift ;
270269 bio -> bi_end_io = end_io ;
@@ -303,10 +302,10 @@ static struct bio *gfs2_log_get_bio(struct gfs2_sbd *sdp, u64 blkno,
303302 nblk >>= sdp -> sd_fsb2bb_shift ;
304303 if (blkno == nblk && !flush )
305304 return bio ;
306- gfs2_log_submit_write (biop , op );
305+ gfs2_log_submit_write (biop );
307306 }
308307
309- * biop = gfs2_log_alloc_bio (sdp , blkno , end_io );
308+ * biop = gfs2_log_alloc_bio (sdp , blkno , end_io , op );
310309 return * biop ;
311310}
312311
@@ -318,6 +317,7 @@ static struct bio *gfs2_log_get_bio(struct gfs2_sbd *sdp, u64 blkno,
318317 * @size: the size of the data to write
319318 * @offset: the offset within the page
320319 * @blkno: block number of the log entry
320+ * @opf: REQ_OP | op_flags
321321 *
322322 * Try and add the page segment to the current bio. If that fails,
323323 * submit the current bio to the device and create a new one, and
@@ -326,17 +326,17 @@ static struct bio *gfs2_log_get_bio(struct gfs2_sbd *sdp, u64 blkno,
326326
327327void gfs2_log_write (struct gfs2_sbd * sdp , struct gfs2_jdesc * jd ,
328328 struct page * page , unsigned size , unsigned offset ,
329- u64 blkno )
329+ u64 blkno , blk_opf_t opf )
330330{
331331 struct bio * bio ;
332332 int ret ;
333333
334- bio = gfs2_log_get_bio (sdp , blkno , & jd -> jd_log_bio , REQ_OP_WRITE ,
334+ bio = gfs2_log_get_bio (sdp , blkno , & jd -> jd_log_bio , opf ,
335335 gfs2_end_log_write , false);
336336 ret = bio_add_page (bio , page , size , offset );
337337 if (ret == 0 ) {
338338 bio = gfs2_log_get_bio (sdp , blkno , & jd -> jd_log_bio ,
339- REQ_OP_WRITE , gfs2_end_log_write , true);
339+ opf , gfs2_end_log_write , true);
340340 ret = bio_add_page (bio , page , size , offset );
341341 WARN_ON (ret == 0 );
342342 }
@@ -359,7 +359,7 @@ static void gfs2_log_write_bh(struct gfs2_sbd *sdp, struct buffer_head *bh)
359359 dblock = gfs2_log_bmap (sdp -> sd_jdesc , sdp -> sd_log_flush_head );
360360 gfs2_log_incr_head (sdp );
361361 gfs2_log_write (sdp , sdp -> sd_jdesc , folio_page (bh -> b_folio , 0 ),
362- bh -> b_size , bh_offset (bh ), dblock );
362+ bh -> b_size , bh_offset (bh ), dblock , REQ_OP_WRITE );
363363}
364364
365365/**
@@ -380,7 +380,8 @@ static void gfs2_log_write_page(struct gfs2_sbd *sdp, struct page *page)
380380
381381 dblock = gfs2_log_bmap (sdp -> sd_jdesc , sdp -> sd_log_flush_head );
382382 gfs2_log_incr_head (sdp );
383- gfs2_log_write (sdp , sdp -> sd_jdesc , page , sb -> s_blocksize , 0 , dblock );
383+ gfs2_log_write (sdp , sdp -> sd_jdesc , page , sb -> s_blocksize , 0 , dblock ,
384+ REQ_OP_WRITE );
384385}
385386
386387/**
@@ -477,11 +478,12 @@ static void gfs2_jhead_process_page(struct gfs2_jdesc *jd, unsigned long index,
477478 folio_put_refs (folio , 2 );
478479}
479480
480- static struct bio * gfs2_chain_bio (struct bio * prev , unsigned int nr_iovecs )
481+ static struct bio * gfs2_chain_bio (struct bio * prev , unsigned int nr_iovecs ,
482+ blk_opf_t opf )
481483{
482484 struct bio * new ;
483485
484- new = bio_alloc (prev -> bi_bdev , nr_iovecs , prev -> bi_opf , GFP_NOIO );
486+ new = bio_alloc (prev -> bi_bdev , nr_iovecs , opf , GFP_NOIO );
485487 bio_clone_blkg_association (new , prev );
486488 new -> bi_iter .bi_sector = bio_end_sector (prev );
487489 bio_chain (new , prev );
@@ -546,7 +548,8 @@ int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head)
546548 unsigned int blocks =
547549 (PAGE_SIZE - off ) >> bsize_shift ;
548550
549- bio = gfs2_chain_bio (bio , blocks );
551+ bio = gfs2_chain_bio (bio , blocks ,
552+ REQ_OP_READ );
550553 goto add_block_to_new_bio ;
551554 }
552555 }
@@ -556,8 +559,8 @@ int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head)
556559 submit_bio (bio );
557560 }
558561
559- bio = gfs2_log_alloc_bio (sdp , dblock , gfs2_end_log_read );
560- bio -> bi_opf = REQ_OP_READ ;
562+ bio = gfs2_log_alloc_bio (sdp , dblock , gfs2_end_log_read ,
563+ REQ_OP_READ ) ;
561564add_block_to_new_bio :
562565 bio_add_folio_nofail (bio , folio , bsize , off );
563566block_added :
0 commit comments