mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 20:51:03 +02:00
vfs: guard end of device for mpage interface
Add guard_bio_eod() check for mpage code in order to allow us to do IO even on the odd last sectors of a device, even if the block size is some multiple of the physical sector size. Using mpage_readpages() for block device requires this guard check. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: Jens Axboe <axboe@kernel.dk> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: Jeff Moyer <jmoyer@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
59d43914ed
commit
4db96b71e3
@@ -2966,7 +2966,7 @@ static void end_bio_bh_io_sync(struct bio *bio, int err)
|
|||||||
* errors, this only handles the "we need to be able to
|
* errors, this only handles the "we need to be able to
|
||||||
* do IO at the final sector" case.
|
* do IO at the final sector" case.
|
||||||
*/
|
*/
|
||||||
static void guard_bio_eod(int rw, struct bio *bio)
|
void guard_bio_eod(int rw, struct bio *bio)
|
||||||
{
|
{
|
||||||
sector_t maxsector;
|
sector_t maxsector;
|
||||||
struct bio_vec *bvec = &bio->bi_io_vec[bio->bi_vcnt - 1];
|
struct bio_vec *bvec = &bio->bi_io_vec[bio->bi_vcnt - 1];
|
||||||
|
@@ -34,6 +34,11 @@ static inline int __sync_blockdev(struct block_device *bdev, int wait)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* buffer.c
|
||||||
|
*/
|
||||||
|
extern void guard_bio_eod(int rw, struct bio *bio);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* char_dev.c
|
* char_dev.c
|
||||||
*/
|
*/
|
||||||
|
@@ -28,6 +28,7 @@
|
|||||||
#include <linux/backing-dev.h>
|
#include <linux/backing-dev.h>
|
||||||
#include <linux/pagevec.h>
|
#include <linux/pagevec.h>
|
||||||
#include <linux/cleancache.h>
|
#include <linux/cleancache.h>
|
||||||
|
#include "internal.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* I/O completion handler for multipage BIOs.
|
* I/O completion handler for multipage BIOs.
|
||||||
@@ -57,6 +58,7 @@ static void mpage_end_io(struct bio *bio, int err)
|
|||||||
static struct bio *mpage_bio_submit(int rw, struct bio *bio)
|
static struct bio *mpage_bio_submit(int rw, struct bio *bio)
|
||||||
{
|
{
|
||||||
bio->bi_end_io = mpage_end_io;
|
bio->bi_end_io = mpage_end_io;
|
||||||
|
guard_bio_eod(rw, bio);
|
||||||
submit_bio(rw, bio);
|
submit_bio(rw, bio);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user