diff options
author | Mark Fasheh <mark.fasheh@oracle.com> | 2007-10-18 18:23:46 -0400 |
---|---|---|
committer | Mark Fasheh <mark.fasheh@oracle.com> | 2008-01-25 17:45:57 -0500 |
commit | c934a92d05b549dd2f25db72c5fc3cb9dcf1b611 (patch) | |
tree | 57150c87d1d465db28fceaa14c9d5b220c7a3954 /fs/ocfs2/aops.c | |
parent | f1f540688eae66c274ff1c1133b5d9c687b28f58 (diff) |
ocfs2: Remove data locks
The meta lock now covers both meta data and data, so this just removes the
now-redundant data lock.
Combining locks saves us a round of lock mastery per inode and one less lock
to ping between nodes during read/write.
We don't lose much - since meta locks were always held before a data lock
(and at the same level) ordered writeout mode (the default) ensured that
flushing for the meta data lock also pushed out data anyways.
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs/ocfs2/aops.c')
-rw-r--r-- | fs/ocfs2/aops.c | 44 |
1 files changed, 2 insertions, 42 deletions
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c index 56f7790cad46..5fc27cfaee50 100644 --- a/fs/ocfs2/aops.c +++ b/fs/ocfs2/aops.c | |||
@@ -305,21 +305,12 @@ static int ocfs2_readpage(struct file *file, struct page *page) | |||
305 | goto out_alloc; | 305 | goto out_alloc; |
306 | } | 306 | } |
307 | 307 | ||
308 | ret = ocfs2_data_lock_with_page(inode, 0, page); | ||
309 | if (ret != 0) { | ||
310 | if (ret == AOP_TRUNCATED_PAGE) | ||
311 | unlock = 0; | ||
312 | mlog_errno(ret); | ||
313 | goto out_alloc; | ||
314 | } | ||
315 | |||
316 | if (oi->ip_dyn_features & OCFS2_INLINE_DATA_FL) | 308 | if (oi->ip_dyn_features & OCFS2_INLINE_DATA_FL) |
317 | ret = ocfs2_readpage_inline(inode, page); | 309 | ret = ocfs2_readpage_inline(inode, page); |
318 | else | 310 | else |
319 | ret = block_read_full_page(page, ocfs2_get_block); | 311 | ret = block_read_full_page(page, ocfs2_get_block); |
320 | unlock = 0; | 312 | unlock = 0; |
321 | 313 | ||
322 | ocfs2_data_unlock(inode, 0); | ||
323 | out_alloc: | 314 | out_alloc: |
324 | up_read(&OCFS2_I(inode)->ip_alloc_sem); | 315 | up_read(&OCFS2_I(inode)->ip_alloc_sem); |
325 | out_meta_unlock: | 316 | out_meta_unlock: |
@@ -638,34 +629,12 @@ static ssize_t ocfs2_direct_IO(int rw, | |||
638 | if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) | 629 | if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) |
639 | return 0; | 630 | return 0; |
640 | 631 | ||
641 | if (!ocfs2_sparse_alloc(OCFS2_SB(inode->i_sb))) { | ||
642 | /* | ||
643 | * We get PR data locks even for O_DIRECT. This | ||
644 | * allows concurrent O_DIRECT I/O but doesn't let | ||
645 | * O_DIRECT with extending and buffered zeroing writes | ||
646 | * race. If they did race then the buffered zeroing | ||
647 | * could be written back after the O_DIRECT I/O. It's | ||
648 | * one thing to tell people not to mix buffered and | ||
649 | * O_DIRECT writes, but expecting them to understand | ||
650 | * that file extension is also an implicit buffered | ||
651 | * write is too much. By getting the PR we force | ||
652 | * writeback of the buffered zeroing before | ||
653 | * proceeding. | ||
654 | */ | ||
655 | ret = ocfs2_data_lock(inode, 0); | ||
656 | if (ret < 0) { | ||
657 | mlog_errno(ret); | ||
658 | goto out; | ||
659 | } | ||
660 | ocfs2_data_unlock(inode, 0); | ||
661 | } | ||
662 | |||
663 | ret = blockdev_direct_IO_no_locking(rw, iocb, inode, | 632 | ret = blockdev_direct_IO_no_locking(rw, iocb, inode, |
664 | inode->i_sb->s_bdev, iov, offset, | 633 | inode->i_sb->s_bdev, iov, offset, |
665 | nr_segs, | 634 | nr_segs, |
666 | ocfs2_direct_IO_get_blocks, | 635 | ocfs2_direct_IO_get_blocks, |
667 | ocfs2_dio_end_io); | 636 | ocfs2_dio_end_io); |
668 | out: | 637 | |
669 | mlog_exit(ret); | 638 | mlog_exit(ret); |
670 | return ret; | 639 | return ret; |
671 | } | 640 | } |
@@ -1769,25 +1738,17 @@ static int ocfs2_write_begin(struct file *file, struct address_space *mapping, | |||
1769 | */ | 1738 | */ |
1770 | down_write(&OCFS2_I(inode)->ip_alloc_sem); | 1739 | down_write(&OCFS2_I(inode)->ip_alloc_sem); |
1771 | 1740 | ||
1772 | ret = ocfs2_data_lock(inode, 1); | ||
1773 | if (ret) { | ||
1774 | mlog_errno(ret); | ||
1775 | goto out_fail; | ||
1776 | } | ||
1777 | |||
1778 | ret = ocfs2_write_begin_nolock(mapping, pos, len, flags, pagep, | 1741 | ret = ocfs2_write_begin_nolock(mapping, pos, len, flags, pagep, |
1779 | fsdata, di_bh, NULL); | 1742 | fsdata, di_bh, NULL); |
1780 | if (ret) { | 1743 | if (ret) { |
1781 | mlog_errno(ret); | 1744 | mlog_errno(ret); |
1782 | goto out_fail_data; | 1745 | goto out_fail; |
1783 | } | 1746 | } |
1784 | 1747 | ||
1785 | brelse(di_bh); | 1748 | brelse(di_bh); |
1786 | 1749 | ||
1787 | return 0; | 1750 | return 0; |
1788 | 1751 | ||
1789 | out_fail_data: | ||
1790 | ocfs2_data_unlock(inode, 1); | ||
1791 | out_fail: | 1752 | out_fail: |
1792 | up_write(&OCFS2_I(inode)->ip_alloc_sem); | 1753 | up_write(&OCFS2_I(inode)->ip_alloc_sem); |
1793 | 1754 | ||
@@ -1908,7 +1869,6 @@ static int ocfs2_write_end(struct file *file, struct address_space *mapping, | |||
1908 | 1869 | ||
1909 | ret = ocfs2_write_end_nolock(mapping, pos, len, copied, page, fsdata); | 1870 | ret = ocfs2_write_end_nolock(mapping, pos, len, copied, page, fsdata); |
1910 | 1871 | ||
1911 | ocfs2_data_unlock(inode, 1); | ||
1912 | up_write(&OCFS2_I(inode)->ip_alloc_sem); | 1872 | up_write(&OCFS2_I(inode)->ip_alloc_sem); |
1913 | ocfs2_meta_unlock(inode, 1); | 1873 | ocfs2_meta_unlock(inode, 1); |
1914 | 1874 | ||