The patch titled direct-io-sync-and-invalidate-file-region-when-falling-back-to-buffered-write-fixes has been removed from the -mm tree. Its filename is direct-io-sync-and-invalidate-file-region-when-falling-back-to-buffered-write-fixes.patch This patch was dropped because it was folded into direct-io-sync-and-invalidate-file-region-when-falling-back-to-buffered-write.patch ------------------------------------------------------ Subject: direct-io-sync-and-invalidate-file-region-when-falling-back-to-buffered-write-fixes From: Andrew Morton <akpm@xxxxxxxx> - coding style (multiple declarations and multiple assignments) - `endbyte' should be loff_t, not pgoff_t. - sync the region (pos, pos+written), not (pos, pos+count). - attempt to return the correct value from __generic_file_aio_write_nolock in all circumstances. - Avoid testing the O_DIRECT flag twice - just call generic_file_buffered_write() from two sites. Simpler and cleaner that way. Cc: Jeff Moyer <jmoyer@xxxxxxxxxx> Cc: Zach Brown <zach.brown@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- mm/filemap.c | 48 +++++++++++++++++++++++++++--------------------- 1 files changed, 27 insertions(+), 21 deletions(-) diff -puN mm/filemap.c~direct-io-sync-and-invalidate-file-region-when-falling-back-to-buffered-write-fixes mm/filemap.c --- a/mm/filemap.c~direct-io-sync-and-invalidate-file-region-when-falling-back-to-buffered-write-fixes +++ a/mm/filemap.c @@ -2228,7 +2228,7 @@ __generic_file_aio_write_nolock(struct k struct inode *inode = mapping->host; unsigned long seg; loff_t pos; - ssize_t written, written_direct; + ssize_t written; ssize_t err; ocount = 0; @@ -2258,7 +2258,7 @@ __generic_file_aio_write_nolock(struct k /* We can write back this queue in page reclaim */ current->backing_dev_info = mapping->backing_dev_info; - written = written_direct = 0; + written = 0; err = generic_write_checks(file, &pos, &count, S_ISBLK(inode->i_mode)); if (err) @@ -2275,8 +2275,11 @@ __generic_file_aio_write_nolock(struct k /* coalesce the iovecs and go direct-to-BIO for O_DIRECT */ if (unlikely(file->f_flags & O_DIRECT)) { - written = generic_file_direct_write(iocb, iov, - &nr_segs, pos, ppos, count, ocount); + loff_t endbyte; + ssize_t written_buffered; + + written = generic_file_direct_write(iocb, iov, &nr_segs, pos, + ppos, count, ocount); if (written < 0 || written == count) goto out; /* @@ -2285,31 +2288,34 @@ __generic_file_aio_write_nolock(struct k */ pos += written; count -= written; + written_buffered = generic_file_buffered_write(iocb, iov, + nr_segs, pos, ppos, count, + written); - written_direct = written; - } - - written = generic_file_buffered_write(iocb, iov, nr_segs, - pos, ppos, count, written); - - /* - * When falling through to buffered I/O, we need to ensure that the - * page cache pages are written to disk and invalidated to preserve - * the expected O_DIRECT semantics. - */ - if (unlikely(file->f_flags & O_DIRECT)) { - pgoff_t endbyte = pos + count - 1; - + /* + * We need to ensure that the page cache pages are written to + * disk and invalidated to preserve the expected O_DIRECT + * semantics. + */ + endbyte = pos + written_buffered - 1; err = do_sync_file_range(file, pos, endbyte, SYNC_FILE_RANGE_WAIT_BEFORE| SYNC_FILE_RANGE_WRITE| SYNC_FILE_RANGE_WAIT_AFTER); - if (err == 0) + if (err == 0) { + written += written_buffered; invalidate_mapping_pages(mapping, pos >> PAGE_CACHE_SHIFT, endbyte >> PAGE_CACHE_SHIFT); - else - written = written_direct; + } else { + /* + * We don't know how much we wrote, so just return + * the number of bytes which were direct-written + */ + } + } else { + written = generic_file_buffered_write(iocb, iov, nr_segs, + pos, ppos, count, written); } out: current->backing_dev_info = NULL; _ Patches currently in -mm which might be from akpm@xxxxxxxx are origin.patch revert-nvidiafb-use-generic-ddc-reading.patch ext4_blk_type_from_sector_t_to_ulonglong.patch ext4-uninline-ext4_get_group_no_and_offset.patch ext4-64-bit-divide-fix.patch ext4-rename-logic_sb_block.patch ext4-whitespace-cleanups.patch direct-io-sync-and-invalidate-file-region-when-falling-back-to-buffered-write.patch direct-io-sync-and-invalidate-file-region-when-falling-back-to-buffered-write-fixes.patch get-rid-of-zone_table.patch new-scheme-to-preempt-swap-token-tidy.patch radix-tree-rcu-lockless-readside.patch acx1xx-wireless-driver.patch swsusp-add-resume_offset-command-line-parameter-rev-2.patch deprecate-smbfs-in-favour-of-cifs.patch edac-new-opteron-athlon64-memory-controller-driver.patch add-address_space_operationsbatch_write.patch add-config_headers_check-option-to-automatically-run-make-headers_check-nobble.patch kbuild-dont-put-temp-files-in-the-source-tree.patch grow_buffers-infinite-loop-fix.patch invalidate_inode_pages2_range-debug.patch lockdep-annotate-nfs-nfsd-in-kernel-sockets-tidy.patch dell_rbu-printk-warning-fix.patch generic-implementatation-of-bug.patch generic-implementatation-of-bug-fix.patch generic-bug-for-i386.patch generic-bug-for-x86-64.patch log2-implement-a-general-integer-log2-facility-in-the-kernel-fix.patch fs-cache-provide-a-filesystem-specific-syncable-page-bit-ext4.patch fs-cache-make-kafs-use-fs-cache-fix.patch fs-cache-make-kafs-use-fs-cache-vs-streamline-generic_file_-interfaces-and-filemap.patch nfs-use-local-caching-12-fix.patch fs-cache-cachefiles-a-cache-that-backs-onto-a-mounted-filesystem-log2-fix.patch swap_prefetch-vs-zoned-counters.patch readahead-sysctl-parameters.patch make-copy_from_user_inatomic-not-zero-the-tail-on-i386-vs-reiser4.patch make-kmem_cache_destroy-return-void-reiser4.patch reiser4-hardirq-include-fix.patch reiser4-run-truncate_inode_pages-in-reiser4_delete_inode.patch reiser4-get_sb_dev-fix.patch reiser4-vs-zoned-allocator.patch reiser4-rename-generic_sounding_globalspatch-fix.patch hpt3xx-rework-rate-filtering-tidy.patch gtod-persistent-clock-support-i386.patch hrtimers-state-tracking.patch clockevents-drivers-for-i386.patch kevent-core-files-fix.patch kevent-core-files-s390-hack.patch kevent-socket-notifications-fix-2.patch kevent-socket-notifications-fix-4.patch kevent-timer-notifications-fix.patch nr_blockdev_pages-in_interrupt-warning.patch device-suspend-debug.patch slab-leaks3-default-y.patch x86-kmap_atomic-debugging.patch restore-rogue-readahead-printk.patch put_bh-debug.patch acpi_format_exception-debug.patch jmicron-warning-fix.patch squash-ipc-warnings.patch squash-udf-warnings.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html