~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to fs/xfs/linux-2.6/xfs_super.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
110
110
#define MNTOPT_GQUOTANOENF "gqnoenforce"/* group quota limit enforcement */
111
111
#define MNTOPT_PQUOTANOENF "pqnoenforce"/* project quota limit enforcement */
112
112
#define MNTOPT_QUOTANOENF  "qnoenforce" /* same as uqnoenforce */
113
 
#define MNTOPT_DELAYLOG   "delaylog"    /* Delayed loging enabled */
114
 
#define MNTOPT_NODELAYLOG "nodelaylog"  /* Delayed loging disabled */
 
113
#define MNTOPT_DELAYLOG    "delaylog"   /* Delayed logging enabled */
 
114
#define MNTOPT_NODELAYLOG  "nodelaylog" /* Delayed logging disabled */
 
115
#define MNTOPT_DISCARD     "discard"    /* Discard unused blocks */
 
116
#define MNTOPT_NODISCARD   "nodiscard"  /* Do not discard unused blocks */
115
117
 
116
118
/*
117
119
 * Table driven mount option parser.
173
175
        __uint8_t               iosizelog = 0;
174
176
 
175
177
        /*
 
178
         * set up the mount name first so all the errors will refer to the
 
179
         * correct device.
 
180
         */
 
181
        mp->m_fsname = kstrndup(sb->s_id, MAXNAMELEN, GFP_KERNEL);
 
182
        if (!mp->m_fsname)
 
183
                return ENOMEM;
 
184
        mp->m_fsname_len = strlen(mp->m_fsname) + 1;
 
185
 
 
186
        /*
176
187
         * Copy binary VFS mount flags we are interested in.
177
188
         */
178
189
        if (sb->s_flags & MS_RDONLY)
189
200
        mp->m_flags |= XFS_MOUNT_BARRIER;
190
201
        mp->m_flags |= XFS_MOUNT_COMPAT_IOSIZE;
191
202
        mp->m_flags |= XFS_MOUNT_SMALL_INUMS;
 
203
        mp->m_flags |= XFS_MOUNT_DELAYLOG;
192
204
 
