diff options
author | Sage Weil <sage@newdream.net> | 2010-02-09 18:24:44 -0500 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2010-02-11 14:48:54 -0500 |
commit | 3c6f6b79a64db7f1c7abf09d693db3b0066784fb (patch) | |
tree | e17b4cd848212b0556180331280044dd1526b742 /fs/ceph/caps.c | |
parent | 6a026589ba333185c466c906376fe022a27a53f9 (diff) |
ceph: cleanup async writeback, truncation, invalidate helpers
Grab inode ref in helper. Make work functions static, with consistent
naming.
Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/caps.c')
-rw-r--r-- | fs/ceph/caps.c | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index 7f4841cd3a2b..68ee78109224 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c | |||
@@ -1602,8 +1602,7 @@ ack: | |||
1602 | spin_unlock(&inode->i_lock); | 1602 | spin_unlock(&inode->i_lock); |
1603 | 1603 | ||
1604 | if (queue_invalidate) | 1604 | if (queue_invalidate) |
1605 | if (ceph_queue_page_invalidation(inode)) | 1605 | ceph_queue_invalidate(inode); |
1606 | igrab(inode); | ||
1607 | 1606 | ||
1608 | if (session && drop_session_lock) | 1607 | if (session && drop_session_lock) |
1609 | mutex_unlock(&session->s_mutex); | 1608 | mutex_unlock(&session->s_mutex); |
@@ -2178,7 +2177,7 @@ static int handle_cap_grant(struct inode *inode, struct ceph_mds_caps *grant, | |||
2178 | int wake = 0; | 2177 | int wake = 0; |
2179 | int writeback = 0; | 2178 | int writeback = 0; |
2180 | int revoked_rdcache = 0; | 2179 | int revoked_rdcache = 0; |
2181 | int invalidate_async = 0; | 2180 | int queue_invalidate = 0; |
2182 | int tried_invalidate = 0; | 2181 | int tried_invalidate = 0; |
2183 | int ret; | 2182 | int ret; |
2184 | 2183 | ||
@@ -2205,7 +2204,7 @@ restart: | |||
2205 | /* there were locked pages.. invalidate later | 2204 | /* there were locked pages.. invalidate later |
2206 | in a separate thread. */ | 2205 | in a separate thread. */ |
2207 | if (ci->i_rdcache_revoking != ci->i_rdcache_gen) { | 2206 | if (ci->i_rdcache_revoking != ci->i_rdcache_gen) { |
2208 | invalidate_async = 1; | 2207 | queue_invalidate = 1; |
2209 | ci->i_rdcache_revoking = ci->i_rdcache_gen; | 2208 | ci->i_rdcache_revoking = ci->i_rdcache_gen; |
2210 | } | 2209 | } |
2211 | } else { | 2210 | } else { |
@@ -2319,21 +2318,15 @@ restart: | |||
2319 | } | 2318 | } |
2320 | 2319 | ||
2321 | spin_unlock(&inode->i_lock); | 2320 | spin_unlock(&inode->i_lock); |
2322 | if (writeback) { | 2321 | if (writeback) |
2323 | /* | 2322 | /* |
2324 | * queue inode for writeback: we can't actually call | 2323 | * queue inode for writeback: we can't actually call |
2325 | * filemap_write_and_wait, etc. from message handler | 2324 | * filemap_write_and_wait, etc. from message handler |
2326 | * context. | 2325 | * context. |
2327 | */ | 2326 | */ |
2328 | dout("queueing %p for writeback\n", inode); | 2327 | ceph_queue_writeback(inode); |
2329 | if (ceph_queue_writeback(inode)) | 2328 | if (queue_invalidate) |
2330 | igrab(inode); | 2329 | ceph_queue_invalidate(inode); |
2331 | } | ||
2332 | if (invalidate_async) { | ||
2333 | dout("queueing %p for page invalidation\n", inode); | ||
2334 | if (ceph_queue_page_invalidation(inode)) | ||
2335 | igrab(inode); | ||
2336 | } | ||
2337 | if (wake) | 2330 | if (wake) |
2338 | wake_up(&ci->i_cap_wq); | 2331 | wake_up(&ci->i_cap_wq); |
2339 | return reply; | 2332 | return reply; |
@@ -2479,9 +2472,7 @@ static void handle_cap_trunc(struct inode *inode, | |||
2479 | spin_unlock(&inode->i_lock); | 2472 | spin_unlock(&inode->i_lock); |
2480 | 2473 | ||
2481 | if (queue_trunc) | 2474 | if (queue_trunc) |
2482 | if (queue_work(ceph_client(inode->i_sb)->trunc_wq, | 2475 | ceph_queue_vmtruncate(inode); |
2483 | &ci->i_vmtruncate_work)) | ||
2484 | igrab(inode); | ||
2485 | } | 2476 | } |
2486 | 2477 | ||
2487 | /* | 2478 | /* |