fs: sdfat: Use clean_bdev_bh_alias instead of unmap_underlying_metadata for >=4.10

.readlink should be left uninitialised if no special .readlink is
required
Fixed a mistake of using __sdfat_writepage_end_io() instead of
__mpage_write_end_io() on mpage.c
This commit is contained in:
GrayJack 2018-03-29 00:51:39 -03:00 committed by Andreas Schneider
parent a4c7e654d7
commit ac2599d1e3
2 changed files with 22 additions and 2 deletions

12
mpage.c
View File

@ -95,9 +95,9 @@ static inline void __sdfat_submit_bio_write2(int flags, struct bio *bio)
static void mpage_write_end_io(struct bio *bio) static void mpage_write_end_io(struct bio *bio)
{ {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0) #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0)
__sdfat_writepage_end_io(bio, bio->bi_status); __mpage_write_end_io(bio, bio->bi_status);
#else /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) */ #else /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) */
__sdfat_writepage_end_io(bio, bio->bi_error); __mpage_write_end_io(bio, bio->bi_error);
#endif #endif
} }
#else /* LINUX_VERSION_CODE < KERNEL_VERSION(4,3,0) */ #else /* LINUX_VERSION_CODE < KERNEL_VERSION(4,3,0) */
@ -369,7 +369,11 @@ static int sdfat_mpage_writepage(struct page *page,
if (buffer_new(bh)) { if (buffer_new(bh)) {
clear_buffer_new(bh); clear_buffer_new(bh);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
clean_bdev_bh_alias(bh);
#else /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) */
unmap_underlying_metadata(bh->b_bdev, bh->b_blocknr); unmap_underlying_metadata(bh->b_bdev, bh->b_blocknr);
#endif
} }
} }
@ -419,8 +423,12 @@ static int sdfat_mpage_writepage(struct page *page,
goto confused; goto confused;
if (buffer_new(&map_bh)) if (buffer_new(&map_bh))
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
clean_bdev_bh_alias(&map_bh);
#else /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) */
unmap_underlying_metadata(map_bh.b_bdev, unmap_underlying_metadata(map_bh.b_bdev,
map_bh.b_blocknr); map_bh.b_blocknr);
#endif
if (buffer_boundary(&map_bh)) { if (buffer_boundary(&map_bh)) {
boundary_block = map_bh.b_blocknr; boundary_block = map_bh.b_blocknr;
boundary_bdev = map_bh.b_bdev; boundary_bdev = map_bh.b_bdev;

12
sdfat.c
View File

@ -2882,9 +2882,15 @@ static int sdfat_setattr(struct dentry *dentry, struct iattr *attr)
return error; return error;
} }
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
static int sdfat_getattr(const struct path *path, struct kstat *stat, u32 request_mask, unsigned int flags)
{
struct inode *inode = path->dentry->d_inode;
#else
static int sdfat_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) static int sdfat_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
{ {
struct inode *inode = dentry->d_inode; struct inode *inode = dentry->d_inode;
#endif
TMSG("%s entered\n", __func__); TMSG("%s entered\n", __func__);
@ -2919,7 +2925,9 @@ static const struct inode_operations sdfat_dir_inode_operations = {
/* File Operations */ /* File Operations */
/*======================================================================*/ /*======================================================================*/
static const struct inode_operations sdfat_symlink_inode_operations = { static const struct inode_operations sdfat_symlink_inode_operations = {
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
.readlink = generic_readlink, .readlink = generic_readlink,
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0) #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)
.get_link = sdfat_follow_link, .get_link = sdfat_follow_link,
#else /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0) */ #else /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0) */
@ -3531,7 +3539,11 @@ static int sdfat_writepage(struct page *page, struct writeback_control *wbc)
if (buffer_new(bh)) { if (buffer_new(bh)) {
clear_buffer_new(bh); clear_buffer_new(bh);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
clean_bdev_bh_alias(bh);
#else /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) */
unmap_underlying_metadata(bh->b_bdev, bh->b_blocknr); unmap_underlying_metadata(bh->b_bdev, bh->b_blocknr);
#endif
} }
} }