193
205
        /*
194
206
         * These can be overridden by the mount option parsing.
207
219
 
208
220
                if (!strcmp(this_char, MNTOPT_LOGBUFS)) {
209
221
                        if (!value || !*value) {
210
 
                                cmn_err(CE_WARN,
211
 
                                        "XFS: %s option requires an argument",
 
222
                                xfs_warn(mp, "%s option requires an argument",
212
223
                                        this_char);
213
224
                                return EINVAL;
214
225
                        }
215
226
                        mp->m_logbufs = simple_strtoul(value, &eov, 10);
216
227
                } else if (!strcmp(this_char, MNTOPT_LOGBSIZE)) {
217
228
                        if (!value || !*value) {
218
 
                                cmn_err(CE_WARN,
219
 
                                        "XFS: %s option requires an argument",
 
229
                                xfs_warn(mp, "%s option requires an argument",
220
230
                                        this_char);
221
231
                                return EINVAL;
222
232
                        }
223
233
                        mp->m_logbsize = suffix_strtoul(value, &eov, 10);
224
234
                } else if (!strcmp(this_char, MNTOPT_LOGDEV)) {
225
235
                        if (!value || !*value) {
226
 
                                cmn_err(CE_WARN,
227
 
                                        "XFS: %s option requires an argument",
 
236
                                xfs_warn(mp, "%s option requires an argument",
228
237
                                        this_char);
229
238
                                return EINVAL;
230
239
                        }
232
241
                        if (!mp->m_logname)
233
242
                                return ENOMEM;
234
243
                } else if (!strcmp(this_char, MNTOPT_MTPT)) {
235
 
                        cmn_err(CE_WARN,
236
 
                                "XFS: %s option not allowed on this system",
 
244
                        xfs_warn(mp, "%s option not allowed on this system",
237
245
                                this_char);
238
246
                        return EINVAL;
239
247
                } else if (!strcmp(this_char, MNTOPT_RTDEV)) {
240
248
                        if (!value || !*value) {
241
 
                                cmn_err(CE_WARN,
242
 
                                        "XFS: %s option requires an argument",
 
249
                                xfs_warn(mp, "%s option requires an argument",
243
250
                                        this_char);
244
251
                                return EINVAL;
245
252
                        }
248
255
                                return ENOMEM;
249
256
                } else if (!strcmp(this_char, MNTOPT_BIOSIZE)) {
250
257
                        if (!value || !*value) {
251
 
                                cmn_err(CE_WARN,
252
 
                                        "XFS: %s option requires an argument",
 
258
                                xfs_warn(mp, "%s option requires an argument",
253
259
                                        this_char);
254
260
                                return EINVAL;
255
261
                        }
257
263
                        iosizelog = ffs(iosize) - 1;
258
264
                } else if (!strcmp(this_char, MNTOPT_ALLOCSIZE)) {
259
265
                        if (!value || !*value) {
260
 
                                cmn_err(CE_WARN,
261
 
                                        "XFS: %s option requires an argument",
 
266
                                xfs_warn(mp, "%s option requires an argument",
262
267
                                        this_char);
263
268
                                return EINVAL;
264
269
                        }
280
285
                        mp->m_flags |= XFS_MOUNT_SWALLOC;
281
286
                } else if (!strcmp(this_char, MNTOPT_SUNIT)) {
282
287
                        if (!value || !*value) {
283
 
                                cmn_err(CE_WARN,
284
 
                                        "XFS: %s option requires an argument",
 
288
                                xfs_warn(mp, "%s option requires an argument",
285
289
                                        this_char);
286
290
                                return EINVAL;
287
291
                        }
288
292
                        dsunit = simple_strtoul(value, &eov, 10);
289
293
                } else if (!strcmp(this_char, MNTOPT_SWIDTH)) {
290
294
                        if (!value || !*value) {
291
 
                                cmn_err(CE_WARN,
292
 
                                        "XFS: %s option requires an argument",
 
295
                                xfs_warn(mp, "%s option requires an argument",
293
296
                                        this_char);
294
297
                                return EINVAL;
295
298
                        }
297
300
                } else if (!strcmp(this_char, MNTOPT_64BITINODE)) {
298
301
                        mp->m_flags &= ~XFS_MOUNT_SMALL_INUMS;
299
302
#if !XFS_BIG_INUMS
300
 
                        cmn_err(CE_WARN,
301
 
                                "XFS: %s option not allowed on this system",
 
303
                        xfs_warn(mp, "%s option not allowed on this system",
302
304
                                this_char);
303
305
                        return EINVAL;
304
306
#endif
355
357
                        mp->m_flags |= XFS_MOUNT_DELAYLOG;
356
358
                } else if (!strcmp(this_char, MNTOPT_NODELAYLOG)) {
357
359
                        mp->m_flags &= ~XFS_MOUNT_DELAYLOG;
 
360
                } else if (!strcmp(this_char, MNTOPT_DISCARD)) {
 
361
                        mp->m_flags |= XFS_MOUNT_DISCARD;
 
362
                } else if (!strcmp(this_char, MNTOPT_NODISCARD)) {
 
363
                        mp->m_flags &= ~XFS_MOUNT_DISCARD;
358
364
                } else if (!strcmp(this_char, "ihashsize")) {
359
 
                        cmn_err(CE_WARN,
360
 
        "XFS: ihashsize no longer used, option is deprecated.");
 
365
                        xfs_warn(mp,
 
366
        "ihashsize no longer used, option is deprecated.");
361
367
                } else if (!strcmp(this_char, "osyncisdsync")) {
362
 
                        cmn_err(CE_WARN,
363
 
        "XFS: osyncisdsync has no effect, option is deprecated.");
 
368
                        xfs_warn(mp,
 
369
        "osyncisdsync has no effect, option is deprecated.");
364
370
                } else if (!strcmp(this_char, "osyncisosync")) {
365
 
                        cmn_err(CE_WARN,
366
 
        "XFS: osyncisosync has no effect, option is deprecated.");
 
371
                        xfs_warn(mp,
 
372
        "osyncisosync has no effect, option is deprecated.");
367
373
                } else if (!strcmp(this_char, "irixsgid")) {
368
 
                        cmn_err(CE_WARN,
369
 
        "XFS: irixsgid is now a sysctl(2) variable, option is deprecated.");
 
374
                        xfs_warn(mp,
 
375
        "irixsgid is now a sysctl(2) variable, option is deprecated.");
370
376
                } else {
371
 
                        cmn_err(CE_WARN,
372
 
                                "XFS: unknown mount option [%s].", this_char);
 
377
                        xfs_warn(mp, "unknown mount option [%s].", this_char);
373
378
                        return EINVAL;
374
379
                }
375
380
        }
379
384
         */
