diff options
author | Sunil Mushran <sunil.mushran@oracle.com> | 2009-06-22 14:40:07 -0400 |
---|---|---|
committer | Joel Becker <joel.becker@oracle.com> | 2009-06-22 17:24:55 -0400 |
commit | df152c241df9e9d2b9a65d37bd02961abe7f591a (patch) | |
tree | 47e0c71919ed437db33530a200113a562b9c6b89 /fs/ocfs2/journal.c | |
parent | 3211949f8998dde71d9fe2e063de045ece5e0473 (diff) |
ocfs2: Disable orphan scanning for local and hard-ro mounts
Local and Hard-RO mounts do not need orphan scanning.
Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/ocfs2/journal.c')
-rw-r--r-- | fs/ocfs2/journal.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c index 0b2c27a9485e..f033760ecbea 100644 --- a/fs/ocfs2/journal.c +++ b/fs/ocfs2/journal.c | |||
@@ -1883,7 +1883,7 @@ void ocfs2_queue_orphan_scan(struct ocfs2_super *osb) | |||
1883 | if (atomic_read(&os->os_state) == ORPHAN_SCAN_INACTIVE) | 1883 | if (atomic_read(&os->os_state) == ORPHAN_SCAN_INACTIVE) |
1884 | goto out; | 1884 | goto out; |
1885 | 1885 | ||
1886 | status = ocfs2_orphan_scan_lock(osb, &seqno, DLM_LOCK_EX); | 1886 | status = ocfs2_orphan_scan_lock(osb, &seqno); |
1887 | if (status < 0) { | 1887 | if (status < 0) { |
1888 | if (status != -EAGAIN) | 1888 | if (status != -EAGAIN) |
1889 | mlog_errno(status); | 1889 | mlog_errno(status); |
@@ -1910,7 +1910,7 @@ void ocfs2_queue_orphan_scan(struct ocfs2_super *osb) | |||
1910 | os->os_count++; | 1910 | os->os_count++; |
1911 | os->os_scantime = CURRENT_TIME; | 1911 | os->os_scantime = CURRENT_TIME; |
1912 | unlock: | 1912 | unlock: |
1913 | ocfs2_orphan_scan_unlock(osb, seqno, DLM_LOCK_EX); | 1913 | ocfs2_orphan_scan_unlock(osb, seqno); |
1914 | out: | 1914 | out: |
1915 | return; | 1915 | return; |
1916 | } | 1916 | } |
@@ -1938,29 +1938,33 @@ void ocfs2_orphan_scan_stop(struct ocfs2_super *osb) | |||
1938 | struct ocfs2_orphan_scan *os; | 1938 | struct ocfs2_orphan_scan *os; |
1939 | 1939 | ||
1940 | os = &osb->osb_orphan_scan; | 1940 | os = &osb->osb_orphan_scan; |
1941 | atomic_set(&os->os_state, ORPHAN_SCAN_INACTIVE); | 1941 | if (atomic_read(&os->os_state) == ORPHAN_SCAN_ACTIVE) { |
1942 | mutex_lock(&os->os_lock); | 1942 | atomic_set(&os->os_state, ORPHAN_SCAN_INACTIVE); |
1943 | cancel_delayed_work(&os->os_orphan_scan_work); | 1943 | mutex_lock(&os->os_lock); |
1944 | mutex_unlock(&os->os_lock); | 1944 | cancel_delayed_work(&os->os_orphan_scan_work); |
1945 | mutex_unlock(&os->os_lock); | ||
1946 | } | ||
1945 | } | 1947 | } |
1946 | 1948 | ||
1947 | int ocfs2_orphan_scan_init(struct ocfs2_super *osb) | 1949 | void ocfs2_orphan_scan_init(struct ocfs2_super *osb) |
1948 | { | 1950 | { |
1949 | struct ocfs2_orphan_scan *os; | 1951 | struct ocfs2_orphan_scan *os; |
1950 | 1952 | ||
1951 | os = &osb->osb_orphan_scan; | 1953 | os = &osb->osb_orphan_scan; |
1952 | atomic_set(&os->os_state, ORPHAN_SCAN_ACTIVE); | ||
1953 | os->os_osb = osb; | 1954 | os->os_osb = osb; |
1954 | os->os_count = 0; | 1955 | os->os_count = 0; |
1955 | os->os_seqno = 0; | 1956 | os->os_seqno = 0; |
1956 | os->os_scantime = CURRENT_TIME; | 1957 | os->os_scantime = CURRENT_TIME; |
1957 | mutex_init(&os->os_lock); | 1958 | mutex_init(&os->os_lock); |
1959 | INIT_DELAYED_WORK(&os->os_orphan_scan_work, ocfs2_orphan_scan_work); | ||
1958 | 1960 | ||
1959 | INIT_DELAYED_WORK(&os->os_orphan_scan_work, | 1961 | if (ocfs2_is_hard_readonly(osb) || ocfs2_mount_local(osb)) |
1960 | ocfs2_orphan_scan_work); | 1962 | atomic_set(&os->os_state, ORPHAN_SCAN_INACTIVE); |
1961 | schedule_delayed_work(&os->os_orphan_scan_work, | 1963 | else { |
1962 | ocfs2_orphan_scan_timeout()); | 1964 | atomic_set(&os->os_state, ORPHAN_SCAN_ACTIVE); |
1963 | return 0; | 1965 | schedule_delayed_work(&os->os_orphan_scan_work, |
1966 | ocfs2_orphan_scan_timeout()); | ||
1967 | } | ||
1964 | } | 1968 | } |
1965 | 1969 | ||
1966 | struct ocfs2_orphan_filldir_priv { | 1970 | struct ocfs2_orphan_filldir_priv { |