Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jlbec/ocfs2

* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jlbec/ocfs2:
ocfs2: Handle O_DIRECT when writing to a refcounted cluster.

+15 -6
+15 -6
fs/ocfs2/file.c
··· 1772 1772 loff_t *ppos, 1773 1773 size_t count, 1774 1774 int appending, 1775 - int *direct_io) 1775 + int *direct_io, 1776 + int *has_refcount) 1776 1777 { 1777 1778 int ret = 0, meta_level = 0; 1778 1779 struct inode *inode = dentry->d_inode; ··· 1834 1833 saved_pos, 1835 1834 count, 1836 1835 &meta_level); 1836 + if (has_refcount) 1837 + *has_refcount = 1; 1837 1838 } 1838 1839 1839 1840 if (ret < 0) { ··· 1859 1856 break; 1860 1857 } 1861 1858 1859 + if (has_refcount && *has_refcount == 1) { 1860 + *direct_io = 0; 1861 + break; 1862 + } 1862 1863 /* 1863 1864 * Allowing concurrent direct writes means 1864 1865 * i_size changes wouldn't be synchronized, so ··· 1906 1899 loff_t pos) 1907 1900 { 1908 1901 int ret, direct_io, appending, rw_level, have_alloc_sem = 0; 1909 - int can_do_direct; 1902 + int can_do_direct, has_refcount = 0; 1910 1903 ssize_t written = 0; 1911 1904 size_t ocount; /* original count */ 1912 1905 size_t count; /* after file limit checks */ ··· 1949 1942 can_do_direct = direct_io; 1950 1943 ret = ocfs2_prepare_inode_for_write(file->f_path.dentry, ppos, 1951 1944 iocb->ki_left, appending, 1952 - &can_do_direct); 1945 + &can_do_direct, &has_refcount); 1953 1946 if (ret < 0) { 1954 1947 mlog_errno(ret); 1955 1948 goto out; ··· 2013 2006 /* buffered aio wouldn't have proper lock coverage today */ 2014 2007 BUG_ON(ret == -EIOCBQUEUED && !(file->f_flags & O_DIRECT)); 2015 2008 2016 - if ((file->f_flags & O_DSYNC && !direct_io) || IS_SYNC(inode)) { 2009 + if ((file->f_flags & O_DSYNC && !direct_io) || IS_SYNC(inode) || 2010 + (file->f_flags & O_DIRECT && has_refcount)) { 2017 2011 ret = filemap_fdatawrite_range(file->f_mapping, pos, 2018 2012 pos + count - 1); 2019 2013 if (ret < 0) 2020 2014 written = ret; 2021 2015 2022 2016 if (!ret && (old_size != i_size_read(inode) || 2023 - old_clusters != OCFS2_I(inode)->ip_clusters)) { 2017 + old_clusters != OCFS2_I(inode)->ip_clusters || 2018 + has_refcount)) { 2024 2019 ret = jbd2_journal_force_commit(osb->journal->j_journal); 2025 2020 if (ret < 0) 2026 2021 written = ret; ··· 2071 2062 int ret; 2072 2063 2073 2064 ret = ocfs2_prepare_inode_for_write(out->f_path.dentry, &sd->pos, 2074 - sd->total_len, 0, NULL); 2065 + sd->total_len, 0, NULL, NULL); 2075 2066 if (ret < 0) { 2076 2067 mlog_errno(ret); 2077 2068 return ret;