380
385
        if ((mp->m_flags & XFS_MOUNT_NORECOVERY) &&
381
386
            !(mp->m_flags & XFS_MOUNT_RDONLY)) {
382
 
                cmn_err(CE_WARN, "XFS: no-recovery mounts must be read-only.");
 
387
                xfs_warn(mp, "no-recovery mounts must be read-only.");
383
388
                return EINVAL;
384
389
        }
385
390
 
386
391
        if ((mp->m_flags & XFS_MOUNT_NOALIGN) && (dsunit || dswidth)) {
387
 
                cmn_err(CE_WARN,
388
 
        "XFS: sunit and swidth options incompatible with the noalign option");
 
392
                xfs_warn(mp,
 
393
        "sunit and swidth options incompatible with the noalign option");
 
394
                return EINVAL;
 
395
        }
 
396
 
 
397
        if ((mp->m_flags & XFS_MOUNT_DISCARD) &&
 
398
            !(mp->m_flags & XFS_MOUNT_DELAYLOG)) {
 
399
                xfs_warn(mp,
 
400
        "the discard option is incompatible with the nodelaylog option");
389
401
                return EINVAL;
390
402
        }
391
403
 
392
404
#ifndef CONFIG_XFS_QUOTA
393
405
        if (XFS_IS_QUOTA_RUNNING(mp)) {
394
 
                cmn_err(CE_WARN,
395
 
                        "XFS: quota support not available in this kernel.");
 
406
                xfs_warn(mp, "quota support not available in this kernel.");
396
407
                return EINVAL;
397
408
        }
398
409
#endif
399
410
 
400
411
        if ((mp->m_qflags & (XFS_GQUOTA_ACCT | XFS_GQUOTA_ACTIVE)) &&
401
412
            (mp->m_qflags & (XFS_PQUOTA_ACCT | XFS_PQUOTA_ACTIVE))) {
402
 
                cmn_err(CE_WARN,
403
 
                        "XFS: cannot mount with both project and group quota");
 
413
                xfs_warn(mp, "cannot mount with both project and group quota");
404
414
                return EINVAL;
405
415
        }
406
416
 
407
417
        if ((dsunit && !dswidth) || (!dsunit && dswidth)) {
408
 
                cmn_err(CE_WARN,
409
 
                        "XFS: sunit and swidth must be specified together");
 
418
                xfs_warn(mp, "sunit and swidth must be specified together");
410
419
                return EINVAL;
411
420
        }
412
421
 
