Skip to content

Commit c6b0271

Browse files
committed
Merge tag 'fs_for_v6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs
Pull misc filesystem updates from Jan Kara: - Rewrite kmap_local() handling in ext2 - Convert ext2 direct IO path to iomap (with some infrastructure tweaks associated with that) - Convert two boilerplate licenses in udf to SPDX identifiers - Other small udf, ext2, and quota fixes and cleanups * tag 'fs_for_v6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs: udf: Fix uninitialized array access for some pathnames ext2: Drop fragment support quota: fix warning in dqgrab() quota: Properly disable quotas when add_dquot_ref() fails fs: udf: udftime: Replace LGPL boilerplate with SPDX identifier fs: udf: Replace GPL 2.0 boilerplate license notice with SPDX identifier fs: Drop wait_unfrozen wait queue ext2_find_entry()/ext2_dotdot(): callers don't need page_addr anymore ext2_{set_link,delete_entry}(): don't bother with page_addr ext2_put_page(): accept any pointer within the page ext2_get_page(): saner type ext2: use offset_in_page() instead of open-coding it as subtraction ext2_rename(): set_link and delete_entry may fail ext2: Add direct-io trace points ext2: Move direct-io to use iomap ext2: Use generic_buffers_fsync() implementation ext4: Use generic_buffers_fsync_noflush() implementation fs/buffer.c: Add generic_buffers_fsync*() implementation ext2/dax: Fix ext2_setsize when len is page aligned
2 parents 18c9901 + 028f605 commit c6b0271

31 files changed

+469
-291
lines changed

fs/buffer.c

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,76 @@ int sync_mapping_buffers(struct address_space *mapping)
591591
}
592592
EXPORT_SYMBOL(sync_mapping_buffers);
593593

594+
/**
595+
* generic_buffers_fsync_noflush - generic buffer fsync implementation
596+
* for simple filesystems with no inode lock
597+
*
598+
* @file: file to synchronize
599+
* @start: start offset in bytes
600+
* @end: end offset in bytes (inclusive)
601+
* @datasync: only synchronize essential metadata if true
602+
*
603+
* This is a generic implementation of the fsync method for simple
604+
* filesystems which track all non-inode metadata in the buffers list
605+
* hanging off the address_space structure.
606+
*/
607+
int generic_buffers_fsync_noflush(struct file *file, loff_t start, loff_t end,
608+
bool datasync)
609+
{
610+
struct inode *inode = file->f_mapping->host;
611+
int err;
612+
int ret;
613+
614+
err = file_write_and_wait_range(file, start, end);
615+
if (err)
616+
return err;
617+
618+
ret = sync_mapping_buffers(inode->i_mapping);
619+
if (!(inode->i_state & I_DIRTY_ALL))
620+
goto out;
621+
if (datasync && !(inode->i_state & I_DIRTY_DATASYNC))
622+
goto out;
623+
624+
err = sync_inode_metadata(inode, 1);
625+
if (ret == 0)
626+
ret = err;
627+
628+
out:
629+
/* check and advance again to catch errors after syncing out buffers */
630+
err = file_check_and_advance_wb_err(file);
631+
if (ret == 0)
632+
ret = err;
633+
return ret;
634+
}
635+
EXPORT_SYMBOL(generic_buffers_fsync_noflush);
636+
637+
/**
638+
* generic_buffers_fsync - generic buffer fsync implementation
639+
* for simple filesystems with no inode lock
640+
*
641+
* @file: file to synchronize
642+
* @start: start offset in bytes
643+
* @end: end offset in bytes (inclusive)
644+
* @datasync: only synchronize essential metadata if true
645+
*
646+
* This is a generic implementation of the fsync method for simple
647+
* filesystems which track all non-inode metadata in the buffers list
648+
* hanging off the address_space structure. This also makes sure that
649+
* a device cache flush operation is called at the end.
650+
*/
651+
int generic_buffers_fsync(struct file *file, loff_t start, loff_t end,
652+
bool datasync)
653+
{
654+
struct inode *inode = file->f_mapping->host;
655+
int ret;
656+
657+
ret = generic_buffers_fsync_noflush(file, start, end, datasync);
658+
if (!ret)
659+
ret = blkdev_issue_flush(inode->i_sb->s_bdev);
660+
return ret;
661+
}
662+
EXPORT_SYMBOL(generic_buffers_fsync);
663+
594664
/*
595665
* Called when we've recently written block `bblock', and it is known that
596666
* `bblock' was for a buffer_boundary() buffer. This means that the block at

fs/ext2/Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
obj-$(CONFIG_EXT2_FS) += ext2.o
77

88
ext2-y := balloc.o dir.o file.o ialloc.o inode.o \
9-
ioctl.o namei.o super.o symlink.o
9+
ioctl.o namei.o super.o symlink.o trace.o
10+
11+
# For tracepoints to include our trace.h from tracepoint infrastructure
12+
CFLAGS_trace.o := -I$(src)
1013

1114
ext2-$(CONFIG_EXT2_FS_XATTR) += xattr.o xattr_user.o xattr_trusted.o
1215
ext2-$(CONFIG_EXT2_FS_POSIX_ACL) += acl.o

0 commit comments

Comments
 (0)