blob: 461c1dc35d3709e609d67aaea4dbc24aadc3a4c5 [file] [log] [blame]
David Chinnerfe4fa4b2008-10-30 17:06:08 +11001/*
2 * Copyright (c) 2000-2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18#include "xfs.h"
19#include "xfs_fs.h"
20#include "xfs_types.h"
21#include "xfs_bit.h"
22#include "xfs_log.h"
23#include "xfs_inum.h"
24#include "xfs_trans.h"
25#include "xfs_sb.h"
26#include "xfs_ag.h"
27#include "xfs_dir2.h"
28#include "xfs_dmapi.h"
29#include "xfs_mount.h"
30#include "xfs_bmap_btree.h"
31#include "xfs_alloc_btree.h"
32#include "xfs_ialloc_btree.h"
33#include "xfs_btree.h"
34#include "xfs_dir2_sf.h"
35#include "xfs_attr_sf.h"
36#include "xfs_inode.h"
37#include "xfs_dinode.h"
38#include "xfs_error.h"
39#include "xfs_mru_cache.h"
40#include "xfs_filestream.h"
41#include "xfs_vnodeops.h"
42#include "xfs_utils.h"
43#include "xfs_buf_item.h"
44#include "xfs_inode_item.h"
45#include "xfs_rw.h"
46
David Chinnera167b172008-10-30 17:06:18 +110047#include <linux/kthread.h>
48#include <linux/freezer.h>
49
David Chinnerfe4fa4b2008-10-30 17:06:08 +110050/*
51 * xfs_sync flushes any pending I/O to file system vfsp.
52 *
53 * This routine is called by vfs_sync() to make sure that things make it
54 * out to disk eventually, on sync() system calls to flush out everything,
55 * and when the file system is unmounted. For the vfs_sync() case, all
56 * we really need to do is sync out the log to make all of our meta-data
57 * updates permanent (except for timestamps). For calls from pflushd(),
58 * dirty pages are kept moving by calling pdflush() on the inodes
59 * containing them. We also flush the inodes that we can lock without
60 * sleeping and the superblock if we can lock it without sleeping from
61 * vfs_sync() so that items at the tail of the log are always moving out.
62 *
63 * Flags:
64 * SYNC_BDFLUSH - We're being called from vfs_sync() so we don't want
65 * to sleep if we can help it. All we really need
66 * to do is ensure that the log is synced at least
67 * periodically. We also push the inodes and
68 * superblock if we can lock them without sleeping
69 * and they are not pinned.
70 * SYNC_ATTR - We need to flush the inodes. If SYNC_BDFLUSH is not
71 * set, then we really want to lock each inode and flush
72 * it.
73 * SYNC_WAIT - All the flushes that take place in this call should
74 * be synchronous.
75 * SYNC_DELWRI - This tells us to push dirty pages associated with
76 * inodes. SYNC_WAIT and SYNC_BDFLUSH are used to
77 * determine if they should be flushed sync, async, or
78 * delwri.
79 * SYNC_CLOSE - This flag is passed when the system is being
80 * unmounted. We should sync and invalidate everything.
81 * SYNC_FSDATA - This indicates that the caller would like to make
82 * sure the superblock is safe on disk. We can ensure
83 * this by simply making sure the log gets flushed
84 * if SYNC_BDFLUSH is set, and by actually writing it
85 * out otherwise.
86 * SYNC_IOWAIT - The caller wants us to wait for all data I/O to complete
87 * before we return (including direct I/O). Forms the drain
88 * side of the write barrier needed to safely quiesce the
89 * filesystem.
90 *
91 */
92int
93xfs_sync(
94 xfs_mount_t *mp,
95 int flags)
96{
97 int error;
98
99 /*
100 * Get the Quota Manager to flush the dquots.
101 *
102 * If XFS quota support is not enabled or this filesystem
103 * instance does not use quotas XFS_QM_DQSYNC will always
104 * return zero.
105 */
106 error = XFS_QM_DQSYNC(mp, flags);
107 if (error) {
108 /*
109 * If we got an IO error, we will be shutting down.
110 * So, there's nothing more for us to do here.
111 */
112 ASSERT(error != EIO || XFS_FORCED_SHUTDOWN(mp));
113 if (XFS_FORCED_SHUTDOWN(mp))
114 return XFS_ERROR(error);
115 }
116
117 if (flags & SYNC_IOWAIT)
118 xfs_filestream_flush(mp);
119
120 return xfs_syncsub(mp, flags, NULL);
121}
122
123/*
David Chinner683a8972008-10-30 17:07:29 +1100124 * Sync all the inodes in the given AG according to the
125 * direction given by the flags.
David Chinnerfe4fa4b2008-10-30 17:06:08 +1100126 */
David Chinner683a8972008-10-30 17:07:29 +1100127STATIC int
128xfs_sync_inodes_ag(
129 xfs_mount_t *mp,
130 int ag,
131 int flags,
132 int *bypassed)
133{
David Chinner683a8972008-10-30 17:07:29 +1100134 xfs_perag_t *pag = &mp->m_perag[ag];
David Chinner683a8972008-10-30 17:07:29 +1100135 int nr_found;
136 int first_index = 0;
137 int error = 0;
138 int last_error = 0;
139 int fflag = XFS_B_ASYNC;
140 int lock_flags = XFS_ILOCK_SHARED;
141
142 if (flags & SYNC_DELWRI)
143 fflag = XFS_B_DELWRI;
144 if (flags & SYNC_WAIT)
145 fflag = 0; /* synchronous overrides all */
146
147 if (flags & (SYNC_DELWRI | SYNC_CLOSE)) {
148 /*
149 * We need the I/O lock if we're going to call any of
150 * the flush/inval routines.
151 */
152 lock_flags |= XFS_IOLOCK_SHARED;
153 }
154
155 do {
David Chinnerbc60a992008-10-30 17:15:03 +1100156 struct inode *inode;
157 boolean_t inode_refed;
158 xfs_inode_t *ip = NULL;
159
David Chinner683a8972008-10-30 17:07:29 +1100160 /*
161 * use a gang lookup to find the next inode in the tree
162 * as the tree is sparse and a gang lookup walks to find
163 * the number of objects requested.
164 */
165 read_lock(&pag->pag_ici_lock);
166 nr_found = radix_tree_gang_lookup(&pag->pag_ici_root,
167 (void**)&ip, first_index, 1);
168
169 if (!nr_found) {
170 read_unlock(&pag->pag_ici_lock);
171 break;
172 }
173
174 /* update the index for the next lookup */
175 first_index = XFS_INO_TO_AGINO(mp, ip->i_ino + 1);
176
177 /*
178 * skip inodes in reclaim. Let xfs_syncsub do that for
179 * us so we don't need to worry.
180 */
David Chinnerbc60a992008-10-30 17:15:03 +1100181 if (xfs_iflags_test(ip, (XFS_IRECLAIM|XFS_IRECLAIMABLE))) {
David Chinner683a8972008-10-30 17:07:29 +1100182 read_unlock(&pag->pag_ici_lock);
183 continue;
184 }
185
186 /* bad inodes are dealt with elsewhere */
David Chinnerbc60a992008-10-30 17:15:03 +1100187 inode = VFS_I(ip);
188 if (is_bad_inode(inode)) {
David Chinner683a8972008-10-30 17:07:29 +1100189 read_unlock(&pag->pag_ici_lock);
190 continue;
191 }
192
193 /* nothing to sync during shutdown */
194 if (XFS_FORCED_SHUTDOWN(mp) && !(flags & SYNC_CLOSE)) {
195 read_unlock(&pag->pag_ici_lock);
196 return 0;
197 }
198
199 /*
David Chinnerbc60a992008-10-30 17:15:03 +1100200 * If we can't get a reference on the VFS_I, the inode must be
201 * in reclaim. If we can get the inode lock without blocking,
202 * it is safe to flush the inode because we hold the tree lock
203 * and xfs_iextract will block right now. Hence if we lock the
204 * inode while holding the tree lock, xfs_ireclaim() is
205 * guaranteed to block on the inode lock we now hold and hence
206 * it is safe to reference the inode until we drop the inode
207 * locks completely.
David Chinner683a8972008-10-30 17:07:29 +1100208 */
David Chinnerbc60a992008-10-30 17:15:03 +1100209 inode_refed = B_FALSE;
210 if (igrab(inode)) {
David Chinner683a8972008-10-30 17:07:29 +1100211 read_unlock(&pag->pag_ici_lock);
David Chinner683a8972008-10-30 17:07:29 +1100212 xfs_ilock(ip, lock_flags);
David Chinnerbc60a992008-10-30 17:15:03 +1100213 inode_refed = B_TRUE;
David Chinner683a8972008-10-30 17:07:29 +1100214 } else {
David Chinnerbc60a992008-10-30 17:15:03 +1100215 if (!xfs_ilock_nowait(ip, lock_flags)) {
216 /* leave it to reclaim */
217 read_unlock(&pag->pag_ici_lock);
218 continue;
219 }
David Chinner683a8972008-10-30 17:07:29 +1100220 read_unlock(&pag->pag_ici_lock);
221 }
David Chinnerbc60a992008-10-30 17:15:03 +1100222
David Chinner683a8972008-10-30 17:07:29 +1100223 /*
224 * If we have to flush data or wait for I/O completion
225 * we need to drop the ilock that we currently hold.
226 * If we need to drop the lock, insert a marker if we
227 * have not already done so.
228 */
229 if (flags & SYNC_CLOSE) {
230 xfs_iunlock(ip, XFS_ILOCK_SHARED);
231 if (XFS_FORCED_SHUTDOWN(mp))
232 xfs_tosspages(ip, 0, -1, FI_REMAPF);
233 else
234 error = xfs_flushinval_pages(ip, 0, -1,
235 FI_REMAPF);
236 /* wait for I/O on freeze */
237 if (flags & SYNC_IOWAIT)
238 vn_iowait(ip);
239
240 xfs_ilock(ip, XFS_ILOCK_SHARED);
241 }
242
David Chinnerbc60a992008-10-30 17:15:03 +1100243 if ((flags & SYNC_DELWRI) && VN_DIRTY(inode)) {
David Chinner683a8972008-10-30 17:07:29 +1100244 xfs_iunlock(ip, XFS_ILOCK_SHARED);
245 error = xfs_flush_pages(ip, 0, -1, fflag, FI_NONE);
246 if (flags & SYNC_IOWAIT)
247 vn_iowait(ip);
248 xfs_ilock(ip, XFS_ILOCK_SHARED);
249 }
250
251 if ((flags & SYNC_ATTR) && !xfs_inode_clean(ip)) {
252 if (flags & SYNC_WAIT) {
253 xfs_iflock(ip);
254 if (!xfs_inode_clean(ip))
255 error = xfs_iflush(ip, XFS_IFLUSH_SYNC);
256 else
257 xfs_ifunlock(ip);
258 } else if (xfs_iflock_nowait(ip)) {
259 if (!xfs_inode_clean(ip))
260 error = xfs_iflush(ip, XFS_IFLUSH_DELWRI);
261 else
262 xfs_ifunlock(ip);
263 } else if (bypassed) {
264 (*bypassed)++;
265 }
266 }
267
268 if (lock_flags)
269 xfs_iunlock(ip, lock_flags);
270
David Chinnerbc60a992008-10-30 17:15:03 +1100271 if (inode_refed) {
David Chinner683a8972008-10-30 17:07:29 +1100272 IRELE(ip);
David Chinner683a8972008-10-30 17:07:29 +1100273 }
274
275 if (error)
276 last_error = error;
277 /*
278 * bail out if the filesystem is corrupted.
279 */
280 if (error == EFSCORRUPTED)
281 return XFS_ERROR(error);
282
283 } while (nr_found);
284
285 return last_error;
286}
287
David Chinnerfe4fa4b2008-10-30 17:06:08 +1100288int
289xfs_sync_inodes(
290 xfs_mount_t *mp,
291 int flags,
292 int *bypassed)
293{
David Chinnerfe4fa4b2008-10-30 17:06:08 +1100294 int error;
295 int last_error;
David Chinner683a8972008-10-30 17:07:29 +1100296 int i;
David Chinnerfe4fa4b2008-10-30 17:06:08 +1100297
298 if (bypassed)
299 *bypassed = 0;
300 if (mp->m_flags & XFS_MOUNT_RDONLY)
301 return 0;
302 error = 0;
303 last_error = 0;
David Chinnerfe4fa4b2008-10-30 17:06:08 +1100304
David Chinner683a8972008-10-30 17:07:29 +1100305 for (i = 0; i < mp->m_sb.sb_agcount; i++) {
306 if (!mp->m_perag[i].pag_ici_init)
David Chinnerfe4fa4b2008-10-30 17:06:08 +1100307 continue;
David Chinner683a8972008-10-30 17:07:29 +1100308 error = xfs_sync_inodes_ag(mp, i, flags, bypassed);
309 if (error)
David Chinnerfe4fa4b2008-10-30 17:06:08 +1100310 last_error = error;
David Chinner683a8972008-10-30 17:07:29 +1100311 if (error == EFSCORRUPTED)
312 break;
313 }
David Chinnerfe4fa4b2008-10-30 17:06:08 +1100314 return XFS_ERROR(last_error);
315}
316
Christoph Hellwig2af75df2008-10-30 17:14:53 +1100317STATIC int
318xfs_commit_dummy_trans(
319 struct xfs_mount *mp,
320 uint log_flags)
321{
322 struct xfs_inode *ip = mp->m_rootip;
323 struct xfs_trans *tp;
324 int error;
325
326 /*
327 * Put a dummy transaction in the log to tell recovery
328 * that all others are OK.
329 */
330 tp = xfs_trans_alloc(mp, XFS_TRANS_DUMMY1);
331 error = xfs_trans_reserve(tp, 0, XFS_ICHANGE_LOG_RES(mp), 0, 0, 0);
332 if (error) {
333 xfs_trans_cancel(tp, 0);
334 return error;
335 }
336
337 xfs_ilock(ip, XFS_ILOCK_EXCL);
338
339 xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
340 xfs_trans_ihold(tp, ip);
341 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
342 /* XXX(hch): ignoring the error here.. */
343 error = xfs_trans_commit(tp, 0);
344
345 xfs_iunlock(ip, XFS_ILOCK_EXCL);
346
347 xfs_log_force(mp, 0, log_flags);
348 return 0;
349}
350
351STATIC int
352xfs_sync_fsdata(
353 struct xfs_mount *mp,
354 int flags)
355{
356 struct xfs_buf *bp;
357 struct xfs_buf_log_item *bip;
358 int error = 0;
359
360 /*
361 * If this is xfssyncd() then only sync the superblock if we can
362 * lock it without sleeping and it is not pinned.
363 */
364 if (flags & SYNC_BDFLUSH) {
365 ASSERT(!(flags & SYNC_WAIT));
366
367 bp = xfs_getsb(mp, XFS_BUF_TRYLOCK);
368 if (!bp)
369 goto out;
370
371 bip = XFS_BUF_FSPRIVATE(bp, struct xfs_buf_log_item *);
372 if (!bip || !xfs_buf_item_dirty(bip) || XFS_BUF_ISPINNED(bp))
373 goto out_brelse;
374 } else {
375 bp = xfs_getsb(mp, 0);
376
377 /*
378 * If the buffer is pinned then push on the log so we won't
379 * get stuck waiting in the write for someone, maybe
380 * ourselves, to flush the log.
381 *
382 * Even though we just pushed the log above, we did not have
383 * the superblock buffer locked at that point so it can
384 * become pinned in between there and here.
385 */
386 if (XFS_BUF_ISPINNED(bp))
387 xfs_log_force(mp, 0, XFS_LOG_FORCE);
388 }
389
390
391 if (flags & SYNC_WAIT)
392 XFS_BUF_UNASYNC(bp);
393 else
394 XFS_BUF_ASYNC(bp);
395
396 return xfs_bwrite(mp, bp);
397
398 out_brelse:
399 xfs_buf_relse(bp);
400 out:
401 return error;
402}
403
David Chinnerfe4fa4b2008-10-30 17:06:08 +1100404/*
405 * xfs sync routine for internal use
406 *
407 * This routine supports all of the flags defined for the generic vfs_sync
408 * interface as explained above under xfs_sync.
409 *
410 */
411int
412xfs_syncsub(
413 xfs_mount_t *mp,
414 int flags,
415 int *bypassed)
416{
417 int error = 0;
418 int last_error = 0;
419 uint log_flags = XFS_LOG_FORCE;
David Chinnerfe4fa4b2008-10-30 17:06:08 +1100420
421 /*
422 * Sync out the log. This ensures that the log is periodically
423 * flushed even if there is not enough activity to fill it up.
424 */
425 if (flags & SYNC_WAIT)
426 log_flags |= XFS_LOG_SYNC;
427
428 xfs_log_force(mp, (xfs_lsn_t)0, log_flags);
429
430 if (flags & (SYNC_ATTR|SYNC_DELWRI)) {
431 if (flags & SYNC_BDFLUSH)
David Chinner75c68f42008-10-30 17:06:28 +1100432 xfs_finish_reclaim_all(mp, 1, XFS_IFLUSH_DELWRI_ELSE_ASYNC);
David Chinnerfe4fa4b2008-10-30 17:06:08 +1100433 else
434 error = xfs_sync_inodes(mp, flags, bypassed);
435 }
436
437 /*
438 * Flushing out dirty data above probably generated more
439 * log activity, so if this isn't vfs_sync() then flush
440 * the log again.
441 */
Christoph Hellwig2af75df2008-10-30 17:14:53 +1100442 if (flags & SYNC_DELWRI)
443 xfs_log_force(mp, 0, log_flags);
David Chinnerfe4fa4b2008-10-30 17:06:08 +1100444
445 if (flags & SYNC_FSDATA) {
Christoph Hellwig2af75df2008-10-30 17:14:53 +1100446 error = xfs_sync_fsdata(mp, flags);
447 if (error)
David Chinnerfe4fa4b2008-10-30 17:06:08 +1100448 last_error = error;
David Chinnerfe4fa4b2008-10-30 17:06:08 +1100449 }
450
451 /*
452 * Now check to see if the log needs a "dummy" transaction.
453 */
454 if (!(flags & SYNC_REMOUNT) && xfs_log_need_covered(mp)) {
Christoph Hellwig2af75df2008-10-30 17:14:53 +1100455 error = xfs_commit_dummy_trans(mp, log_flags);
456 if (error)
David Chinnerfe4fa4b2008-10-30 17:06:08 +1100457 return error;
David Chinnerfe4fa4b2008-10-30 17:06:08 +1100458 }
459
460 /*
461 * When shutting down, we need to insure that the AIL is pushed
462 * to disk or the filesystem can appear corrupt from the PROM.
463 */
464 if ((flags & (SYNC_CLOSE|SYNC_WAIT)) == (SYNC_CLOSE|SYNC_WAIT)) {
465 XFS_bflush(mp->m_ddev_targp);
466 if (mp->m_rtdev_targp) {
467 XFS_bflush(mp->m_rtdev_targp);
468 }
469 }
470
471 return XFS_ERROR(last_error);
472}
David Chinnera167b172008-10-30 17:06:18 +1100473
474/*
475 * Enqueue a work item to be picked up by the vfs xfssyncd thread.
476 * Doing this has two advantages:
477 * - It saves on stack space, which is tight in certain situations
478 * - It can be used (with care) as a mechanism to avoid deadlocks.
479 * Flushing while allocating in a full filesystem requires both.
480 */
481STATIC void
482xfs_syncd_queue_work(
483 struct xfs_mount *mp,
484 void *data,
485 void (*syncer)(struct xfs_mount *, void *))
486{
487 struct bhv_vfs_sync_work *work;
488
489 work = kmem_alloc(sizeof(struct bhv_vfs_sync_work), KM_SLEEP);
490 INIT_LIST_HEAD(&work->w_list);
491 work->w_syncer = syncer;
492 work->w_data = data;
493 work->w_mount = mp;
494 spin_lock(&mp->m_sync_lock);
495 list_add_tail(&work->w_list, &mp->m_sync_list);
496 spin_unlock(&mp->m_sync_lock);
497 wake_up_process(mp->m_sync_task);
498}
499
500/*
501 * Flush delayed allocate data, attempting to free up reserved space
502 * from existing allocations. At this point a new allocation attempt
503 * has failed with ENOSPC and we are in the process of scratching our
504 * heads, looking about for more room...
505 */
506STATIC void
507xfs_flush_inode_work(
508 struct xfs_mount *mp,
509 void *arg)
510{
511 struct inode *inode = arg;
512 filemap_flush(inode->i_mapping);
513 iput(inode);
514}
515
516void
517xfs_flush_inode(
518 xfs_inode_t *ip)
519{
520 struct inode *inode = VFS_I(ip);
521
522 igrab(inode);
523 xfs_syncd_queue_work(ip->i_mount, inode, xfs_flush_inode_work);
524 delay(msecs_to_jiffies(500));
525}
526
527/*
528 * This is the "bigger hammer" version of xfs_flush_inode_work...
529 * (IOW, "If at first you don't succeed, use a Bigger Hammer").
530 */
531STATIC void
532xfs_flush_device_work(
533 struct xfs_mount *mp,
534 void *arg)
535{
536 struct inode *inode = arg;
537 sync_blockdev(mp->m_super->s_bdev);
538 iput(inode);
539}
540
541void
542xfs_flush_device(
543 xfs_inode_t *ip)
544{
545 struct inode *inode = VFS_I(ip);
546
547 igrab(inode);
548 xfs_syncd_queue_work(ip->i_mount, inode, xfs_flush_device_work);
549 delay(msecs_to_jiffies(500));
550 xfs_log_force(ip->i_mount, (xfs_lsn_t)0, XFS_LOG_FORCE|XFS_LOG_SYNC);
551}
552
553STATIC void
554xfs_sync_worker(
555 struct xfs_mount *mp,
556 void *unused)
557{
558 int error;
559
560 if (!(mp->m_flags & XFS_MOUNT_RDONLY))
561 error = xfs_sync(mp, SYNC_FSDATA | SYNC_BDFLUSH | SYNC_ATTR);
562 mp->m_sync_seq++;
563 wake_up(&mp->m_wait_single_sync_task);
564}
565
566STATIC int
567xfssyncd(
568 void *arg)
569{
570 struct xfs_mount *mp = arg;
571 long timeleft;
572 bhv_vfs_sync_work_t *work, *n;
573 LIST_HEAD (tmp);
574
575 set_freezable();
576 timeleft = xfs_syncd_centisecs * msecs_to_jiffies(10);
577 for (;;) {
578 timeleft = schedule_timeout_interruptible(timeleft);
579 /* swsusp */
580 try_to_freeze();
581 if (kthread_should_stop() && list_empty(&mp->m_sync_list))
582 break;
583
584 spin_lock(&mp->m_sync_lock);
585 /*
586 * We can get woken by laptop mode, to do a sync -
587 * that's the (only!) case where the list would be
588 * empty with time remaining.
589 */
590 if (!timeleft || list_empty(&mp->m_sync_list)) {
591 if (!timeleft)
592 timeleft = xfs_syncd_centisecs *
593 msecs_to_jiffies(10);
594 INIT_LIST_HEAD(&mp->m_sync_work.w_list);
595 list_add_tail(&mp->m_sync_work.w_list,
596 &mp->m_sync_list);
597 }
598 list_for_each_entry_safe(work, n, &mp->m_sync_list, w_list)
599 list_move(&work->w_list, &tmp);
600 spin_unlock(&mp->m_sync_lock);
601
602 list_for_each_entry_safe(work, n, &tmp, w_list) {
603 (*work->w_syncer)(mp, work->w_data);
604 list_del(&work->w_list);
605 if (work == &mp->m_sync_work)
606 continue;
607 kmem_free(work);
608 }
609 }
610
611 return 0;
612}
613
614int
615xfs_syncd_init(
616 struct xfs_mount *mp)
617{
618 mp->m_sync_work.w_syncer = xfs_sync_worker;
619 mp->m_sync_work.w_mount = mp;
620 mp->m_sync_task = kthread_run(xfssyncd, mp, "xfssyncd");
621 if (IS_ERR(mp->m_sync_task))
622 return -PTR_ERR(mp->m_sync_task);
623 return 0;
624}
625
626void
627xfs_syncd_stop(
628 struct xfs_mount *mp)
629{
630 kthread_stop(mp->m_sync_task);
631}
632