diff options
author | Sage Weil <sage@inktank.com> | 2013-08-15 14:11:45 -0400 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-08-15 14:11:45 -0400 |
commit | ee3e542fec6e69bc9fb668698889a37d93950ddf (patch) | |
tree | e74ee766a4764769ef1d3d45d266b4dea64101d3 /fs/ocfs2 | |
parent | fe2a801b50c0bb8039d627e5ae1fec249d10ff39 (diff) | |
parent | f1d6e17f540af37bb1891480143669ba7636c4cf (diff) |
Merge remote-tracking branch 'linus/master' into testing
Diffstat (limited to 'fs/ocfs2')
-rw-r--r-- | fs/ocfs2/alloc.c | 8 | ||||
-rw-r--r-- | fs/ocfs2/aops.c | 7 | ||||
-rw-r--r-- | fs/ocfs2/cluster/heartbeat.c | 19 | ||||
-rw-r--r-- | fs/ocfs2/cluster/quorum.c | 2 | ||||
-rw-r--r-- | fs/ocfs2/cluster/tcp.c | 29 | ||||
-rw-r--r-- | fs/ocfs2/dir.c | 153 | ||||
-rw-r--r-- | fs/ocfs2/dir.h | 5 | ||||
-rw-r--r-- | fs/ocfs2/dlm/dlmlock.c | 1 | ||||
-rw-r--r-- | fs/ocfs2/dlm/dlmrecovery.c | 7 | ||||
-rw-r--r-- | fs/ocfs2/file.c | 22 | ||||
-rw-r--r-- | fs/ocfs2/journal.c | 14 | ||||
-rw-r--r-- | fs/ocfs2/journal.h | 1 | ||||
-rw-r--r-- | fs/ocfs2/move_extents.c | 2 | ||||
-rw-r--r-- | fs/ocfs2/namei.c | 70 | ||||
-rw-r--r-- | fs/ocfs2/ocfs2.h | 1 | ||||
-rw-r--r-- | fs/ocfs2/refcounttree.c | 58 | ||||
-rw-r--r-- | fs/ocfs2/refcounttree.h | 6 | ||||
-rw-r--r-- | fs/ocfs2/suballoc.c | 37 | ||||
-rw-r--r-- | fs/ocfs2/super.c | 6 | ||||
-rw-r--r-- | fs/ocfs2/xattr.c | 18 |
20 files changed, 189 insertions, 277 deletions
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index b8a9d87231b1..17e6bdde96c5 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c | |||
@@ -5655,7 +5655,7 @@ int ocfs2_remove_btree_range(struct inode *inode, | |||
5655 | &ref_tree, NULL); | 5655 | &ref_tree, NULL); |
5656 | if (ret) { | 5656 | if (ret) { |
5657 | mlog_errno(ret); | 5657 | mlog_errno(ret); |
5658 | goto out; | 5658 | goto bail; |
5659 | } | 5659 | } |
5660 | 5660 | ||
5661 | ret = ocfs2_prepare_refcount_change_for_del(inode, | 5661 | ret = ocfs2_prepare_refcount_change_for_del(inode, |
@@ -5666,7 +5666,7 @@ int ocfs2_remove_btree_range(struct inode *inode, | |||
5666 | &extra_blocks); | 5666 | &extra_blocks); |
5667 | if (ret < 0) { | 5667 | if (ret < 0) { |
5668 | mlog_errno(ret); | 5668 | mlog_errno(ret); |
5669 | goto out; | 5669 | goto bail; |
5670 | } | 5670 | } |
5671 | } | 5671 | } |
5672 | 5672 | ||
@@ -5674,7 +5674,7 @@ int ocfs2_remove_btree_range(struct inode *inode, | |||
5674 | extra_blocks); | 5674 | extra_blocks); |
5675 | if (ret) { | 5675 | if (ret) { |
5676 | mlog_errno(ret); | 5676 | mlog_errno(ret); |
5677 | return ret; | 5677 | goto bail; |
5678 | } | 5678 | } |
5679 | 5679 | ||
5680 | mutex_lock(&tl_inode->i_mutex); | 5680 | mutex_lock(&tl_inode->i_mutex); |
@@ -5734,7 +5734,7 @@ out_commit: | |||
5734 | ocfs2_commit_trans(osb, handle); | 5734 | ocfs2_commit_trans(osb, handle); |
5735 | out: | 5735 | out: |
5736 | mutex_unlock(&tl_inode->i_mutex); | 5736 | mutex_unlock(&tl_inode->i_mutex); |
5737 | 5737 | bail: | |
5738 | if (meta_ac) | 5738 | if (meta_ac) |
5739 | ocfs2_free_alloc_context(meta_ac); | 5739 | ocfs2_free_alloc_context(meta_ac); |
5740 | 5740 | ||
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c index 20dfec72e903..2abf97b2a592 100644 --- a/fs/ocfs2/aops.c +++ b/fs/ocfs2/aops.c | |||
@@ -603,11 +603,12 @@ static void ocfs2_dio_end_io(struct kiocb *iocb, | |||
603 | * from ext3. PageChecked() bits have been removed as OCFS2 does not | 603 | * from ext3. PageChecked() bits have been removed as OCFS2 does not |
604 | * do journalled data. | 604 | * do journalled data. |
605 | */ | 605 | */ |
606 | static void ocfs2_invalidatepage(struct page *page, unsigned long offset) | 606 | static void ocfs2_invalidatepage(struct page *page, unsigned int offset, |
607 | unsigned int length) | ||
607 | { | 608 | { |
608 | journal_t *journal = OCFS2_SB(page->mapping->host->i_sb)->journal->j_journal; | 609 | journal_t *journal = OCFS2_SB(page->mapping->host->i_sb)->journal->j_journal; |
609 | 610 | ||
610 | jbd2_journal_invalidatepage(journal, page, offset); | 611 | jbd2_journal_invalidatepage(journal, page, offset, length); |
611 | } | 612 | } |
612 | 613 | ||
613 | static int ocfs2_releasepage(struct page *page, gfp_t wait) | 614 | static int ocfs2_releasepage(struct page *page, gfp_t wait) |
@@ -1756,7 +1757,7 @@ try_again: | |||
1756 | goto out; | 1757 | goto out; |
1757 | } else if (ret == 1) { | 1758 | } else if (ret == 1) { |
1758 | clusters_need = wc->w_clen; | 1759 | clusters_need = wc->w_clen; |
1759 | ret = ocfs2_refcount_cow(inode, filp, di_bh, | 1760 | ret = ocfs2_refcount_cow(inode, di_bh, |
1760 | wc->w_cpos, wc->w_clen, UINT_MAX); | 1761 | wc->w_cpos, wc->w_clen, UINT_MAX); |
1761 | if (ret) { | 1762 | if (ret) { |
1762 | mlog_errno(ret); | 1763 | mlog_errno(ret); |
diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c index 42252bf64b51..5c1c864e81cc 100644 --- a/fs/ocfs2/cluster/heartbeat.c +++ b/fs/ocfs2/cluster/heartbeat.c | |||
@@ -176,7 +176,7 @@ static void o2hb_dead_threshold_set(unsigned int threshold) | |||
176 | } | 176 | } |
177 | } | 177 | } |
178 | 178 | ||
179 | static int o2hb_global_hearbeat_mode_set(unsigned int hb_mode) | 179 | static int o2hb_global_heartbeat_mode_set(unsigned int hb_mode) |
180 | { | 180 | { |
181 | int ret = -1; | 181 | int ret = -1; |
182 | 182 | ||
@@ -500,7 +500,7 @@ static int o2hb_issue_node_write(struct o2hb_region *reg, | |||
500 | } | 500 | } |
501 | 501 | ||
502 | atomic_inc(&write_wc->wc_num_reqs); | 502 | atomic_inc(&write_wc->wc_num_reqs); |
503 | submit_bio(WRITE, bio); | 503 | submit_bio(WRITE_SYNC, bio); |
504 | 504 | ||
505 | status = 0; | 505 | status = 0; |
506 | bail: | 506 | bail: |
@@ -2271,7 +2271,7 @@ ssize_t o2hb_heartbeat_group_mode_store(struct o2hb_heartbeat_group *group, | |||
2271 | if (strnicmp(page, o2hb_heartbeat_mode_desc[i], len)) | 2271 | if (strnicmp(page, o2hb_heartbeat_mode_desc[i], len)) |
2272 | continue; | 2272 | continue; |
2273 | 2273 | ||
2274 | ret = o2hb_global_hearbeat_mode_set(i); | 2274 | ret = o2hb_global_heartbeat_mode_set(i); |
2275 | if (!ret) | 2275 | if (!ret) |
2276 | printk(KERN_NOTICE "o2hb: Heartbeat mode set to %s\n", | 2276 | printk(KERN_NOTICE "o2hb: Heartbeat mode set to %s\n", |
2277 | o2hb_heartbeat_mode_desc[i]); | 2277 | o2hb_heartbeat_mode_desc[i]); |
@@ -2304,7 +2304,7 @@ static struct configfs_attribute *o2hb_heartbeat_group_attrs[] = { | |||
2304 | NULL, | 2304 | NULL, |
2305 | }; | 2305 | }; |
2306 | 2306 | ||
2307 | static struct configfs_item_operations o2hb_hearbeat_group_item_ops = { | 2307 | static struct configfs_item_operations o2hb_heartbeat_group_item_ops = { |
2308 | .show_attribute = o2hb_heartbeat_group_show, | 2308 | .show_attribute = o2hb_heartbeat_group_show, |
2309 | .store_attribute = o2hb_heartbeat_group_store, | 2309 | .store_attribute = o2hb_heartbeat_group_store, |
2310 | }; | 2310 | }; |
@@ -2316,7 +2316,7 @@ static struct configfs_group_operations o2hb_heartbeat_group_group_ops = { | |||
2316 | 2316 | ||
2317 | static struct config_item_type o2hb_heartbeat_group_type = { | 2317 | static struct config_item_type o2hb_heartbeat_group_type = { |
2318 | .ct_group_ops = &o2hb_heartbeat_group_group_ops, | 2318 | .ct_group_ops = &o2hb_heartbeat_group_group_ops, |
2319 | .ct_item_ops = &o2hb_hearbeat_group_item_ops, | 2319 | .ct_item_ops = &o2hb_heartbeat_group_item_ops, |
2320 | .ct_attrs = o2hb_heartbeat_group_attrs, | 2320 | .ct_attrs = o2hb_heartbeat_group_attrs, |
2321 | .ct_owner = THIS_MODULE, | 2321 | .ct_owner = THIS_MODULE, |
2322 | }; | 2322 | }; |
@@ -2389,6 +2389,9 @@ static int o2hb_region_pin(const char *region_uuid) | |||
2389 | assert_spin_locked(&o2hb_live_lock); | 2389 | assert_spin_locked(&o2hb_live_lock); |
2390 | 2390 | ||
2391 | list_for_each_entry(reg, &o2hb_all_regions, hr_all_item) { | 2391 | list_for_each_entry(reg, &o2hb_all_regions, hr_all_item) { |
2392 | if (reg->hr_item_dropped) | ||
2393 | continue; | ||
2394 | |||
2392 | uuid = config_item_name(®->hr_item); | 2395 | uuid = config_item_name(®->hr_item); |
2393 | 2396 | ||
2394 | /* local heartbeat */ | 2397 | /* local heartbeat */ |
@@ -2439,6 +2442,9 @@ static void o2hb_region_unpin(const char *region_uuid) | |||
2439 | assert_spin_locked(&o2hb_live_lock); | 2442 | assert_spin_locked(&o2hb_live_lock); |
2440 | 2443 | ||
2441 | list_for_each_entry(reg, &o2hb_all_regions, hr_all_item) { | 2444 | list_for_each_entry(reg, &o2hb_all_regions, hr_all_item) { |
2445 | if (reg->hr_item_dropped) | ||
2446 | continue; | ||
2447 | |||
2442 | uuid = config_item_name(®->hr_item); | 2448 | uuid = config_item_name(®->hr_item); |
2443 | if (region_uuid) { | 2449 | if (region_uuid) { |
2444 | if (strcmp(region_uuid, uuid)) | 2450 | if (strcmp(region_uuid, uuid)) |
@@ -2654,6 +2660,9 @@ int o2hb_get_all_regions(char *region_uuids, u8 max_regions) | |||
2654 | 2660 | ||
2655 | p = region_uuids; | 2661 | p = region_uuids; |
2656 | list_for_each_entry(reg, &o2hb_all_regions, hr_all_item) { | 2662 | list_for_each_entry(reg, &o2hb_all_regions, hr_all_item) { |
2663 | if (reg->hr_item_dropped) | ||
2664 | continue; | ||
2665 | |||
2657 | mlog(0, "Region: %s\n", config_item_name(®->hr_item)); | 2666 | mlog(0, "Region: %s\n", config_item_name(®->hr_item)); |
2658 | if (numregs < max_regions) { | 2667 | if (numregs < max_regions) { |
2659 | memcpy(p, config_item_name(®->hr_item), | 2668 | memcpy(p, config_item_name(®->hr_item), |
diff --git a/fs/ocfs2/cluster/quorum.c b/fs/ocfs2/cluster/quorum.c index c19897d0fe14..1ec141e758d7 100644 --- a/fs/ocfs2/cluster/quorum.c +++ b/fs/ocfs2/cluster/quorum.c | |||
@@ -264,7 +264,7 @@ void o2quo_hb_still_up(u8 node) | |||
264 | /* This is analogous to hb_up. as a node's connection comes up we delay the | 264 | /* This is analogous to hb_up. as a node's connection comes up we delay the |
265 | * quorum decision until we see it heartbeating. the hold will be droped in | 265 | * quorum decision until we see it heartbeating. the hold will be droped in |
266 | * hb_up or hb_down. it might be perpetuated by con_err until hb_down. if | 266 | * hb_up or hb_down. it might be perpetuated by con_err until hb_down. if |
267 | * it's already heartbeating we we might be dropping a hold that conn_up got. | 267 | * it's already heartbeating we might be dropping a hold that conn_up got. |
268 | * */ | 268 | * */ |
269 | void o2quo_conn_up(u8 node) | 269 | void o2quo_conn_up(u8 node) |
270 | { | 270 | { |
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c index aa88bd8bcedc..d644dc611425 100644 --- a/fs/ocfs2/cluster/tcp.c +++ b/fs/ocfs2/cluster/tcp.c | |||
@@ -406,6 +406,9 @@ static void sc_kref_release(struct kref *kref) | |||
406 | sc->sc_node = NULL; | 406 | sc->sc_node = NULL; |
407 | 407 | ||
408 | o2net_debug_del_sc(sc); | 408 | o2net_debug_del_sc(sc); |
409 | |||
410 | if (sc->sc_page) | ||
411 | __free_page(sc->sc_page); | ||
409 | kfree(sc); | 412 | kfree(sc); |
410 | } | 413 | } |
411 | 414 | ||
@@ -630,19 +633,19 @@ static void o2net_state_change(struct sock *sk) | |||
630 | state_change = sc->sc_state_change; | 633 | state_change = sc->sc_state_change; |
631 | 634 | ||
632 | switch(sk->sk_state) { | 635 | switch(sk->sk_state) { |
633 | /* ignore connecting sockets as they make progress */ | 636 | /* ignore connecting sockets as they make progress */ |
634 | case TCP_SYN_SENT: | 637 | case TCP_SYN_SENT: |
635 | case TCP_SYN_RECV: | 638 | case TCP_SYN_RECV: |
636 | break; | 639 | break; |
637 | case TCP_ESTABLISHED: | 640 | case TCP_ESTABLISHED: |
638 | o2net_sc_queue_work(sc, &sc->sc_connect_work); | 641 | o2net_sc_queue_work(sc, &sc->sc_connect_work); |
639 | break; | 642 | break; |
640 | default: | 643 | default: |
641 | printk(KERN_INFO "o2net: Connection to " SC_NODEF_FMT | 644 | printk(KERN_INFO "o2net: Connection to " SC_NODEF_FMT |
642 | " shutdown, state %d\n", | 645 | " shutdown, state %d\n", |
643 | SC_NODEF_ARGS(sc), sk->sk_state); | 646 | SC_NODEF_ARGS(sc), sk->sk_state); |
644 | o2net_sc_queue_work(sc, &sc->sc_shutdown_work); | 647 | o2net_sc_queue_work(sc, &sc->sc_shutdown_work); |
645 | break; | 648 | break; |
646 | } | 649 | } |
647 | out: | 650 | out: |
648 | read_unlock(&sk->sk_callback_lock); | 651 | read_unlock(&sk->sk_callback_lock); |
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c index f1e1aed8f638..30544ce8e9f7 100644 --- a/fs/ocfs2/dir.c +++ b/fs/ocfs2/dir.c | |||
@@ -1761,11 +1761,10 @@ bail: | |||
1761 | 1761 | ||
1762 | static int ocfs2_dir_foreach_blk_id(struct inode *inode, | 1762 | static int ocfs2_dir_foreach_blk_id(struct inode *inode, |
1763 | u64 *f_version, | 1763 | u64 *f_version, |
1764 | loff_t *f_pos, void *priv, | 1764 | struct dir_context *ctx) |
1765 | filldir_t filldir, int *filldir_err) | ||
1766 | { | 1765 | { |
1767 | int ret, i, filldir_ret; | 1766 | int ret, i; |
1768 | unsigned long offset = *f_pos; | 1767 | unsigned long offset = ctx->pos; |
1769 | struct buffer_head *di_bh = NULL; | 1768 | struct buffer_head *di_bh = NULL; |
1770 | struct ocfs2_dinode *di; | 1769 | struct ocfs2_dinode *di; |
1771 | struct ocfs2_inline_data *data; | 1770 | struct ocfs2_inline_data *data; |
@@ -1781,8 +1780,7 @@ static int ocfs2_dir_foreach_blk_id(struct inode *inode, | |||
1781 | di = (struct ocfs2_dinode *)di_bh->b_data; | 1780 | di = (struct ocfs2_dinode *)di_bh->b_data; |
1782 | data = &di->id2.i_data; | 1781 | data = &di->id2.i_data; |
1783 | 1782 | ||
1784 | while (*f_pos < i_size_read(inode)) { | 1783 | while (ctx->pos < i_size_read(inode)) { |
1785 | revalidate: | ||
1786 | /* If the dir block has changed since the last call to | 1784 | /* If the dir block has changed since the last call to |
1787 | * readdir(2), then we might be pointing to an invalid | 1785 | * readdir(2), then we might be pointing to an invalid |
1788 | * dirent right now. Scan from the start of the block | 1786 | * dirent right now. Scan from the start of the block |
@@ -1802,50 +1800,31 @@ revalidate: | |||
1802 | break; | 1800 | break; |
1803 | i += le16_to_cpu(de->rec_len); | 1801 | i += le16_to_cpu(de->rec_len); |
1804 | } | 1802 | } |
1805 | *f_pos = offset = i; | 1803 | ctx->pos = offset = i; |
1806 | *f_version = inode->i_version; | 1804 | *f_version = inode->i_version; |
1807 | } | 1805 | } |
1808 | 1806 | ||
1809 | de = (struct ocfs2_dir_entry *) (data->id_data + *f_pos); | 1807 | de = (struct ocfs2_dir_entry *) (data->id_data + ctx->pos); |
1810 | if (!ocfs2_check_dir_entry(inode, de, di_bh, *f_pos)) { | 1808 | if (!ocfs2_check_dir_entry(inode, de, di_bh, ctx->pos)) { |
1811 | /* On error, skip the f_pos to the end. */ | 1809 | /* On error, skip the f_pos to the end. */ |
1812 | *f_pos = i_size_read(inode); | 1810 | ctx->pos = i_size_read(inode); |
1813 | goto out; | 1811 | break; |
1814 | } | 1812 | } |
1815 | offset += le16_to_cpu(de->rec_len); | 1813 | offset += le16_to_cpu(de->rec_len); |
1816 | if (le64_to_cpu(de->inode)) { | 1814 | if (le64_to_cpu(de->inode)) { |
1817 | /* We might block in the next section | ||
1818 | * if the data destination is | ||
1819 | * currently swapped out. So, use a | ||
1820 | * version stamp to detect whether or | ||
1821 | * not the directory has been modified | ||
1822 | * during the copy operation. | ||
1823 | */ | ||
1824 | u64 version = *f_version; | ||
1825 | unsigned char d_type = DT_UNKNOWN; | 1815 | unsigned char d_type = DT_UNKNOWN; |
1826 | 1816 | ||
1827 | if (de->file_type < OCFS2_FT_MAX) | 1817 | if (de->file_type < OCFS2_FT_MAX) |
1828 | d_type = ocfs2_filetype_table[de->file_type]; | 1818 | d_type = ocfs2_filetype_table[de->file_type]; |
1829 | 1819 | ||
1830 | filldir_ret = filldir(priv, de->name, | 1820 | if (!dir_emit(ctx, de->name, de->name_len, |
1831 | de->name_len, | 1821 | le64_to_cpu(de->inode), d_type)) |
1832 | *f_pos, | 1822 | goto out; |
1833 | le64_to_cpu(de->inode), | ||
1834 | d_type); | ||
1835 | if (filldir_ret) { | ||
1836 | if (filldir_err) | ||
1837 | *filldir_err = filldir_ret; | ||
1838 | break; | ||
1839 | } | ||
1840 | if (version != *f_version) | ||
1841 | goto revalidate; | ||
1842 | } | 1823 | } |
1843 | *f_pos += le16_to_cpu(de->rec_len); | 1824 | ctx->pos += le16_to_cpu(de->rec_len); |
1844 | } | 1825 | } |
1845 | |||
1846 | out: | 1826 | out: |
1847 | brelse(di_bh); | 1827 | brelse(di_bh); |
1848 | |||
1849 | return 0; | 1828 | return 0; |
1850 | } | 1829 | } |
1851 | 1830 | ||
@@ -1855,27 +1834,26 @@ out: | |||
1855 | */ | 1834 | */ |
1856 | static int ocfs2_dir_foreach_blk_el(struct inode *inode, | 1835 | static int ocfs2_dir_foreach_blk_el(struct inode *inode, |
1857 | u64 *f_version, | 1836 | u64 *f_version, |
1858 | loff_t *f_pos, void *priv, | 1837 | struct dir_context *ctx, |
1859 | filldir_t filldir, int *filldir_err) | 1838 | bool persist) |
1860 | { | 1839 | { |
1861 | int error = 0; | ||
1862 | unsigned long offset, blk, last_ra_blk = 0; | 1840 | unsigned long offset, blk, last_ra_blk = 0; |
1863 | int i, stored; | 1841 | int i; |
1864 | struct buffer_head * bh, * tmp; | 1842 | struct buffer_head * bh, * tmp; |
1865 | struct ocfs2_dir_entry * de; | 1843 | struct ocfs2_dir_entry * de; |
1866 | struct super_block * sb = inode->i_sb; | 1844 | struct super_block * sb = inode->i_sb; |
1867 | unsigned int ra_sectors = 16; | 1845 | unsigned int ra_sectors = 16; |
1846 | int stored = 0; | ||
1868 | 1847 | ||
1869 | stored = 0; | ||
1870 | bh = NULL; | 1848 | bh = NULL; |
1871 | 1849 | ||
1872 | offset = (*f_pos) & (sb->s_blocksize - 1); | 1850 | offset = ctx->pos & (sb->s_blocksize - 1); |
1873 | 1851 | ||
1874 | while (!error && !stored && *f_pos < i_size_read(inode)) { | 1852 | while (ctx->pos < i_size_read(inode)) { |
1875 | blk = (*f_pos) >> sb->s_blocksize_bits; | 1853 | blk = ctx->pos >> sb->s_blocksize_bits; |
1876 | if (ocfs2_read_dir_block(inode, blk, &bh, 0)) { | 1854 | if (ocfs2_read_dir_block(inode, blk, &bh, 0)) { |
1877 | /* Skip the corrupt dirblock and keep trying */ | 1855 | /* Skip the corrupt dirblock and keep trying */ |
1878 | *f_pos += sb->s_blocksize - offset; | 1856 | ctx->pos += sb->s_blocksize - offset; |
1879 | continue; | 1857 | continue; |
1880 | } | 1858 | } |
1881 | 1859 | ||
@@ -1897,7 +1875,6 @@ static int ocfs2_dir_foreach_blk_el(struct inode *inode, | |||
1897 | ra_sectors = 8; | 1875 | ra_sectors = 8; |
1898 | } | 1876 | } |
1899 | 1877 | ||
1900 | revalidate: | ||
1901 | /* If the dir block has changed since the last call to | 1878 | /* If the dir block has changed since the last call to |
1902 | * readdir(2), then we might be pointing to an invalid | 1879 | * readdir(2), then we might be pointing to an invalid |
1903 | * dirent right now. Scan from the start of the block | 1880 | * dirent right now. Scan from the start of the block |
@@ -1917,93 +1894,64 @@ revalidate: | |||
1917 | i += le16_to_cpu(de->rec_len); | 1894 | i += le16_to_cpu(de->rec_len); |
1918 | } | 1895 | } |
1919 | offset = i; | 1896 | offset = i; |
1920 | *f_pos = ((*f_pos) & ~(sb->s_blocksize - 1)) | 1897 | ctx->pos = (ctx->pos & ~(sb->s_blocksize - 1)) |
1921 | | offset; | 1898 | | offset; |
1922 | *f_version = inode->i_version; | 1899 | *f_version = inode->i_version; |
1923 | } | 1900 | } |
1924 | 1901 | ||
1925 | while (!error && *f_pos < i_size_read(inode) | 1902 | while (ctx->pos < i_size_read(inode) |
1926 | && offset < sb->s_blocksize) { | 1903 | && offset < sb->s_blocksize) { |
1927 | de = (struct ocfs2_dir_entry *) (bh->b_data + offset); | 1904 | de = (struct ocfs2_dir_entry *) (bh->b_data + offset); |
1928 | if (!ocfs2_check_dir_entry(inode, de, bh, offset)) { | 1905 | if (!ocfs2_check_dir_entry(inode, de, bh, offset)) { |
1929 | /* On error, skip the f_pos to the | 1906 | /* On error, skip the f_pos to the |
1930 | next block. */ | 1907 | next block. */ |
1931 | *f_pos = ((*f_pos) | (sb->s_blocksize - 1)) + 1; | 1908 | ctx->pos = (ctx->pos | (sb->s_blocksize - 1)) + 1; |
1932 | brelse(bh); | 1909 | brelse(bh); |
1933 | goto out; | 1910 | continue; |
1934 | } | 1911 | } |
1935 | offset += le16_to_cpu(de->rec_len); | ||
1936 | if (le64_to_cpu(de->inode)) { | 1912 | if (le64_to_cpu(de->inode)) { |
1937 | /* We might block in the next section | ||
1938 | * if the data destination is | ||
1939 | * currently swapped out. So, use a | ||
1940 | * version stamp to detect whether or | ||
1941 | * not the directory has been modified | ||
1942 | * during the copy operation. | ||
1943 | */ | ||
1944 | unsigned long version = *f_version; | ||
1945 | unsigned char d_type = DT_UNKNOWN; | 1913 | unsigned char d_type = DT_UNKNOWN; |
1946 | 1914 | ||
1947 | if (de->file_type < OCFS2_FT_MAX) | 1915 | if (de->file_type < OCFS2_FT_MAX) |
1948 | d_type = ocfs2_filetype_table[de->file_type]; | 1916 | d_type = ocfs2_filetype_table[de->file_type]; |
1949 | error = filldir(priv, de->name, | 1917 | if (!dir_emit(ctx, de->name, |
1950 | de->name_len, | 1918 | de->name_len, |
1951 | *f_pos, | ||
1952 | le64_to_cpu(de->inode), | 1919 | le64_to_cpu(de->inode), |
1953 | d_type); | 1920 | d_type)) { |
1954 | if (error) { | 1921 | brelse(bh); |
1955 | if (filldir_err) | 1922 | return 0; |
1956 | *filldir_err = error; | ||
1957 | break; | ||
1958 | } | 1923 | } |
1959 | if (version != *f_version) | 1924 | stored++; |
1960 | goto revalidate; | ||
1961 | stored ++; | ||
1962 | } | 1925 | } |
1963 | *f_pos += le16_to_cpu(de->rec_len); | 1926 | offset += le16_to_cpu(de->rec_len); |
1927 | ctx->pos += le16_to_cpu(de->rec_len); | ||
1964 | } | 1928 | } |
1965 | offset = 0; | 1929 | offset = 0; |
1966 | brelse(bh); | 1930 | brelse(bh); |
1967 | bh = NULL; | 1931 | bh = NULL; |
1932 | if (!persist && stored) | ||
1933 | break; | ||
1968 | } | 1934 | } |
1969 | 1935 | return 0; | |
1970 | stored = 0; | ||
1971 | out: | ||
1972 | return stored; | ||
1973 | } | 1936 | } |
1974 | 1937 | ||
1975 | static int ocfs2_dir_foreach_blk(struct inode *inode, u64 *f_version, | 1938 | static int ocfs2_dir_foreach_blk(struct inode *inode, u64 *f_version, |
1976 | loff_t *f_pos, void *priv, filldir_t filldir, | 1939 | struct dir_context *ctx, |
1977 | int *filldir_err) | 1940 | bool persist) |
1978 | { | 1941 | { |
1979 | if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) | 1942 | if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) |
1980 | return ocfs2_dir_foreach_blk_id(inode, f_version, f_pos, priv, | 1943 | return ocfs2_dir_foreach_blk_id(inode, f_version, ctx); |
1981 | filldir, filldir_err); | 1944 | return ocfs2_dir_foreach_blk_el(inode, f_version, ctx, persist); |
1982 | |||
1983 | return ocfs2_dir_foreach_blk_el(inode, f_version, f_pos, priv, filldir, | ||
1984 | filldir_err); | ||
1985 | } | 1945 | } |
1986 | 1946 | ||
1987 | /* | 1947 | /* |
1988 | * This is intended to be called from inside other kernel functions, | 1948 | * This is intended to be called from inside other kernel functions, |
1989 | * so we fake some arguments. | 1949 | * so we fake some arguments. |
1990 | */ | 1950 | */ |
1991 | int ocfs2_dir_foreach(struct inode *inode, loff_t *f_pos, void *priv, | 1951 | int ocfs2_dir_foreach(struct inode *inode, struct dir_context *ctx) |
1992 | filldir_t filldir) | ||
1993 | { | 1952 | { |
1994 | int ret = 0, filldir_err = 0; | ||
1995 | u64 version = inode->i_version; | 1953 | u64 version = inode->i_version; |
1996 | 1954 | ocfs2_dir_foreach_blk(inode, &version, ctx, true); | |
1997 | while (*f_pos < i_size_read(inode)) { | ||
1998 | ret = ocfs2_dir_foreach_blk(inode, &version, f_pos, priv, | ||
1999 | filldir, &filldir_err); | ||
2000 | if (ret || filldir_err) | ||
2001 | break; | ||
2002 | } | ||
2003 | |||
2004 | if (ret > 0) | ||
2005 | ret = -EIO; | ||
2006 | |||
2007 | return 0; | 1955 | return 0; |
2008 | } | 1956 | } |
2009 | 1957 | ||
@@ -2011,15 +1959,15 @@ int ocfs2_dir_foreach(struct inode *inode, loff_t *f_pos, void *priv, | |||
2011 | * ocfs2_readdir() | 1959 | * ocfs2_readdir() |
2012 | * | 1960 | * |
2013 | */ | 1961 | */ |
2014 | int ocfs2_readdir(struct file * filp, void * dirent, filldir_t filldir) | 1962 | int ocfs2_readdir(struct file *file, struct dir_context *ctx) |
2015 | { | 1963 | { |
2016 | int error = 0; | 1964 | int error = 0; |
2017 | struct inode *inode = file_inode(filp); | 1965 | struct inode *inode = file_inode(file); |
2018 | int lock_level = 0; | 1966 | int lock_level = 0; |
2019 | 1967 | ||
2020 | trace_ocfs2_readdir((unsigned long long)OCFS2_I(inode)->ip_blkno); | 1968 | trace_ocfs2_readdir((unsigned long long)OCFS2_I(inode)->ip_blkno); |
2021 | 1969 | ||
2022 | error = ocfs2_inode_lock_atime(inode, filp->f_path.mnt, &lock_level); | 1970 | error = ocfs2_inode_lock_atime(inode, file->f_path.mnt, &lock_level); |
2023 | if (lock_level && error >= 0) { | 1971 | if (lock_level && error >= 0) { |
2024 | /* We release EX lock which used to update atime | 1972 | /* We release EX lock which used to update atime |
2025 | * and get PR lock again to reduce contention | 1973 | * and get PR lock again to reduce contention |
@@ -2035,8 +1983,7 @@ int ocfs2_readdir(struct file * filp, void * dirent, filldir_t filldir) | |||
2035 | goto bail_nolock; | 1983 | goto bail_nolock; |
2036 | } | 1984 | } |
2037 | 1985 | ||
2038 | error = ocfs2_dir_foreach_blk(inode, &filp->f_version, &filp->f_pos, | 1986 | error = ocfs2_dir_foreach_blk(inode, &file->f_version, ctx, false); |
2039 | dirent, filldir, NULL); | ||
2040 | 1987 | ||
2041 | ocfs2_inode_unlock(inode, lock_level); | 1988 | ocfs2_inode_unlock(inode, lock_level); |
2042 | if (error) | 1989 | if (error) |
@@ -2120,6 +2067,7 @@ bail: | |||
2120 | } | 2067 | } |
2121 | 2068 | ||
2122 | struct ocfs2_empty_dir_priv { | 2069 | struct ocfs2_empty_dir_priv { |
2070 | struct dir_context ctx; | ||
2123 | unsigned seen_dot; | 2071 | unsigned seen_dot; |
2124 | unsigned seen_dot_dot; | 2072 | unsigned seen_dot_dot; |
2125 | unsigned seen_other; | 2073 | unsigned seen_other; |
@@ -2204,10 +2152,9 @@ out: | |||
2204 | int ocfs2_empty_dir(struct inode *inode) | 2152 | int ocfs2_empty_dir(struct inode *inode) |
2205 | { | 2153 | { |
2206 | int ret; | 2154 | int ret; |
2207 | loff_t start = 0; | 2155 | struct ocfs2_empty_dir_priv priv = { |
2208 | struct ocfs2_empty_dir_priv priv; | 2156 | .ctx.actor = ocfs2_empty_dir_filldir, |
2209 | 2157 | }; | |
2210 | memset(&priv, 0, sizeof(priv)); | ||
2211 | 2158 | ||
2212 | if (ocfs2_dir_indexed(inode)) { | 2159 | if (ocfs2_dir_indexed(inode)) { |
2213 | ret = ocfs2_empty_dir_dx(inode, &priv); | 2160 | ret = ocfs2_empty_dir_dx(inode, &priv); |
@@ -2219,7 +2166,7 @@ int ocfs2_empty_dir(struct inode *inode) | |||
2219 | */ | 2166 | */ |
2220 | } | 2167 | } |
2221 | 2168 | ||
2222 | ret = ocfs2_dir_foreach(inode, &start, &priv, ocfs2_empty_dir_filldir); | 2169 | ret = ocfs2_dir_foreach(inode, &priv.ctx); |
2223 | if (ret) | 2170 | if (ret) |
2224 | mlog_errno(ret); | 2171 | mlog_errno(ret); |
2225 | 2172 | ||
diff --git a/fs/ocfs2/dir.h b/fs/ocfs2/dir.h index e683f3deb645..f0344b75b14d 100644 --- a/fs/ocfs2/dir.h +++ b/fs/ocfs2/dir.h | |||
@@ -92,9 +92,8 @@ int ocfs2_find_files_on_disk(const char *name, | |||
92 | struct ocfs2_dir_lookup_result *res); | 92 | struct ocfs2_dir_lookup_result *res); |
93 | int ocfs2_lookup_ino_from_name(struct inode *dir, const char *name, | 93 | int ocfs2_lookup_ino_from_name(struct inode *dir, const char *name, |
94 | int namelen, u64 *blkno); | 94 | int namelen, u64 *blkno); |
95 | int ocfs2_readdir(struct file *filp, void *dirent, filldir_t filldir); | 95 | int ocfs2_readdir(struct file *file, struct dir_context *ctx); |
96 | int ocfs2_dir_foreach(struct inode *inode, loff_t *f_pos, void *priv, | 96 | int ocfs2_dir_foreach(struct inode *inode, struct dir_context *ctx); |
97 | filldir_t filldir); | ||
98 | int ocfs2_prepare_dir_for_insert(struct ocfs2_super *osb, | 97 | int ocfs2_prepare_dir_for_insert(struct ocfs2_super *osb, |
99 | struct inode *dir, | 98 | struct inode *dir, |
100 | struct buffer_head *parent_fe_bh, | 99 | struct buffer_head *parent_fe_bh, |
diff --git a/fs/ocfs2/dlm/dlmlock.c b/fs/ocfs2/dlm/dlmlock.c index 975810b98492..47e67c2d228f 100644 --- a/fs/ocfs2/dlm/dlmlock.c +++ b/fs/ocfs2/dlm/dlmlock.c | |||
@@ -178,6 +178,7 @@ static enum dlm_status dlmlock_master(struct dlm_ctxt *dlm, | |||
178 | lock->ml.node); | 178 | lock->ml.node); |
179 | } | 179 | } |
180 | } else { | 180 | } else { |
181 | status = DLM_NORMAL; | ||
181 | dlm_lock_get(lock); | 182 | dlm_lock_get(lock); |
182 | list_add_tail(&lock->list, &res->blocked); | 183 | list_add_tail(&lock->list, &res->blocked); |
183 | kick_thread = 1; | 184 | kick_thread = 1; |
diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c index e68588e6b1e8..773bd32bfd8c 100644 --- a/fs/ocfs2/dlm/dlmrecovery.c +++ b/fs/ocfs2/dlm/dlmrecovery.c | |||
@@ -55,9 +55,6 @@ | |||
55 | static void dlm_do_local_recovery_cleanup(struct dlm_ctxt *dlm, u8 dead_node); | 55 | static void dlm_do_local_recovery_cleanup(struct dlm_ctxt *dlm, u8 dead_node); |
56 | 56 | ||
57 | static int dlm_recovery_thread(void *data); | 57 | static int dlm_recovery_thread(void *data); |
58 | void dlm_complete_recovery_thread(struct dlm_ctxt *dlm); | ||
59 | int dlm_launch_recovery_thread(struct dlm_ctxt *dlm); | ||
60 | void dlm_kick_recovery_thread(struct dlm_ctxt *dlm); | ||
61 | static int dlm_do_recovery(struct dlm_ctxt *dlm); | 58 | static int dlm_do_recovery(struct dlm_ctxt *dlm); |
62 | 59 | ||
63 | static int dlm_pick_recovery_master(struct dlm_ctxt *dlm); | 60 | static int dlm_pick_recovery_master(struct dlm_ctxt *dlm); |
@@ -789,7 +786,7 @@ static int dlm_request_all_locks(struct dlm_ctxt *dlm, u8 request_from, | |||
789 | u8 dead_node) | 786 | u8 dead_node) |
790 | { | 787 | { |
791 | struct dlm_lock_request lr; | 788 | struct dlm_lock_request lr; |
792 | enum dlm_status ret; | 789 | int ret; |
793 | 790 | ||
794 | mlog(0, "\n"); | 791 | mlog(0, "\n"); |
795 | 792 | ||
@@ -802,7 +799,6 @@ static int dlm_request_all_locks(struct dlm_ctxt *dlm, u8 request_from, | |||
802 | lr.dead_node = dead_node; | 799 | lr.dead_node = dead_node; |
803 | 800 | ||
804 | // send message | 801 | // send message |
805 | ret = DLM_NOLOCKMGR; | ||
806 | ret = o2net_send_message(DLM_LOCK_REQUEST_MSG, dlm->key, | 802 | ret = o2net_send_message(DLM_LOCK_REQUEST_MSG, dlm->key, |
807 | &lr, sizeof(lr), request_from, NULL); | 803 | &lr, sizeof(lr), request_from, NULL); |
808 | 804 | ||
@@ -2696,6 +2692,7 @@ int dlm_begin_reco_handler(struct o2net_msg *msg, u32 len, void *data, | |||
2696 | dlm->name, br->node_idx, br->dead_node, | 2692 | dlm->name, br->node_idx, br->dead_node, |
2697 | dlm->reco.dead_node, dlm->reco.new_master); | 2693 | dlm->reco.dead_node, dlm->reco.new_master); |
2698 | spin_unlock(&dlm->spinlock); | 2694 | spin_unlock(&dlm->spinlock); |
2695 | dlm_put(dlm); | ||
2699 | return -EAGAIN; | 2696 | return -EAGAIN; |
2700 | } | 2697 | } |
2701 | spin_unlock(&dlm->spinlock); | 2698 | spin_unlock(&dlm->spinlock); |
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index ff54014a24ec..3261d71319ee 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -370,7 +370,7 @@ static int ocfs2_cow_file_pos(struct inode *inode, | |||
370 | if (!(ext_flags & OCFS2_EXT_REFCOUNTED)) | 370 | if (!(ext_flags & OCFS2_EXT_REFCOUNTED)) |
371 | goto out; | 371 | goto out; |
372 | 372 | ||
373 | return ocfs2_refcount_cow(inode, NULL, fe_bh, cpos, 1, cpos+1); | 373 | return ocfs2_refcount_cow(inode, fe_bh, cpos, 1, cpos+1); |
374 | 374 | ||
375 | out: | 375 | out: |
376 | return status; | 376 | return status; |
@@ -899,7 +899,7 @@ static int ocfs2_zero_extend_get_range(struct inode *inode, | |||
899 | zero_clusters = last_cpos - zero_cpos; | 899 | zero_clusters = last_cpos - zero_cpos; |
900 | 900 | ||
901 | if (needs_cow) { | 901 | if (needs_cow) { |
902 | rc = ocfs2_refcount_cow(inode, NULL, di_bh, zero_cpos, | 902 | rc = ocfs2_refcount_cow(inode, di_bh, zero_cpos, |
903 | zero_clusters, UINT_MAX); | 903 | zero_clusters, UINT_MAX); |
904 | if (rc) { | 904 | if (rc) { |
905 | mlog_errno(rc); | 905 | mlog_errno(rc); |
@@ -2078,7 +2078,7 @@ static int ocfs2_prepare_inode_for_refcount(struct inode *inode, | |||
2078 | 2078 | ||
2079 | *meta_level = 1; | 2079 | *meta_level = 1; |
2080 | 2080 | ||
2081 | ret = ocfs2_refcount_cow(inode, file, di_bh, cpos, clusters, UINT_MAX); | 2081 | ret = ocfs2_refcount_cow(inode, di_bh, cpos, clusters, UINT_MAX); |
2082 | if (ret) | 2082 | if (ret) |
2083 | mlog_errno(ret); | 2083 | mlog_errno(ret); |
2084 | out: | 2084 | out: |
@@ -2646,17 +2646,7 @@ static loff_t ocfs2_file_llseek(struct file *file, loff_t offset, int whence) | |||
2646 | goto out; | 2646 | goto out; |
2647 | } | 2647 | } |
2648 | 2648 | ||
2649 | if (offset < 0 && !(file->f_mode & FMODE_UNSIGNED_OFFSET)) | 2649 | offset = vfs_setpos(file, offset, inode->i_sb->s_maxbytes); |
2650 | ret = -EINVAL; | ||
2651 | if (!ret && offset > inode->i_sb->s_maxbytes) | ||
2652 | ret = -EINVAL; | ||
2653 | if (ret) | ||
2654 | goto out; | ||
2655 | |||
2656 | if (offset != file->f_pos) { | ||
2657 | file->f_pos = offset; | ||
2658 | file->f_version = 0; | ||
2659 | } | ||
2660 | 2650 | ||
2661 | out: | 2651 | out: |
2662 | mutex_unlock(&inode->i_mutex); | 2652 | mutex_unlock(&inode->i_mutex); |
@@ -2712,7 +2702,7 @@ const struct file_operations ocfs2_fops = { | |||
2712 | const struct file_operations ocfs2_dops = { | 2702 | const struct file_operations ocfs2_dops = { |
2713 | .llseek = generic_file_llseek, | 2703 | .llseek = generic_file_llseek, |
2714 | .read = generic_read_dir, | 2704 | .read = generic_read_dir, |
2715 | .readdir = ocfs2_readdir, | 2705 | .iterate = ocfs2_readdir, |
2716 | .fsync = ocfs2_sync_file, | 2706 | .fsync = ocfs2_sync_file, |
2717 | .release = ocfs2_dir_release, | 2707 | .release = ocfs2_dir_release, |
2718 | .open = ocfs2_dir_open, | 2708 | .open = ocfs2_dir_open, |
@@ -2759,7 +2749,7 @@ const struct file_operations ocfs2_fops_no_plocks = { | |||
2759 | const struct file_operations ocfs2_dops_no_plocks = { | 2749 | const struct file_operations ocfs2_dops_no_plocks = { |
2760 | .llseek = generic_file_llseek, | 2750 | .llseek = generic_file_llseek, |
2761 | .read = generic_read_dir, | 2751 | .read = generic_read_dir, |
2762 | .readdir = ocfs2_readdir, | 2752 | .iterate = ocfs2_readdir, |
2763 | .fsync = ocfs2_sync_file, | 2753 | .fsync = ocfs2_sync_file, |
2764 | .release = ocfs2_dir_release, | 2754 | .release = ocfs2_dir_release, |
2765 | .open = ocfs2_dir_open, | 2755 | .open = ocfs2_dir_open, |
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c index 8eccfabcd12e..242170d83971 100644 --- a/fs/ocfs2/journal.c +++ b/fs/ocfs2/journal.c | |||
@@ -1941,6 +1941,7 @@ void ocfs2_orphan_scan_start(struct ocfs2_super *osb) | |||
1941 | } | 1941 | } |
1942 | 1942 | ||
1943 | struct ocfs2_orphan_filldir_priv { | 1943 | struct ocfs2_orphan_filldir_priv { |
1944 | struct dir_context ctx; | ||
1944 | struct inode *head; | 1945 | struct inode *head; |
1945 | struct ocfs2_super *osb; | 1946 | struct ocfs2_super *osb; |
1946 | }; | 1947 | }; |
@@ -1977,11 +1978,11 @@ static int ocfs2_queue_orphans(struct ocfs2_super *osb, | |||
1977 | { | 1978 | { |
1978 | int status; | 1979 | int status; |
1979 | struct inode *orphan_dir_inode = NULL; | 1980 | struct inode *orphan_dir_inode = NULL; |
1980 | struct ocfs2_orphan_filldir_priv priv; | 1981 | struct ocfs2_orphan_filldir_priv priv = { |
1981 | loff_t pos = 0; | 1982 | .ctx.actor = ocfs2_orphan_filldir, |
1982 | 1983 | .osb = osb, | |
1983 | priv.osb = osb; | 1984 | .head = *head |
1984 | priv.head = *head; | 1985 | }; |
1985 | 1986 | ||
1986 | orphan_dir_inode = ocfs2_get_system_file_inode(osb, | 1987 | orphan_dir_inode = ocfs2_get_system_file_inode(osb, |
1987 | ORPHAN_DIR_SYSTEM_INODE, | 1988 | ORPHAN_DIR_SYSTEM_INODE, |
@@ -1999,8 +2000,7 @@ static int ocfs2_queue_orphans(struct ocfs2_super *osb, | |||
1999 | goto out; | 2000 | goto out; |
2000 | } | 2001 | } |
2001 | 2002 | ||
2002 | status = ocfs2_dir_foreach(orphan_dir_inode, &pos, &priv, | 2003 | status = ocfs2_dir_foreach(orphan_dir_inode, &priv.ctx); |
2003 | ocfs2_orphan_filldir); | ||
2004 | if (status) { | 2004 | if (status) { |
2005 | mlog_errno(status); | 2005 | mlog_errno(status); |
2006 | goto out_cluster; | 2006 | goto out_cluster; |
diff --git a/fs/ocfs2/journal.h b/fs/ocfs2/journal.h index a3385b63ff5e..0a992737dcaf 100644 --- a/fs/ocfs2/journal.h +++ b/fs/ocfs2/journal.h | |||
@@ -200,7 +200,6 @@ void ocfs2_complete_quota_recovery(struct ocfs2_super *osb); | |||
200 | 200 | ||
201 | static inline void ocfs2_start_checkpoint(struct ocfs2_super *osb) | 201 | static inline void ocfs2_start_checkpoint(struct ocfs2_super *osb) |
202 | { | 202 | { |
203 | atomic_set(&osb->needs_checkpoint, 1); | ||
204 | wake_up(&osb->checkpoint_event); | 203 | wake_up(&osb->checkpoint_event); |
205 | } | 204 | } |
206 | 205 | ||
diff --git a/fs/ocfs2/move_extents.c b/fs/ocfs2/move_extents.c index f1fc172175b6..452068b45749 100644 --- a/fs/ocfs2/move_extents.c +++ b/fs/ocfs2/move_extents.c | |||
@@ -69,7 +69,7 @@ static int __ocfs2_move_extent(handle_t *handle, | |||
69 | u64 ino = ocfs2_metadata_cache_owner(context->et.et_ci); | 69 | u64 ino = ocfs2_metadata_cache_owner(context->et.et_ci); |
70 | u64 old_blkno = ocfs2_clusters_to_blocks(inode->i_sb, p_cpos); | 70 | u64 old_blkno = ocfs2_clusters_to_blocks(inode->i_sb, p_cpos); |
71 | 71 | ||
72 | ret = ocfs2_duplicate_clusters_by_page(handle, context->file, cpos, | 72 | ret = ocfs2_duplicate_clusters_by_page(handle, inode, cpos, |
73 | p_cpos, new_p_cpos, len); | 73 | p_cpos, new_p_cpos, len); |
74 | if (ret) { | 74 | if (ret) { |
75 | mlog_errno(ret); | 75 | mlog_errno(ret); |
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c index b4a5cdf9dbc5..be3f8676a438 100644 --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c | |||
@@ -522,7 +522,7 @@ static int __ocfs2_mknod_locked(struct inode *dir, | |||
522 | 522 | ||
523 | fe->i_last_eb_blk = 0; | 523 | fe->i_last_eb_blk = 0; |
524 | strcpy(fe->i_signature, OCFS2_INODE_SIGNATURE); | 524 | strcpy(fe->i_signature, OCFS2_INODE_SIGNATURE); |
525 | le32_add_cpu(&fe->i_flags, OCFS2_VALID_FL); | 525 | fe->i_flags |= cpu_to_le32(OCFS2_VALID_FL); |
526 | fe->i_atime = fe->i_ctime = fe->i_mtime = | 526 | fe->i_atime = fe->i_ctime = fe->i_mtime = |
527 | cpu_to_le64(CURRENT_TIME.tv_sec); | 527 | cpu_to_le64(CURRENT_TIME.tv_sec); |
528 | fe->i_mtime_nsec = fe->i_ctime_nsec = fe->i_atime_nsec = | 528 | fe->i_mtime_nsec = fe->i_ctime_nsec = fe->i_atime_nsec = |
@@ -773,7 +773,7 @@ static int ocfs2_remote_dentry_delete(struct dentry *dentry) | |||
773 | return ret; | 773 | return ret; |
774 | } | 774 | } |
775 | 775 | ||
776 | static inline int inode_is_unlinkable(struct inode *inode) | 776 | static inline int ocfs2_inode_is_unlinkable(struct inode *inode) |
777 | { | 777 | { |
778 | if (S_ISDIR(inode->i_mode)) { | 778 | if (S_ISDIR(inode->i_mode)) { |
779 | if (inode->i_nlink == 2) | 779 | if (inode->i_nlink == 2) |
@@ -791,6 +791,7 @@ static int ocfs2_unlink(struct inode *dir, | |||
791 | { | 791 | { |
792 | int status; | 792 | int status; |
793 | int child_locked = 0; | 793 | int child_locked = 0; |
794 | bool is_unlinkable = false; | ||
794 | struct inode *inode = dentry->d_inode; | 795 | struct inode *inode = dentry->d_inode; |
795 | struct inode *orphan_dir = NULL; | 796 | struct inode *orphan_dir = NULL; |
796 | struct ocfs2_super *osb = OCFS2_SB(dir->i_sb); | 797 | struct ocfs2_super *osb = OCFS2_SB(dir->i_sb); |
@@ -865,7 +866,7 @@ static int ocfs2_unlink(struct inode *dir, | |||
865 | goto leave; | 866 | goto leave; |
866 | } | 867 | } |
867 | 868 | ||
868 | if (inode_is_unlinkable(inode)) { | 869 | if (ocfs2_inode_is_unlinkable(inode)) { |
869 | status = ocfs2_prepare_orphan_dir(osb, &orphan_dir, | 870 | status = ocfs2_prepare_orphan_dir(osb, &orphan_dir, |
870 | OCFS2_I(inode)->ip_blkno, | 871 | OCFS2_I(inode)->ip_blkno, |
871 | orphan_name, &orphan_insert); | 872 | orphan_name, &orphan_insert); |
@@ -873,6 +874,7 @@ static int ocfs2_unlink(struct inode *dir, | |||
873 | mlog_errno(status); | 874 | mlog_errno(status); |
874 | goto leave; | 875 | goto leave; |
875 | } | 876 | } |
877 | is_unlinkable = true; | ||
876 | } | 878 | } |
877 | 879 | ||
878 | handle = ocfs2_start_trans(osb, ocfs2_unlink_credits(osb->sb)); | 880 | handle = ocfs2_start_trans(osb, ocfs2_unlink_credits(osb->sb)); |
@@ -892,15 +894,6 @@ static int ocfs2_unlink(struct inode *dir, | |||
892 | 894 | ||
893 | fe = (struct ocfs2_dinode *) fe_bh->b_data; | 895 | fe = (struct ocfs2_dinode *) fe_bh->b_data; |
894 | 896 | ||
895 | if (inode_is_unlinkable(inode)) { | ||
896 | status = ocfs2_orphan_add(osb, handle, inode, fe_bh, orphan_name, | ||
897 | &orphan_insert, orphan_dir); | ||
898 | if (status < 0) { | ||
899 | mlog_errno(status); | ||
900 | goto leave; | ||
901 | } | ||
902 | } | ||
903 | |||
904 | /* delete the name from the parent dir */ | 897 | /* delete the name from the parent dir */ |
905 | status = ocfs2_delete_entry(handle, dir, &lookup); | 898 | status = ocfs2_delete_entry(handle, dir, &lookup); |
906 | if (status < 0) { | 899 | if (status < 0) { |
@@ -923,6 +916,14 @@ static int ocfs2_unlink(struct inode *dir, | |||
923 | mlog_errno(status); | 916 | mlog_errno(status); |
924 | if (S_ISDIR(inode->i_mode)) | 917 | if (S_ISDIR(inode->i_mode)) |
925 | inc_nlink(dir); | 918 | inc_nlink(dir); |
919 | goto leave; | ||
920 | } | ||
921 | |||
922 | if (is_unlinkable) { | ||
923 | status = ocfs2_orphan_add(osb, handle, inode, fe_bh, | ||
924 | orphan_name, &orphan_insert, orphan_dir); | ||
925 | if (status < 0) | ||
926 | mlog_errno(status); | ||
926 | } | 927 | } |
927 | 928 | ||
928 | leave: | 929 | leave: |
@@ -2012,6 +2013,21 @@ static int ocfs2_orphan_add(struct ocfs2_super *osb, | |||
2012 | goto leave; | 2013 | goto leave; |
2013 | } | 2014 | } |
2014 | 2015 | ||
2016 | /* | ||
2017 | * We're going to journal the change of i_flags and i_orphaned_slot. | ||
2018 | * It's safe anyway, though some callers may duplicate the journaling. | ||
2019 | * Journaling within the func just make the logic look more | ||
2020 | * straightforward. | ||
2021 | */ | ||
2022 | status = ocfs2_journal_access_di(handle, | ||
2023 | INODE_CACHE(inode), | ||
2024 | fe_bh, | ||
2025 | OCFS2_JOURNAL_ACCESS_WRITE); | ||
2026 | if (status < 0) { | ||
2027 | mlog_errno(status); | ||
2028 | goto leave; | ||
2029 | } | ||
2030 | |||
2015 | /* we're a cluster, and nlink can change on disk from | 2031 | /* we're a cluster, and nlink can change on disk from |
2016 | * underneath us... */ | 2032 | * underneath us... */ |
2017 | orphan_fe = (struct ocfs2_dinode *) orphan_dir_bh->b_data; | 2033 | orphan_fe = (struct ocfs2_dinode *) orphan_dir_bh->b_data; |
@@ -2026,25 +2042,10 @@ static int ocfs2_orphan_add(struct ocfs2_super *osb, | |||
2026 | orphan_dir_bh, lookup); | 2042 | orphan_dir_bh, lookup); |
2027 | if (status < 0) { | 2043 | if (status < 0) { |
2028 | mlog_errno(status); | 2044 | mlog_errno(status); |
2029 | goto leave; | 2045 | goto rollback; |
2030 | } | ||
2031 | |||
2032 | /* | ||
2033 | * We're going to journal the change of i_flags and i_orphaned_slot. | ||
2034 | * It's safe anyway, though some callers may duplicate the journaling. | ||
2035 | * Journaling within the func just make the logic look more | ||
2036 | * straightforward. | ||
2037 | */ | ||
2038 | status = ocfs2_journal_access_di(handle, | ||
2039 | INODE_CACHE(inode), | ||
2040 | fe_bh, | ||
2041 | OCFS2_JOURNAL_ACCESS_WRITE); | ||
2042 | if (status < 0) { | ||
2043 | mlog_errno(status); | ||
2044 | goto leave; | ||
2045 | } | 2046 | } |
2046 | 2047 | ||
2047 | le32_add_cpu(&fe->i_flags, OCFS2_ORPHANED_FL); | 2048 | fe->i_flags |= cpu_to_le32(OCFS2_ORPHANED_FL); |
2048 | OCFS2_I(inode)->ip_flags &= ~OCFS2_INODE_SKIP_ORPHAN_DIR; | 2049 | OCFS2_I(inode)->ip_flags &= ~OCFS2_INODE_SKIP_ORPHAN_DIR; |
2049 | 2050 | ||
2050 | /* Record which orphan dir our inode now resides | 2051 | /* Record which orphan dir our inode now resides |
@@ -2057,11 +2058,16 @@ static int ocfs2_orphan_add(struct ocfs2_super *osb, | |||
2057 | trace_ocfs2_orphan_add_end((unsigned long long)OCFS2_I(inode)->ip_blkno, | 2058 | trace_ocfs2_orphan_add_end((unsigned long long)OCFS2_I(inode)->ip_blkno, |
2058 | osb->slot_num); | 2059 | osb->slot_num); |
2059 | 2060 | ||
2061 | rollback: | ||
2062 | if (status < 0) { | ||
2063 | if (S_ISDIR(inode->i_mode)) | ||
2064 | ocfs2_add_links_count(orphan_fe, -1); | ||
2065 | set_nlink(orphan_dir_inode, ocfs2_read_links_count(orphan_fe)); | ||
2066 | } | ||
2067 | |||
2060 | leave: | 2068 | leave: |
2061 | brelse(orphan_dir_bh); | 2069 | brelse(orphan_dir_bh); |
2062 | 2070 | ||
2063 | if (status) | ||
2064 | mlog_errno(status); | ||
2065 | return status; | 2071 | return status; |
2066 | } | 2072 | } |
2067 | 2073 | ||
@@ -2434,7 +2440,7 @@ int ocfs2_mv_orphaned_inode_to_new(struct inode *dir, | |||
2434 | } | 2440 | } |
2435 | 2441 | ||
2436 | di = (struct ocfs2_dinode *)di_bh->b_data; | 2442 | di = (struct ocfs2_dinode *)di_bh->b_data; |
2437 | le32_add_cpu(&di->i_flags, -OCFS2_ORPHANED_FL); | 2443 | di->i_flags &= ~cpu_to_le32(OCFS2_ORPHANED_FL); |
2438 | di->i_orphaned_slot = 0; | 2444 | di->i_orphaned_slot = 0; |
2439 | set_nlink(inode, 1); | 2445 | set_nlink(inode, 1); |
2440 | ocfs2_set_links_count(di, inode->i_nlink); | 2446 | ocfs2_set_links_count(di, inode->i_nlink); |
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h index d355e6e36b36..3a903470c794 100644 --- a/fs/ocfs2/ocfs2.h +++ b/fs/ocfs2/ocfs2.h | |||
@@ -347,7 +347,6 @@ struct ocfs2_super | |||
347 | struct task_struct *recovery_thread_task; | 347 | struct task_struct *recovery_thread_task; |
348 | int disable_recovery; | 348 | int disable_recovery; |
349 | wait_queue_head_t checkpoint_event; | 349 | wait_queue_head_t checkpoint_event; |
350 | atomic_t needs_checkpoint; | ||
351 | struct ocfs2_journal *journal; | 350 | struct ocfs2_journal *journal; |
352 | unsigned long osb_commit_interval; | 351 | unsigned long osb_commit_interval; |
353 | 352 | ||
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c index 998b17eda09d..a70d604593b6 100644 --- a/fs/ocfs2/refcounttree.c +++ b/fs/ocfs2/refcounttree.c | |||
@@ -49,7 +49,6 @@ | |||
49 | 49 | ||
50 | struct ocfs2_cow_context { | 50 | struct ocfs2_cow_context { |
51 | struct inode *inode; | 51 | struct inode *inode; |
52 | struct file *file; | ||
53 | u32 cow_start; | 52 | u32 cow_start; |
54 | u32 cow_len; | 53 | u32 cow_len; |
55 | struct ocfs2_extent_tree data_et; | 54 | struct ocfs2_extent_tree data_et; |
@@ -66,7 +65,7 @@ struct ocfs2_cow_context { | |||
66 | u32 *num_clusters, | 65 | u32 *num_clusters, |
67 | unsigned int *extent_flags); | 66 | unsigned int *extent_flags); |
68 | int (*cow_duplicate_clusters)(handle_t *handle, | 67 | int (*cow_duplicate_clusters)(handle_t *handle, |
69 | struct file *file, | 68 | struct inode *inode, |
70 | u32 cpos, u32 old_cluster, | 69 | u32 cpos, u32 old_cluster, |
71 | u32 new_cluster, u32 new_len); | 70 | u32 new_cluster, u32 new_len); |
72 | }; | 71 | }; |
@@ -2922,14 +2921,12 @@ static int ocfs2_clear_cow_buffer(handle_t *handle, struct buffer_head *bh) | |||
2922 | } | 2921 | } |
2923 | 2922 | ||
2924 | int ocfs2_duplicate_clusters_by_page(handle_t *handle, | 2923 | int ocfs2_duplicate_clusters_by_page(handle_t *handle, |
2925 | struct file *file, | 2924 | struct inode *inode, |
2926 | u32 cpos, u32 old_cluster, | 2925 | u32 cpos, u32 old_cluster, |
2927 | u32 new_cluster, u32 new_len) | 2926 | u32 new_cluster, u32 new_len) |
2928 | { | 2927 | { |
2929 | int ret = 0, partial; | 2928 | int ret = 0, partial; |
2930 | struct inode *inode = file_inode(file); | 2929 | struct super_block *sb = inode->i_sb; |
2931 | struct ocfs2_caching_info *ci = INODE_CACHE(inode); | ||
2932 | struct super_block *sb = ocfs2_metadata_cache_get_super(ci); | ||
2933 | u64 new_block = ocfs2_clusters_to_blocks(sb, new_cluster); | 2930 | u64 new_block = ocfs2_clusters_to_blocks(sb, new_cluster); |
2934 | struct page *page; | 2931 | struct page *page; |
2935 | pgoff_t page_index; | 2932 | pgoff_t page_index; |
@@ -2965,6 +2962,11 @@ int ocfs2_duplicate_clusters_by_page(handle_t *handle, | |||
2965 | to = map_end & (PAGE_CACHE_SIZE - 1); | 2962 | to = map_end & (PAGE_CACHE_SIZE - 1); |
2966 | 2963 | ||
2967 | page = find_or_create_page(mapping, page_index, GFP_NOFS); | 2964 | page = find_or_create_page(mapping, page_index, GFP_NOFS); |
2965 | if (!page) { | ||
2966 | ret = -ENOMEM; | ||
2967 | mlog_errno(ret); | ||
2968 | break; | ||
2969 | } | ||
2968 | 2970 | ||
2969 | /* | 2971 | /* |
2970 | * In case PAGE_CACHE_SIZE <= CLUSTER_SIZE, This page | 2972 | * In case PAGE_CACHE_SIZE <= CLUSTER_SIZE, This page |
@@ -2973,13 +2975,6 @@ int ocfs2_duplicate_clusters_by_page(handle_t *handle, | |||
2973 | if (PAGE_CACHE_SIZE <= OCFS2_SB(sb)->s_clustersize) | 2975 | if (PAGE_CACHE_SIZE <= OCFS2_SB(sb)->s_clustersize) |
2974 | BUG_ON(PageDirty(page)); | 2976 | BUG_ON(PageDirty(page)); |
2975 | 2977 | ||
2976 | if (PageReadahead(page)) { | ||
2977 | page_cache_async_readahead(mapping, | ||
2978 | &file->f_ra, file, | ||
2979 | page, page_index, | ||
2980 | readahead_pages); | ||
2981 | } | ||
2982 | |||
2983 | if (!PageUptodate(page)) { | 2978 | if (!PageUptodate(page)) { |
2984 | ret = block_read_full_page(page, ocfs2_get_block); | 2979 | ret = block_read_full_page(page, ocfs2_get_block); |
2985 | if (ret) { | 2980 | if (ret) { |
@@ -2999,7 +2994,8 @@ int ocfs2_duplicate_clusters_by_page(handle_t *handle, | |||
2999 | } | 2994 | } |
3000 | } | 2995 | } |
3001 | 2996 | ||
3002 | ocfs2_map_and_dirty_page(inode, handle, from, to, | 2997 | ocfs2_map_and_dirty_page(inode, |
2998 | handle, from, to, | ||
3003 | page, 0, &new_block); | 2999 | page, 0, &new_block); |
3004 | mark_page_accessed(page); | 3000 | mark_page_accessed(page); |
3005 | unlock: | 3001 | unlock: |
@@ -3015,12 +3011,11 @@ unlock: | |||
3015 | } | 3011 | } |
3016 | 3012 | ||
3017 | int ocfs2_duplicate_clusters_by_jbd(handle_t *handle, | 3013 | int ocfs2_duplicate_clusters_by_jbd(handle_t *handle, |
3018 | struct file *file, | 3014 | struct inode *inode, |
3019 | u32 cpos, u32 old_cluster, | 3015 | u32 cpos, u32 old_cluster, |
3020 | u32 new_cluster, u32 new_len) | 3016 | u32 new_cluster, u32 new_len) |
3021 | { | 3017 | { |
3022 | int ret = 0; | 3018 | int ret = 0; |
3023 | struct inode *inode = file_inode(file); | ||
3024 | struct super_block *sb = inode->i_sb; | 3019 | struct super_block *sb = inode->i_sb; |
3025 | struct ocfs2_caching_info *ci = INODE_CACHE(inode); | 3020 | struct ocfs2_caching_info *ci = INODE_CACHE(inode); |
3026 | int i, blocks = ocfs2_clusters_to_blocks(sb, new_len); | 3021 | int i, blocks = ocfs2_clusters_to_blocks(sb, new_len); |
@@ -3145,7 +3140,7 @@ static int ocfs2_replace_clusters(handle_t *handle, | |||
3145 | 3140 | ||
3146 | /*If the old clusters is unwritten, no need to duplicate. */ | 3141 | /*If the old clusters is unwritten, no need to duplicate. */ |
3147 | if (!(ext_flags & OCFS2_EXT_UNWRITTEN)) { | 3142 | if (!(ext_flags & OCFS2_EXT_UNWRITTEN)) { |
3148 | ret = context->cow_duplicate_clusters(handle, context->file, | 3143 | ret = context->cow_duplicate_clusters(handle, context->inode, |
3149 | cpos, old, new, len); | 3144 | cpos, old, new, len); |
3150 | if (ret) { | 3145 | if (ret) { |
3151 | mlog_errno(ret); | 3146 | mlog_errno(ret); |
@@ -3423,35 +3418,12 @@ static int ocfs2_replace_cow(struct ocfs2_cow_context *context) | |||
3423 | return ret; | 3418 | return ret; |
3424 | } | 3419 | } |
3425 | 3420 | ||
3426 | static void ocfs2_readahead_for_cow(struct inode *inode, | ||
3427 | struct file *file, | ||
3428 | u32 start, u32 len) | ||
3429 | { | ||
3430 | struct address_space *mapping; | ||
3431 | pgoff_t index; | ||
3432 | unsigned long num_pages; | ||
3433 | int cs_bits = OCFS2_SB(inode->i_sb)->s_clustersize_bits; | ||
3434 | |||
3435 | if (!file) | ||
3436 | return; | ||
3437 | |||
3438 | mapping = file->f_mapping; | ||
3439 | num_pages = (len << cs_bits) >> PAGE_CACHE_SHIFT; | ||
3440 | if (!num_pages) | ||
3441 | num_pages = 1; | ||
3442 | |||
3443 | index = ((loff_t)start << cs_bits) >> PAGE_CACHE_SHIFT; | ||
3444 | page_cache_sync_readahead(mapping, &file->f_ra, file, | ||
3445 | index, num_pages); | ||
3446 | } | ||
3447 | |||
3448 | /* | 3421 | /* |
3449 | * Starting at cpos, try to CoW write_len clusters. Don't CoW | 3422 | * Starting at cpos, try to CoW write_len clusters. Don't CoW |
3450 | * past max_cpos. This will stop when it runs into a hole or an | 3423 | * past max_cpos. This will stop when it runs into a hole or an |
3451 | * unrefcounted extent. | 3424 | * unrefcounted extent. |
3452 | */ | 3425 | */ |
3453 | static int ocfs2_refcount_cow_hunk(struct inode *inode, | 3426 | static int ocfs2_refcount_cow_hunk(struct inode *inode, |
3454 | struct file *file, | ||
3455 | struct buffer_head *di_bh, | 3427 | struct buffer_head *di_bh, |
3456 | u32 cpos, u32 write_len, u32 max_cpos) | 3428 | u32 cpos, u32 write_len, u32 max_cpos) |
3457 | { | 3429 | { |
@@ -3480,8 +3452,6 @@ static int ocfs2_refcount_cow_hunk(struct inode *inode, | |||
3480 | 3452 | ||
3481 | BUG_ON(cow_len == 0); | 3453 | BUG_ON(cow_len == 0); |
3482 | 3454 | ||
3483 | ocfs2_readahead_for_cow(inode, file, cow_start, cow_len); | ||
3484 | |||
3485 | context = kzalloc(sizeof(struct ocfs2_cow_context), GFP_NOFS); | 3455 | context = kzalloc(sizeof(struct ocfs2_cow_context), GFP_NOFS); |
3486 | if (!context) { | 3456 | if (!context) { |
3487 | ret = -ENOMEM; | 3457 | ret = -ENOMEM; |
@@ -3503,7 +3473,6 @@ static int ocfs2_refcount_cow_hunk(struct inode *inode, | |||
3503 | context->ref_root_bh = ref_root_bh; | 3473 | context->ref_root_bh = ref_root_bh; |
3504 | context->cow_duplicate_clusters = ocfs2_duplicate_clusters_by_page; | 3474 | context->cow_duplicate_clusters = ocfs2_duplicate_clusters_by_page; |
3505 | context->get_clusters = ocfs2_di_get_clusters; | 3475 | context->get_clusters = ocfs2_di_get_clusters; |
3506 | context->file = file; | ||
3507 | 3476 | ||
3508 | ocfs2_init_dinode_extent_tree(&context->data_et, | 3477 | ocfs2_init_dinode_extent_tree(&context->data_et, |
3509 | INODE_CACHE(inode), di_bh); | 3478 | INODE_CACHE(inode), di_bh); |
@@ -3532,7 +3501,6 @@ out: | |||
3532 | * clusters between cpos and cpos+write_len are safe to modify. | 3501 | * clusters between cpos and cpos+write_len are safe to modify. |
3533 | */ | 3502 | */ |
3534 | int ocfs2_refcount_cow(struct inode *inode, | 3503 | int ocfs2_refcount_cow(struct inode *inode, |
3535 | struct file *file, | ||
3536 | struct buffer_head *di_bh, | 3504 | struct buffer_head *di_bh, |
3537 | u32 cpos, u32 write_len, u32 max_cpos) | 3505 | u32 cpos, u32 write_len, u32 max_cpos) |
3538 | { | 3506 | { |
@@ -3552,7 +3520,7 @@ int ocfs2_refcount_cow(struct inode *inode, | |||
3552 | num_clusters = write_len; | 3520 | num_clusters = write_len; |
3553 | 3521 | ||
3554 | if (ext_flags & OCFS2_EXT_REFCOUNTED) { | 3522 | if (ext_flags & OCFS2_EXT_REFCOUNTED) { |
3555 | ret = ocfs2_refcount_cow_hunk(inode, file, di_bh, cpos, | 3523 | ret = ocfs2_refcount_cow_hunk(inode, di_bh, cpos, |
3556 | num_clusters, max_cpos); | 3524 | num_clusters, max_cpos); |
3557 | if (ret) { | 3525 | if (ret) { |
3558 | mlog_errno(ret); | 3526 | mlog_errno(ret); |
diff --git a/fs/ocfs2/refcounttree.h b/fs/ocfs2/refcounttree.h index 7754608c83a4..6422bbcdb525 100644 --- a/fs/ocfs2/refcounttree.h +++ b/fs/ocfs2/refcounttree.h | |||
@@ -53,7 +53,7 @@ int ocfs2_prepare_refcount_change_for_del(struct inode *inode, | |||
53 | int *credits, | 53 | int *credits, |
54 | int *ref_blocks); | 54 | int *ref_blocks); |
55 | int ocfs2_refcount_cow(struct inode *inode, | 55 | int ocfs2_refcount_cow(struct inode *inode, |
56 | struct file *filep, struct buffer_head *di_bh, | 56 | struct buffer_head *di_bh, |
57 | u32 cpos, u32 write_len, u32 max_cpos); | 57 | u32 cpos, u32 write_len, u32 max_cpos); |
58 | 58 | ||
59 | typedef int (ocfs2_post_refcount_func)(struct inode *inode, | 59 | typedef int (ocfs2_post_refcount_func)(struct inode *inode, |
@@ -85,11 +85,11 @@ int ocfs2_refcount_cow_xattr(struct inode *inode, | |||
85 | u32 cpos, u32 write_len, | 85 | u32 cpos, u32 write_len, |
86 | struct ocfs2_post_refcount *post); | 86 | struct ocfs2_post_refcount *post); |
87 | int ocfs2_duplicate_clusters_by_page(handle_t *handle, | 87 | int ocfs2_duplicate_clusters_by_page(handle_t *handle, |
88 | struct file *file, | 88 | struct inode *inode, |
89 | u32 cpos, u32 old_cluster, | 89 | u32 cpos, u32 old_cluster, |
90 | u32 new_cluster, u32 new_len); | 90 | u32 new_cluster, u32 new_len); |
91 | int ocfs2_duplicate_clusters_by_jbd(handle_t *handle, | 91 | int ocfs2_duplicate_clusters_by_jbd(handle_t *handle, |
92 | struct file *file, | 92 | struct inode *inode, |
93 | u32 cpos, u32 old_cluster, | 93 | u32 cpos, u32 old_cluster, |
94 | u32 new_cluster, u32 new_len); | 94 | u32 new_cluster, u32 new_len); |
95 | int ocfs2_cow_sync_writeback(struct super_block *sb, | 95 | int ocfs2_cow_sync_writeback(struct super_block *sb, |
diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c index b7e74b580c0f..5397c07ce608 100644 --- a/fs/ocfs2/suballoc.c +++ b/fs/ocfs2/suballoc.c | |||
@@ -1422,7 +1422,7 @@ static int ocfs2_relink_block_group(handle_t *handle, | |||
1422 | int status; | 1422 | int status; |
1423 | /* there is a really tiny chance the journal calls could fail, | 1423 | /* there is a really tiny chance the journal calls could fail, |
1424 | * but we wouldn't want inconsistent blocks in *any* case. */ | 1424 | * but we wouldn't want inconsistent blocks in *any* case. */ |
1425 | u64 fe_ptr, bg_ptr, prev_bg_ptr; | 1425 | u64 bg_ptr, prev_bg_ptr; |
1426 | struct ocfs2_dinode *fe = (struct ocfs2_dinode *) fe_bh->b_data; | 1426 | struct ocfs2_dinode *fe = (struct ocfs2_dinode *) fe_bh->b_data; |
1427 | struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) bg_bh->b_data; | 1427 | struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) bg_bh->b_data; |
1428 | struct ocfs2_group_desc *prev_bg = (struct ocfs2_group_desc *) prev_bg_bh->b_data; | 1428 | struct ocfs2_group_desc *prev_bg = (struct ocfs2_group_desc *) prev_bg_bh->b_data; |
@@ -1437,51 +1437,44 @@ static int ocfs2_relink_block_group(handle_t *handle, | |||
1437 | (unsigned long long)le64_to_cpu(bg->bg_blkno), | 1437 | (unsigned long long)le64_to_cpu(bg->bg_blkno), |
1438 | (unsigned long long)le64_to_cpu(prev_bg->bg_blkno)); | 1438 | (unsigned long long)le64_to_cpu(prev_bg->bg_blkno)); |
1439 | 1439 | ||
1440 | fe_ptr = le64_to_cpu(fe->id2.i_chain.cl_recs[chain].c_blkno); | ||
1441 | bg_ptr = le64_to_cpu(bg->bg_next_group); | 1440 | bg_ptr = le64_to_cpu(bg->bg_next_group); |
1442 | prev_bg_ptr = le64_to_cpu(prev_bg->bg_next_group); | 1441 | prev_bg_ptr = le64_to_cpu(prev_bg->bg_next_group); |
1443 | 1442 | ||
1444 | status = ocfs2_journal_access_gd(handle, INODE_CACHE(alloc_inode), | 1443 | status = ocfs2_journal_access_gd(handle, INODE_CACHE(alloc_inode), |
1445 | prev_bg_bh, | 1444 | prev_bg_bh, |
1446 | OCFS2_JOURNAL_ACCESS_WRITE); | 1445 | OCFS2_JOURNAL_ACCESS_WRITE); |
1447 | if (status < 0) { | 1446 | if (status < 0) |
1448 | mlog_errno(status); | 1447 | goto out; |
1449 | goto out_rollback; | ||
1450 | } | ||
1451 | 1448 | ||
1452 | prev_bg->bg_next_group = bg->bg_next_group; | 1449 | prev_bg->bg_next_group = bg->bg_next_group; |
1453 | ocfs2_journal_dirty(handle, prev_bg_bh); | 1450 | ocfs2_journal_dirty(handle, prev_bg_bh); |
1454 | 1451 | ||
1455 | status = ocfs2_journal_access_gd(handle, INODE_CACHE(alloc_inode), | 1452 | status = ocfs2_journal_access_gd(handle, INODE_CACHE(alloc_inode), |
1456 | bg_bh, OCFS2_JOURNAL_ACCESS_WRITE); | 1453 | bg_bh, OCFS2_JOURNAL_ACCESS_WRITE); |
1457 | if (status < 0) { | 1454 | if (status < 0) |
1458 | mlog_errno(status); | 1455 | goto out_rollback_prev_bg; |
1459 | goto out_rollback; | ||
1460 | } | ||
1461 | 1456 | ||
1462 | bg->bg_next_group = fe->id2.i_chain.cl_recs[chain].c_blkno; | 1457 | bg->bg_next_group = fe->id2.i_chain.cl_recs[chain].c_blkno; |
1463 | ocfs2_journal_dirty(handle, bg_bh); | 1458 | ocfs2_journal_dirty(handle, bg_bh); |
1464 | 1459 | ||
1465 | status = ocfs2_journal_access_di(handle, INODE_CACHE(alloc_inode), | 1460 | status = ocfs2_journal_access_di(handle, INODE_CACHE(alloc_inode), |
1466 | fe_bh, OCFS2_JOURNAL_ACCESS_WRITE); | 1461 | fe_bh, OCFS2_JOURNAL_ACCESS_WRITE); |
1467 | if (status < 0) { | 1462 | if (status < 0) |
1468 | mlog_errno(status); | 1463 | goto out_rollback_bg; |
1469 | goto out_rollback; | ||
1470 | } | ||
1471 | 1464 | ||
1472 | fe->id2.i_chain.cl_recs[chain].c_blkno = bg->bg_blkno; | 1465 | fe->id2.i_chain.cl_recs[chain].c_blkno = bg->bg_blkno; |
1473 | ocfs2_journal_dirty(handle, fe_bh); | 1466 | ocfs2_journal_dirty(handle, fe_bh); |
1474 | 1467 | ||
1475 | out_rollback: | 1468 | out: |
1476 | if (status < 0) { | 1469 | if (status < 0) |
1477 | fe->id2.i_chain.cl_recs[chain].c_blkno = cpu_to_le64(fe_ptr); | ||
1478 | bg->bg_next_group = cpu_to_le64(bg_ptr); | ||
1479 | prev_bg->bg_next_group = cpu_to_le64(prev_bg_ptr); | ||
1480 | } | ||
1481 | |||
1482 | if (status) | ||
1483 | mlog_errno(status); | 1470 | mlog_errno(status); |
1484 | return status; | 1471 | return status; |
1472 | |||
1473 | out_rollback_bg: | ||
1474 | bg->bg_next_group = cpu_to_le64(bg_ptr); | ||
1475 | out_rollback_prev_bg: | ||
1476 | prev_bg->bg_next_group = cpu_to_le64(prev_bg_ptr); | ||
1477 | goto out; | ||
1485 | } | 1478 | } |
1486 | 1479 | ||
1487 | static inline int ocfs2_block_group_reasonably_empty(struct ocfs2_group_desc *bg, | 1480 | static inline int ocfs2_block_group_reasonably_empty(struct ocfs2_group_desc *bg, |
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 01b85165552b..854d80955bf8 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
@@ -286,10 +286,9 @@ static int ocfs2_osb_dump(struct ocfs2_super *osb, char *buf, int len) | |||
286 | spin_unlock(&osb->osb_lock); | 286 | spin_unlock(&osb->osb_lock); |
287 | 287 | ||
288 | out += snprintf(buf + out, len - out, | 288 | out += snprintf(buf + out, len - out, |
289 | "%10s => Pid: %d Interval: %lu Needs: %d\n", "Commit", | 289 | "%10s => Pid: %d Interval: %lu\n", "Commit", |
290 | (osb->commit_task ? task_pid_nr(osb->commit_task) : -1), | 290 | (osb->commit_task ? task_pid_nr(osb->commit_task) : -1), |
291 | osb->osb_commit_interval, | 291 | osb->osb_commit_interval); |
292 | atomic_read(&osb->needs_checkpoint)); | ||
293 | 292 | ||
294 | out += snprintf(buf + out, len - out, | 293 | out += snprintf(buf + out, len - out, |
295 | "%10s => State: %d TxnId: %lu NumTxns: %d\n", | 294 | "%10s => State: %d TxnId: %lu NumTxns: %d\n", |
@@ -2154,7 +2153,6 @@ static int ocfs2_initialize_super(struct super_block *sb, | |||
2154 | } | 2153 | } |
2155 | 2154 | ||
2156 | init_waitqueue_head(&osb->checkpoint_event); | 2155 | init_waitqueue_head(&osb->checkpoint_event); |
2157 | atomic_set(&osb->needs_checkpoint, 0); | ||
2158 | 2156 | ||
2159 | osb->s_atime_quantum = OCFS2_DEFAULT_ATIME_QUANTUM; | 2157 | osb->s_atime_quantum = OCFS2_DEFAULT_ATIME_QUANTUM; |
2160 | 2158 | ||
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c index 2e3ea308c144..317ef0abccbb 100644 --- a/fs/ocfs2/xattr.c +++ b/fs/ocfs2/xattr.c | |||
@@ -2751,7 +2751,6 @@ static int ocfs2_xattr_ibody_set(struct inode *inode, | |||
2751 | { | 2751 | { |
2752 | int ret; | 2752 | int ret; |
2753 | struct ocfs2_inode_info *oi = OCFS2_I(inode); | 2753 | struct ocfs2_inode_info *oi = OCFS2_I(inode); |
2754 | struct ocfs2_dinode *di = (struct ocfs2_dinode *)xs->inode_bh->b_data; | ||
2755 | struct ocfs2_xa_loc loc; | 2754 | struct ocfs2_xa_loc loc; |
2756 | 2755 | ||
2757 | if (inode->i_sb->s_blocksize == OCFS2_MIN_BLOCKSIZE) | 2756 | if (inode->i_sb->s_blocksize == OCFS2_MIN_BLOCKSIZE) |
@@ -2759,13 +2758,6 @@ static int ocfs2_xattr_ibody_set(struct inode *inode, | |||
2759 | 2758 | ||
2760 | down_write(&oi->ip_alloc_sem); | 2759 | down_write(&oi->ip_alloc_sem); |
2761 | if (!(oi->ip_dyn_features & OCFS2_INLINE_XATTR_FL)) { | 2760 | if (!(oi->ip_dyn_features & OCFS2_INLINE_XATTR_FL)) { |
2762 | if (!ocfs2_xattr_has_space_inline(inode, di)) { | ||
2763 | ret = -ENOSPC; | ||
2764 | goto out; | ||
2765 | } | ||
2766 | } | ||
2767 | |||
2768 | if (!(oi->ip_dyn_features & OCFS2_INLINE_XATTR_FL)) { | ||
2769 | ret = ocfs2_xattr_ibody_init(inode, xs->inode_bh, ctxt); | 2761 | ret = ocfs2_xattr_ibody_init(inode, xs->inode_bh, ctxt); |
2770 | if (ret) { | 2762 | if (ret) { |
2771 | if (ret != -ENOSPC) | 2763 | if (ret != -ENOSPC) |
@@ -6499,6 +6491,16 @@ static int ocfs2_reflink_xattr_inline(struct ocfs2_xattr_reflink *args) | |||
6499 | } | 6491 | } |
6500 | 6492 | ||
6501 | new_oi = OCFS2_I(args->new_inode); | 6493 | new_oi = OCFS2_I(args->new_inode); |
6494 | /* | ||
6495 | * Adjust extent record count to reserve space for extended attribute. | ||
6496 | * Inline data count had been adjusted in ocfs2_duplicate_inline_data(). | ||
6497 | */ | ||
6498 | if (!(new_oi->ip_dyn_features & OCFS2_INLINE_DATA_FL) && | ||
6499 | !(ocfs2_inode_is_fast_symlink(args->new_inode))) { | ||
6500 | struct ocfs2_extent_list *el = &new_di->id2.i_list; | ||
6501 | le16_add_cpu(&el->l_count, -(inline_size / | ||
6502 | sizeof(struct ocfs2_extent_rec))); | ||
6503 | } | ||
6502 | spin_lock(&new_oi->ip_lock); | 6504 | spin_lock(&new_oi->ip_lock); |
6503 | new_oi->ip_dyn_features |= OCFS2_HAS_XATTR_FL | OCFS2_INLINE_XATTR_FL; | 6505 | new_oi->ip_dyn_features |= OCFS2_HAS_XATTR_FL | OCFS2_INLINE_XATTR_FL; |
6504 | new_di->i_dyn_features = cpu_to_le16(new_oi->ip_dyn_features); | 6506 | new_di->i_dyn_features = cpu_to_le16(new_oi->ip_dyn_features); |