dm.c (5a8f1f80e9dca791ee240213477df99e88258073) | dm.c (b48633f83f22914073314d97d49da2a2e1d3b350) |
---|---|
1/* 2 * Copyright (C) 2001, 2002 Sistina Software (UK) Limited. 3 * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. 4 * 5 * This file is released under the GPL. 6 */ 7 8#include "dm-core.h" --- 1927 unchanged lines hidden (view full) --- 1936} 1937 1938void dm_put(struct mapped_device *md) 1939{ 1940 atomic_dec(&md->holders); 1941} 1942EXPORT_SYMBOL_GPL(dm_put); 1943 | 1/* 2 * Copyright (C) 2001, 2002 Sistina Software (UK) Limited. 3 * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. 4 * 5 * This file is released under the GPL. 6 */ 7 8#include "dm-core.h" --- 1927 unchanged lines hidden (view full) --- 1936} 1937 1938void dm_put(struct mapped_device *md) 1939{ 1940 atomic_dec(&md->holders); 1941} 1942EXPORT_SYMBOL_GPL(dm_put); 1943 |
1944static int dm_wait_for_completion(struct mapped_device *md, int interruptible) | 1944static int dm_wait_for_completion(struct mapped_device *md, long task_state) |
1945{ 1946 int r = 0; 1947 DECLARE_WAITQUEUE(wait, current); 1948 1949 add_wait_queue(&md->wait, &wait); 1950 1951 while (1) { | 1945{ 1946 int r = 0; 1947 DECLARE_WAITQUEUE(wait, current); 1948 1949 add_wait_queue(&md->wait, &wait); 1950 1951 while (1) { |
1952 set_current_state(interruptible); | 1952 set_current_state(task_state); |
1953 1954 if (!md_in_flight(md)) 1955 break; 1956 | 1953 1954 if (!md_in_flight(md)) 1955 break; 1956 |
1957 if (interruptible == TASK_INTERRUPTIBLE && | 1957 if (task_state == TASK_INTERRUPTIBLE && |
1958 signal_pending(current)) { 1959 r = -EINTR; 1960 break; 1961 } 1962 1963 io_schedule(); 1964 } 1965 set_current_state(TASK_RUNNING); --- 111 unchanged lines hidden (view full) --- 2077 return; 2078 2079 thaw_bdev(md->bdev, md->frozen_sb); 2080 md->frozen_sb = NULL; 2081 clear_bit(DMF_FROZEN, &md->flags); 2082} 2083 2084/* | 1958 signal_pending(current)) { 1959 r = -EINTR; 1960 break; 1961 } 1962 1963 io_schedule(); 1964 } 1965 set_current_state(TASK_RUNNING); --- 111 unchanged lines hidden (view full) --- 2077 return; 2078 2079 thaw_bdev(md->bdev, md->frozen_sb); 2080 md->frozen_sb = NULL; 2081 clear_bit(DMF_FROZEN, &md->flags); 2082} 2083 2084/* |
2085 * @suspend_flags: DM_SUSPEND_LOCKFS_FLAG and/or DM_SUSPEND_NOFLUSH_FLAG 2086 * @task_state: e.g. TASK_INTERRUPTIBLE or TASK_UNINTERRUPTIBLE 2087 * @dmf_suspended_flag: DMF_SUSPENDED or DMF_SUSPENDED_INTERNALLY 2088 * |
|
2085 * If __dm_suspend returns 0, the device is completely quiescent 2086 * now. There is no request-processing activity. All new requests 2087 * are being added to md->deferred list. 2088 * 2089 * Caller must hold md->suspend_lock 2090 */ 2091static int __dm_suspend(struct mapped_device *md, struct dm_table *map, | 2089 * If __dm_suspend returns 0, the device is completely quiescent 2090 * now. There is no request-processing activity. All new requests 2091 * are being added to md->deferred list. 2092 * 2093 * Caller must hold md->suspend_lock 2094 */ 2095static int __dm_suspend(struct mapped_device *md, struct dm_table *map, |
2092 unsigned suspend_flags, int interruptible, | 2096 unsigned suspend_flags, long task_state, |
2093 int dmf_suspended_flag) 2094{ 2095 bool do_lockfs = suspend_flags & DM_SUSPEND_LOCKFS_FLAG; 2096 bool noflush = suspend_flags & DM_SUSPEND_NOFLUSH_FLAG; 2097 int r; 2098 2099 lockdep_assert_held(&md->suspend_lock); 2100 --- 52 unchanged lines hidden (view full) --- 2153 2154 flush_workqueue(md->wq); 2155 2156 /* 2157 * At this point no more requests are entering target request routines. 2158 * We call dm_wait_for_completion to wait for all existing requests 2159 * to finish. 2160 */ | 2097 int dmf_suspended_flag) 2098{ 2099 bool do_lockfs = suspend_flags & DM_SUSPEND_LOCKFS_FLAG; 2100 bool noflush = suspend_flags & DM_SUSPEND_NOFLUSH_FLAG; 2101 int r; 2102 2103 lockdep_assert_held(&md->suspend_lock); 2104 --- 52 unchanged lines hidden (view full) --- 2157 2158 flush_workqueue(md->wq); 2159 2160 /* 2161 * At this point no more requests are entering target request routines. 2162 * We call dm_wait_for_completion to wait for all existing requests 2163 * to finish. 2164 */ |
2161 r = dm_wait_for_completion(md, interruptible); | 2165 r = dm_wait_for_completion(md, task_state); |
2162 if (!r) 2163 set_bit(dmf_suspended_flag, &md->flags); 2164 2165 if (noflush) 2166 clear_bit(DMF_NOFLUSH_SUSPENDING, &md->flags); 2167 if (map) 2168 synchronize_srcu(&md->io_barrier); 2169 --- 589 unchanged lines hidden --- | 2166 if (!r) 2167 set_bit(dmf_suspended_flag, &md->flags); 2168 2169 if (noflush) 2170 clear_bit(DMF_NOFLUSH_SUSPENDING, &md->flags); 2171 if (map) 2172 synchronize_srcu(&md->io_barrier); 2173 --- 589 unchanged lines hidden --- |