413
422
        if (dsunit && (dswidth % dsunit != 0)) {
414
 
                cmn_err(CE_WARN,
415
 
        "XFS: stripe width (%d) must be a multiple of the stripe unit (%d)",
 
423
                xfs_warn(mp,
 
424
        "stripe width (%d) must be a multiple of the stripe unit (%d)",
416
425
                        dswidth, dsunit);
417
426
                return EINVAL;
418
427
        }
438
447
            mp->m_logbufs != 0 &&
439
448
            (mp->m_logbufs < XLOG_MIN_ICLOGS ||
440
449
             mp->m_logbufs > XLOG_MAX_ICLOGS)) {
441
 
                cmn_err(CE_WARN,
442
 
                        "XFS: invalid logbufs value: %d [not %d-%d]",
 
450
                xfs_warn(mp, "invalid logbufs value: %d [not %d-%d]",
443
451
                        mp->m_logbufs, XLOG_MIN_ICLOGS, XLOG_MAX_ICLOGS);
444
452
                return XFS_ERROR(EINVAL);
445
453
        }
448
456
            (mp->m_logbsize < XLOG_MIN_RECORD_BSIZE ||
449
457
             mp->m_logbsize > XLOG_MAX_RECORD_BSIZE ||
450
458
             !is_power_of_2(mp->m_logbsize))) {
451
 
                cmn_err(CE_WARN,
452
 
        "XFS: invalid logbufsize: %d [not 16k,32k,64k,128k or 256k]",
 
459
                xfs_warn(mp,
 
460
                        "invalid logbufsize: %d [not 16k,32k,64k,128k or 256k]",
453
461
                        mp->m_logbsize);
454
462
                return XFS_ERROR(EINVAL);
455
463
        }
456
464
 
457
 
        mp->m_fsname = kstrndup(sb->s_id, MAXNAMELEN, GFP_KERNEL);
458
 
        if (!mp->m_fsname)
459
 
                return ENOMEM;
460
 
        mp->m_fsname_len = strlen(mp->m_fsname) + 1;
461
 
 
462
465
        if (iosizelog) {
463
466
                if (iosizelog > XFS_MAX_IO_LOG ||
464
467
                    iosizelog < XFS_MIN_IO_LOG) {
465
 
                        cmn_err(CE_WARN,
466
 
                "XFS: invalid log iosize: %d [not %d-%d]",
 
468
                        xfs_warn(mp, "invalid log iosize: %d [not %d-%d]",
467
469
                                iosizelog, XFS_MIN_IO_LOG,
468
470
                                XFS_MAX_IO_LOG);
469
471
                        return XFS_ERROR(EINVAL);
499
501
                { XFS_MOUNT_FILESTREAMS,        "," MNTOPT_FILESTREAM },
500
502
                { XFS_MOUNT_GRPID,              "," MNTOPT_GRPID },
501
503
                { XFS_MOUNT_DELAYLOG,           "," MNTOPT_DELAYLOG },
 
504
                { XFS_MOUNT_DISCARD,            "," MNTOPT_DISCARD },
502
505
                { 0, NULL }
503
506
        };
504
507
        static struct proc_xfs_info xfs_info_unset[] = {
610
613
                                    mp);
611
614
        if (IS_ERR(*bdevp)) {
612
615
                error = PTR_ERR(*bdevp);
613
 
                printk("XFS: Invalid device [%s], error=%d\n", name, error);
 
616
                xfs_warn(mp, "Invalid device [%s], error=%d\n", name, error);
614
617
        }
615
618
 
616
619
        return -error;
624
627
                blkdev_put(bdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL);
625
628
}
626
629
 
627
 
/*
628
 
 * Try to write out the superblock using barriers.
629
 
 */
630
 
STATIC int
631
 
xfs_barrier_test(
632
 
        xfs_mount_t     *mp)
633
 
{
634
 
        xfs_buf_t       *sbp = xfs_getsb(mp, 0);
635
 
        int             error;
636
 
 
637
 
        XFS_BUF_UNDONE(sbp);
638
 
        XFS_BUF_UNREAD(sbp);
639
 
        XFS_BUF_UNDELAYWRITE(sbp);
640
 
        XFS_BUF_WRITE(sbp);
641
 
        XFS_BUF_UNASYNC(sbp);
642
 
        XFS_BUF_ORDERED(sbp);
643
 
 
644
 
        xfsbdstrat(mp, sbp);
645
 
        error = xfs_buf_iowait(sbp);
646
 
 
647
 
        /*
648
 
         * Clear all the flags we set and possible error state in the
649
 
         * buffer.  We only did the write to try out whether barriers
650
 
         * worked and shouldn't leave any traces in the superblock
651
 
         * buffer.
652
 
         */
653
 
        XFS_BUF_DONE(sbp);
654
 
        XFS_BUF_ERROR(sbp, 0);
655
 
        XFS_BUF_UNORDERED(sbp);
656
 
 
657
 
        xfs_buf_relse(sbp);
658
 
        return error;
659
 
}
660
 
 
661
 
STATIC void
662
 
xfs_mountfs_check_barriers(xfs_mount_t *mp)
663
 
{
664
 
        int error;
665
 
 
666
 
        if (mp->m_logdev_targp != mp->m_ddev_targp) {
667
 
                xfs_fs_cmn_err(CE_NOTE, mp,
668
 
                  "Disabling barriers, not supported with external log device");
669
 
                mp->m_flags &= ~XFS_MOUNT_BARRIER;
670
 
                return;
671
 
        }
672
 
 
673
 
        if (xfs_readonly_buftarg(mp->m_ddev_targp)) {
674
 
                xfs_fs_cmn_err(CE_NOTE, mp,
675
 
                  "Disabling barriers, underlying device is readonly");
676
 
                mp->m_flags &= ~XFS_MOUNT_BARRIER;
677
 
                return;
678
 
        }
679
 
 
680
 
        error = xfs_barrier_test(mp);
681
 
        if (error) {
682
 
                xfs_fs_cmn_err(CE_NOTE, mp,
683
 
                  "Disabling barriers, trial barrier write failed");
684
 
                mp->m_flags &= ~XFS_MOUNT_BARRIER;
685
 
                return;
686
 
        }
687
 
}
688
 
 
689
630
void
690
631
xfs_blkdev_issue_flush(
691
632
        xfs_buftarg_t           *buftarg)
743
684
                        goto out_close_logdev;
744
685
 
745
686
                if (rtdev == ddev || rtdev == logdev) {
746
 
                        cmn_err(CE_WARN,
747
 
        "XFS: Cannot mount filesystem with identical rtdev and ddev/logdev.");
 
687
                        xfs_warn(mp,
 
688
        "Cannot mount filesystem with identical rtdev and ddev/logdev.");
748
689
                        error = EINVAL;
749
690
                        goto out_close_rtdev;
750
691
                }
827
768
        return 0;
828
769
}
829
770
 
830
 
/*
831
 
 * XFS AIL push thread support
832
 
 */
833
 
void
834
 
xfsaild_wakeup(
835
 
        struct xfs_ail          *ailp,
836
 
        xfs_lsn_t               threshold_lsn)
837
 
{
838
 
        /* only ever move the target forwards */
839
 
        if (XFS_LSN_CMP(threshold_lsn, ailp->xa_target) > 0) {
840
 
                ailp->xa_target = threshold_lsn;
841
 
                wake_up_process(ailp->xa_task);
842
 
        }
843
 
}
844
 
 
845
 
STATIC int
846
 
xfsaild(
847
 
        void    *data)
848
 
{
849
 
        struct xfs_ail  *ailp = data;
850
 
        xfs_lsn_t       last_pushed_lsn = 0;
851
 
        long            tout = 0; /* milliseconds */
852
 
 
853
 
        while (!kthread_should_stop()) {
854
 
                /*
855
 
                 * for short sleeps indicating congestion, don't allow us to
856
 
                 * get woken early. Otherwise all we do is bang on the AIL lock
857
 
                 * without making progress.
858
 
                 */
859
 
                if (tout && tout <= 20)
860
 
                        __set_current_state(TASK_KILLABLE);
861
 
                else
862
 
                        __set_current_state(TASK_INTERRUPTIBLE);
863
 
                schedule_timeout(tout ?
864
 
                                 msecs_to_jiffies(tout) : MAX_SCHEDULE_TIMEOUT);
865
 
 
866
 
                /* swsusp */
867
 
                try_to_freeze();
868
 
 
869
 
                ASSERT(ailp->xa_mount->m_log);
870
 
                if (XFS_FORCED_SHUTDOWN(ailp->xa_mount))
871
 
                        continue;
872
 
 
873
 
                tout = xfsaild_push(ailp, &last_pushed_lsn);
874
 
        }
875
 
 
876
 
        return 0;
877
 
}       /* xfsaild */
878
 
 
879
 
int
880
 
xfsaild_start(
881
 
        struct xfs_ail  *ailp)
882
 
{
883
 
        ailp->xa_target = 0;
884
 
        ailp->xa_task = kthread_run(xfsaild, ailp, "xfsaild/%s",
885
 
                                    ailp->xa_mount->m_fsname);
886
 
        if (IS_ERR(ailp->xa_task))
887
 
                return -PTR_ERR(ailp->xa_task);
888
 
        return 0;
889
 
}
890
 
 
891
 
void
892
 
xfsaild_stop(
893
 
        struct xfs_ail  *ailp)
894
 
{
895
 
        kthread_stop(ailp->xa_task);
896
 
}
897
 
 
898
 
 
899
771
/* Catch misguided souls that try to use this interface on XFS */
900
772
STATIC struct inode *
901
773
xfs_fs_alloc_inode(
991
863
 */
992
864
STATIC void
993
865
xfs_fs_dirty_inode(
994
 
        struct inode    *inode)
 
866
        struct inode    *inode,
 
867
        int             flags)
995
868
{
996
869
        barrier();
997
870
        XFS_I(inode)->i_update_core = 1;
1089
962
                        error = 0;
1090
963
                        goto out_unlock;
1091
964
                }
1092
 
                error = xfs_iflush(ip, 0);
 
965
                error = xfs_iflush(ip, SYNC_TRYLOCK);
1093
966
        }
