提交 e1b1afa6 编写于 作者: M Mike Christie 提交者: Jens Axboe

gfs2: use bio op accessors

Separate the op from the rq_flag_bits and have gfs2
set/get the bio using bio_set_op_attrs/bio_op.
Signed-off-by: NMike Christie <mchristi@redhat.com>
Reviewed-by: NChristoph Hellwig <hch@lst.de>
Reviewed-by: NHannes Reinecke <hare@suse.com>
Signed-off-by: NJens Axboe <axboe@fb.com>
上级 04d328de
...@@ -657,7 +657,7 @@ static void log_write_header(struct gfs2_sbd *sdp, u32 flags) ...@@ -657,7 +657,7 @@ static void log_write_header(struct gfs2_sbd *sdp, u32 flags)
struct gfs2_log_header *lh; struct gfs2_log_header *lh;
unsigned int tail; unsigned int tail;
u32 hash; u32 hash;
int rw = WRITE_FLUSH_FUA | REQ_META; int op_flags = WRITE_FLUSH_FUA | REQ_META;
struct page *page = mempool_alloc(gfs2_page_pool, GFP_NOIO); struct page *page = mempool_alloc(gfs2_page_pool, GFP_NOIO);
enum gfs2_freeze_state state = atomic_read(&sdp->sd_freeze_state); enum gfs2_freeze_state state = atomic_read(&sdp->sd_freeze_state);
lh = page_address(page); lh = page_address(page);
...@@ -682,12 +682,12 @@ static void log_write_header(struct gfs2_sbd *sdp, u32 flags) ...@@ -682,12 +682,12 @@ static void log_write_header(struct gfs2_sbd *sdp, u32 flags)
if (test_bit(SDF_NOBARRIERS, &sdp->sd_flags)) { if (test_bit(SDF_NOBARRIERS, &sdp->sd_flags)) {
gfs2_ordered_wait(sdp); gfs2_ordered_wait(sdp);
log_flush_wait(sdp); log_flush_wait(sdp);
rw = WRITE_SYNC | REQ_META | REQ_PRIO; op_flags = WRITE_SYNC | REQ_META | REQ_PRIO;
} }
sdp->sd_log_idle = (tail == sdp->sd_log_flush_head); sdp->sd_log_idle = (tail == sdp->sd_log_flush_head);
gfs2_log_write_page(sdp, page); gfs2_log_write_page(sdp, page);
gfs2_log_flush_bio(sdp, rw); gfs2_log_flush_bio(sdp, REQ_OP_WRITE, op_flags);
log_flush_wait(sdp); log_flush_wait(sdp);
if (sdp->sd_log_tail != tail) if (sdp->sd_log_tail != tail)
...@@ -738,7 +738,7 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl, ...@@ -738,7 +738,7 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl,
gfs2_ordered_write(sdp); gfs2_ordered_write(sdp);
lops_before_commit(sdp, tr); lops_before_commit(sdp, tr);
gfs2_log_flush_bio(sdp, WRITE); gfs2_log_flush_bio(sdp, REQ_OP_WRITE, 0);
if (sdp->sd_log_head != sdp->sd_log_flush_head) { if (sdp->sd_log_head != sdp->sd_log_flush_head) {
log_flush_wait(sdp); log_flush_wait(sdp);
......
...@@ -230,17 +230,18 @@ static void gfs2_end_log_write(struct bio *bio) ...@@ -230,17 +230,18 @@ static void gfs2_end_log_write(struct bio *bio)
/** /**
* gfs2_log_flush_bio - Submit any pending log bio * gfs2_log_flush_bio - Submit any pending log bio
* @sdp: The superblock * @sdp: The superblock
* @rw: The rw flags * @op: REQ_OP
* @op_flags: rq_flag_bits
* *
* Submit any pending part-built or full bio to the block device. If * Submit any pending part-built or full bio to the block device. If
* there is no pending bio, then this is a no-op. * there is no pending bio, then this is a no-op.
*/ */
void gfs2_log_flush_bio(struct gfs2_sbd *sdp, int rw) void gfs2_log_flush_bio(struct gfs2_sbd *sdp, int op, int op_flags)
{ {
if (sdp->sd_log_bio) { if (sdp->sd_log_bio) {
atomic_inc(&sdp->sd_log_in_flight); atomic_inc(&sdp->sd_log_in_flight);
sdp->sd_log_bio->bi_rw = rw; bio_set_op_attrs(sdp->sd_log_bio, op, op_flags);
submit_bio(sdp->sd_log_bio); submit_bio(sdp->sd_log_bio);
sdp->sd_log_bio = NULL; sdp->sd_log_bio = NULL;
} }
...@@ -300,7 +301,7 @@ static struct bio *gfs2_log_get_bio(struct gfs2_sbd *sdp, u64 blkno) ...@@ -300,7 +301,7 @@ static struct bio *gfs2_log_get_bio(struct gfs2_sbd *sdp, u64 blkno)
nblk >>= sdp->sd_fsb2bb_shift; nblk >>= sdp->sd_fsb2bb_shift;
if (blkno == nblk) if (blkno == nblk)
return bio; return bio;
gfs2_log_flush_bio(sdp, WRITE); gfs2_log_flush_bio(sdp, REQ_OP_WRITE, 0);
} }
return gfs2_log_alloc_bio(sdp, blkno); return gfs2_log_alloc_bio(sdp, blkno);
...@@ -329,7 +330,7 @@ static void gfs2_log_write(struct gfs2_sbd *sdp, struct page *page, ...@@ -329,7 +330,7 @@ static void gfs2_log_write(struct gfs2_sbd *sdp, struct page *page,
bio = gfs2_log_get_bio(sdp, blkno); bio = gfs2_log_get_bio(sdp, blkno);
ret = bio_add_page(bio, page, size, offset); ret = bio_add_page(bio, page, size, offset);
if (ret == 0) { if (ret == 0) {
gfs2_log_flush_bio(sdp, WRITE); gfs2_log_flush_bio(sdp, REQ_OP_WRITE, 0);
bio = gfs2_log_alloc_bio(sdp, blkno); bio = gfs2_log_alloc_bio(sdp, blkno);
ret = bio_add_page(bio, page, size, offset); ret = bio_add_page(bio, page, size, offset);
WARN_ON(ret == 0); WARN_ON(ret == 0);
......
...@@ -27,7 +27,7 @@ extern const struct gfs2_log_operations gfs2_databuf_lops; ...@@ -27,7 +27,7 @@ extern const struct gfs2_log_operations gfs2_databuf_lops;
extern const struct gfs2_log_operations *gfs2_log_ops[]; extern const struct gfs2_log_operations *gfs2_log_ops[];
extern void gfs2_log_write_page(struct gfs2_sbd *sdp, struct page *page); extern void gfs2_log_write_page(struct gfs2_sbd *sdp, struct page *page);
extern void gfs2_log_flush_bio(struct gfs2_sbd *sdp, int rw); extern void gfs2_log_flush_bio(struct gfs2_sbd *sdp, int op, int op_flags);
extern void gfs2_pin(struct gfs2_sbd *sdp, struct buffer_head *bh); extern void gfs2_pin(struct gfs2_sbd *sdp, struct buffer_head *bh);
static inline unsigned int buf_limit(struct gfs2_sbd *sdp) static inline unsigned int buf_limit(struct gfs2_sbd *sdp)
......
...@@ -213,7 +213,8 @@ static void gfs2_meta_read_endio(struct bio *bio) ...@@ -213,7 +213,8 @@ static void gfs2_meta_read_endio(struct bio *bio)
* Submit several consecutive buffer head I/O requests as a single bio I/O * Submit several consecutive buffer head I/O requests as a single bio I/O
* request. (See submit_bh_wbc.) * request. (See submit_bh_wbc.)
*/ */
static void gfs2_submit_bhs(int rw, struct buffer_head *bhs[], int num) static void gfs2_submit_bhs(int op, int op_flags, struct buffer_head *bhs[],
int num)
{ {
struct buffer_head *bh = bhs[0]; struct buffer_head *bh = bhs[0];
struct bio *bio; struct bio *bio;
...@@ -230,7 +231,7 @@ static void gfs2_submit_bhs(int rw, struct buffer_head *bhs[], int num) ...@@ -230,7 +231,7 @@ static void gfs2_submit_bhs(int rw, struct buffer_head *bhs[], int num)
bio_add_page(bio, bh->b_page, bh->b_size, bh_offset(bh)); bio_add_page(bio, bh->b_page, bh->b_size, bh_offset(bh));
} }
bio->bi_end_io = gfs2_meta_read_endio; bio->bi_end_io = gfs2_meta_read_endio;
bio->bi_rw = rw; bio_set_op_attrs(bio, op, op_flags);
submit_bio(bio); submit_bio(bio);
} }
...@@ -281,7 +282,7 @@ int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, int flags, ...@@ -281,7 +282,7 @@ int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, int flags,
} }
} }
gfs2_submit_bhs(READ_SYNC | REQ_META | REQ_PRIO, bhs, num); gfs2_submit_bhs(REQ_OP_READ, READ_SYNC | REQ_META | REQ_PRIO, bhs, num);
if (!(flags & DIO_WAIT)) if (!(flags & DIO_WAIT))
return 0; return 0;
......
...@@ -246,7 +246,7 @@ static int gfs2_read_super(struct gfs2_sbd *sdp, sector_t sector, int silent) ...@@ -246,7 +246,7 @@ static int gfs2_read_super(struct gfs2_sbd *sdp, sector_t sector, int silent)
bio->bi_end_io = end_bio_io_page; bio->bi_end_io = end_bio_io_page;
bio->bi_private = page; bio->bi_private = page;
bio->bi_rw = READ_SYNC | REQ_META; bio_set_op_attrs(bio, REQ_OP_READ, READ_SYNC | REQ_META);
submit_bio(bio); submit_bio(bio);
wait_on_page_locked(page); wait_on_page_locked(page);
bio_put(bio); bio_put(bio);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册