Skip to contentSkip to conversation

ext4: remove unnecessary bio get/put

PATCH In review Jens Axboe 2 participants 2 messages Mar 21, 2016 – May 6, 2016 ext4 file system

lore
Share & tools
lore

Jens Axboe

author
#0 lore raw

PATCH 1/1 ext4: remove unnecessary bio get/put

Hi Ted,

ext4_io_submit() use to check for EOPNOTSUPP after bio submission, which is why it had to get an extra reference to the bio before submitting it. But since we no longer touch the bio after submission, get rid of the redundant get/put of the bio. If we do get the extra reference, we enter the slower path of having to flag this bio as now having external references.

fs/ext4/page-io.c +0 -2
index 349d7aa04fe7..a81939236707 100644
@@ -351,9 +351,7 @@ void ext4_io_submit(struct ext4_io_submit *io)
 	if (bio) {
 		int io_op = io->io_wbc->sync_mode == WB_SYNC_ALL ?
 			    WRITE_SYNC : WRITE;
-		bio_get(io->io_bio);
 		submit_bio(io_op, io->io_bio);
-		bio_put(io->io_bio);
 	}
 	io->io_bio = NULL;
 }
Signature · 1 line
Jens Axboe
maintainer
#1 lore raw
Quoted 9 lines · Jens Axboe

ext4_io_submit() use to check for EOPNOTSUPP after bio submission, which is why it had to get an extra reference to the bio before submitting it. But since we no longer touch the bio after submission, get rid of the redundant get/put of the bio. If we do get the extra reference, we enter the slower path of having to flag this bio as now having external references.

Jens, thanks for pointing this out. I've applied this to the ext4.git tree.

- Ted