1094
967
 
1095
968
 out_unlock:
1202
1075
                return -error;
1203
1076
 
1204
1077
        if (laptop_mode) {
1205
 
                int     prev_sync_seq = mp->m_sync_seq;
1206
 
 
1207
1078
                /*
1208
1079
                 * The disk must be active because we're syncing.
1209
1080
                 * We schedule xfssyncd now (now that the disk is
1210
1081
                 * active) instead of later (when it might not be).
1211
1082
                 */
1212
 
                wake_up_process(mp->m_sync_task);
1213
 
                /*
1214
 
                 * We have to wait for the sync iteration to complete.
1215
 
                 * If we don't, the disk activity caused by the sync
1216
 
                 * will come after the sync is completed, and that
1217
 
                 * triggers another sync from laptop mode.
1218
 
                 */
1219
 
                wait_event(mp->m_wait_single_sync_task,
1220
 
                                mp->m_sync_seq != prev_sync_seq);
 
1083
                flush_delayed_work_sync(&mp->m_sync_work);
1221
1084
        }
1222
1085
 
1223
1086
        return 0;
1315
1178
                switch (token) {
1316
1179
                case Opt_barrier:
1317
1180
                        mp->m_flags |= XFS_MOUNT_BARRIER;
1318
 
 
1319
 
                        /*
1320
 
                         * Test if barriers are actually working if we can,
1321
 
                         * else delay this check until the filesystem is
1322
 
                         * marked writeable.
1323
 
                         */
1324
 
                        if (!(mp->m_flags & XFS_MOUNT_RDONLY))
1325
 
                                xfs_mountfs_check_barriers(mp);
1326
1181
                        break;
1327
1182
                case Opt_nobarrier:
1328
1183
                        mp->m_flags &= ~XFS_MOUNT_BARRIER;
1345
1200
                         * options that we can't actually change.
1346
1201
                         */
1347
1202
#if 0
1348
 
                        printk(KERN_INFO
1349
 
        "XFS: mount option \"%s\" not supported for remount\n", p);
 
1203
                        xfs_info(mp,
 
1204
                "mount option \"%s\" not supported for remount\n", p);
1350
1205
                        return -EINVAL;
1351
1206
#else
1352
1207
                        break;
1357
1212
        /* ro -> rw */
1358
1213
        if ((mp->m_flags & XFS_MOUNT_RDONLY) && !(*flags & MS_RDONLY)) {
1359
1214
                mp->m_flags &= ~XFS_MOUNT_RDONLY;
1360
 
                if (mp->m_flags & XFS_MOUNT_BARRIER)
1361
 
                        xfs_mountfs_check_barriers(mp);
1362
1215
 
1363
1216
                /*
1364
1217
                 * If this is the first remount to writeable state we
1367
1220
                if (mp->m_update_flags) {
1368
1221
                        error = xfs_mount_log_sb(mp, mp->m_update_flags);
1369
1222
                        if (error) {
1370
 
                                cmn_err(CE_WARN,
1371
 
                                        "XFS: failed to write sb changes");
 
1223
                                xfs_warn(mp, "failed to write sb changes");
1372
1224
                                return error;
1373
1225
                        }
1374
1226
                        mp->m_update_flags = 0;
1452
1304
                        mp->m_logbsize = mp->m_sb.sb_logsunit;
1453
1305
                } else if (mp->m_logbsize > 0 &&
1454
1306
                           mp->m_logbsize < mp->m_sb.sb_logsunit) {
1455
 
                        cmn_err(CE_WARN,
1456
 
        "XFS: logbuf size must be greater than or equal to log stripe size");
 
1307
                        xfs_warn(mp,
 
1308
                "logbuf size must be greater than or equal to log stripe size");
1457
1309
                        return XFS_ERROR(EINVAL);
1458
1310
                }
1459
1311
        } else {
1460
1312
                /* Fail a mount if the logbuf is larger than 32K */
1461
1313
                if (mp->m_logbsize > XLOG_BIG_RECORD_BSIZE) {
1462
 
                        cmn_err(CE_WARN,
1463
 
        "XFS: logbuf size for version 1 logs must be 16K or 32K");
 
1314
                        xfs_warn(mp,
 
1315
                "logbuf size for version 1 logs must be 16K or 32K");
1464
1316
                        return XFS_ERROR(EINVAL);
1465
1317
                }
1466
1318
        }
1477
1329
         * prohibit r/w mounts of read-only filesystems
1478
1330
         */
1479
1331
        if ((mp->m_sb.sb_flags & XFS_SBF_READONLY) && !ronly) {
1480
 
                cmn_err(CE_WARN,
1481
 
        "XFS: cannot mount a read-only filesystem as read-write");
 
1332
                xfs_warn(mp,
 
1333
                        "cannot mount a read-only filesystem as read-write");
1482
1334
                return XFS_ERROR(EROFS);
1483
1335
        }
1484
1336
 
1502
1354
        spin_lock_init(&mp->m_sb_lock);
1503
1355
        mutex_init(&mp->m_growlock);
1504
1356
        atomic_set(&mp->m_active_trans, 0);
1505
 
        INIT_LIST_HEAD(&mp->m_sync_list);
1506
 
        spin_lock_init(&mp->m_sync_lock);
1507
 
        init_waitqueue_head(&mp->m_wait_single_sync_task);
1508
1357
 
1509
1358
        mp->m_super = sb;
1510
1359
        sb->s_fs_info = mp;
1544
1393
        if (error)
1545
1394
                goto out_free_sb;
1546
1395
 
1547
 
        if (mp->m_flags & XFS_MOUNT_BARRIER)
1548
 
                xfs_mountfs_check_barriers(mp);
1549
 
 
1550
1396
        error = xfs_filestream_mount(mp);
1551
1397
        if (error)
1552
1398
                goto out_free_sb;
1811
1657
}
1812
1658
 
1813
1659
STATIC int __init
 
1660
xfs_init_workqueues(void)
 
1661
{
 
1662
        /*
 
1663
         * max_active is set to 8 to give enough concurency to allow
 
1664
         * multiple work operations on each CPU to run. This allows multiple
 
1665
         * filesystems to be running sync work concurrently, and scales with
 
1666
         * the number of CPUs in the system.
 
1667
         */
 
1668
        xfs_syncd_wq = alloc_workqueue("xfssyncd", WQ_CPU_INTENSIVE, 8);
 
1669
        if (!xfs_syncd_wq)
 
1670
                goto out;
 
1671
 
 
1672
        xfs_ail_wq = alloc_workqueue("xfsail", WQ_CPU_INTENSIVE, 8);
 
1673
        if (!xfs_ail_wq)
 
1674
                goto out_destroy_syncd;
 
1675
 
 
1676
        return 0;
 
1677
 
 
1678
out_destroy_syncd:
 
1679
        destroy_workqueue(xfs_syncd_wq);
 
1680
out:
 
1681
        return -ENOMEM;
 
1682
}
 
1683
 
 
1684
STATIC void
 
1685
xfs_destroy_workqueues(void)
 
1686
{
 
1687
        destroy_workqueue(xfs_ail_wq);
 
1688
        destroy_workqueue(xfs_syncd_wq);
 
1689
}
 
1690
 
 
1691
STATIC int __init
1814
1692
init_xfs_fs(void)
1815
1693
{
1816
1694
        int                     error;
1825
1703
        if (error)
1826
1704
                goto out;
1827
1705
 
 
1706
        error = xfs_init_workqueues();
 
1707
        if (error)
 
1708
                goto out_destroy_zones;
 
1709
 
1828
1710
        error = xfs_mru_cache_init();
1829
1711
        if (error)
1830
 
                goto out_destroy_zones;
 
1712
                goto out_destroy_wq;
1831
1713
 
1832
1714
        error = xfs_filestream_init();
1833
1715
        if (error)
1862
1744
        xfs_filestream_uninit();
1863
1745
 out_mru_cache_uninit:
1864
1746
        xfs_mru_cache_uninit();
 
1747
 out_destroy_wq:
 
1748
        xfs_destroy_workqueues();
1865
1749
 out_destroy_zones:
1866
1750
        xfs_destroy_zones();
1867
1751
 out:
1878
1762
        xfs_buf_terminate();
1879
1763
        xfs_filestream_uninit();
1880
1764
        xfs_mru_cache_uninit();
 
1765
        xfs_destroy_workqueues();
1881
1766
        xfs_destroy_zones();
1882
1767
}
1883
1768