@@ -49,6 +49,7 @@ static void exfat_put_super(struct super_block *sb)
49
49
sync_blockdev (sb -> s_bdev );
50
50
exfat_set_vol_flags (sb , VOL_CLEAN );
51
51
exfat_free_bitmap (sbi );
52
+ brelse (sbi -> pbr_bh );
52
53
mutex_unlock (& sbi -> s_lock );
53
54
54
55
call_rcu (& sbi -> rcu , exfat_delayed_free );
@@ -100,7 +101,7 @@ static int exfat_statfs(struct dentry *dentry, struct kstatfs *buf)
100
101
int exfat_set_vol_flags (struct super_block * sb , unsigned short new_flag )
101
102
{
102
103
struct exfat_sb_info * sbi = EXFAT_SB (sb );
103
- struct pbr64 * bpb ;
104
+ struct pbr64 * bpb = ( struct pbr64 * ) sbi -> pbr_bh -> b_data ;
104
105
bool sync = 0 ;
105
106
106
107
/* flags are not changed */
@@ -115,15 +116,6 @@ int exfat_set_vol_flags(struct super_block *sb, unsigned short new_flag)
115
116
if (sb_rdonly (sb ))
116
117
return 0 ;
117
118
118
- if (!sbi -> pbr_bh ) {
119
- sbi -> pbr_bh = sb_bread (sb , 0 );
120
- if (!sbi -> pbr_bh ) {
121
- exfat_msg (sb , KERN_ERR , "failed to read boot sector" );
122
- return - ENOMEM ;
123
- }
124
- }
125
-
126
- bpb = (struct pbr64 * )sbi -> pbr_bh -> b_data ;
127
119
bpb -> bsx .vol_flags = cpu_to_le16 (new_flag );
128
120
129
121
if (new_flag == VOL_DIRTY && !buffer_dirty (sbi -> pbr_bh ))
@@ -159,7 +151,6 @@ static int exfat_show_options(struct seq_file *m, struct dentry *root)
159
151
seq_puts (m , ",iocharset=utf8" );
160
152
else if (sbi -> nls_io )
161
153
seq_printf (m , ",iocharset=%s" , sbi -> nls_io -> charset );
162
- seq_printf (m , ",bps=%ld" , sb -> s_blocksize );
163
154
if (opts -> errors == EXFAT_ERRORS_CONT )
164
155
seq_puts (m , ",errors=continue" );
165
156
else if (opts -> errors == EXFAT_ERRORS_PANIC )
@@ -351,14 +342,15 @@ static int exfat_read_root(struct inode *inode)
351
342
exfat_save_attr (inode , ATTR_SUBDIR );
352
343
inode -> i_mtime = inode -> i_atime = inode -> i_ctime = ei -> i_crtime =
353
344
current_time (inode );
345
+ exfat_truncate_atime (& inode -> i_atime );
354
346
exfat_cache_init_inode (inode );
355
347
return 0 ;
356
348
}
357
349
358
- static struct pbr * exfat_read_pbr_with_logical_sector (struct super_block * sb ,
359
- struct buffer_head * * prev_bh )
350
+ static struct pbr * exfat_read_pbr_with_logical_sector (struct super_block * sb )
360
351
{
361
- struct pbr * p_pbr = (struct pbr * ) (* prev_bh )-> b_data ;
352
+ struct exfat_sb_info * sbi = EXFAT_SB (sb );
353
+ struct pbr * p_pbr = (struct pbr * ) (sbi -> pbr_bh )-> b_data ;
362
354
unsigned short logical_sect = 0 ;
363
355
364
356
logical_sect = 1 << p_pbr -> bsx .f64 .sect_size_bits ;
@@ -378,26 +370,23 @@ static struct pbr *exfat_read_pbr_with_logical_sector(struct super_block *sb,
378
370
}
379
371
380
372
if (logical_sect > sb -> s_blocksize ) {
381
- struct buffer_head * bh = NULL ;
382
-
383
- __brelse (* prev_bh );
384
- * prev_bh = NULL ;
373
+ brelse (sbi -> pbr_bh );
374
+ sbi -> pbr_bh = NULL ;
385
375
386
376
if (!sb_set_blocksize (sb , logical_sect )) {
387
377
exfat_msg (sb , KERN_ERR ,
388
378
"unable to set blocksize %u" , logical_sect );
389
379
return NULL ;
390
380
}
391
- bh = sb_bread (sb , 0 );
392
- if (!bh ) {
381
+ sbi -> pbr_bh = sb_bread (sb , 0 );
382
+ if (!sbi -> pbr_bh ) {
393
383
exfat_msg (sb , KERN_ERR ,
394
384
"unable to read boot sector (logical sector size = %lu)" ,
395
385
sb -> s_blocksize );
396
386
return NULL ;
397
387
}
398
388
399
- * prev_bh = bh ;
400
- p_pbr = (struct pbr * ) bh -> b_data ;
389
+ p_pbr = (struct pbr * )sbi -> pbr_bh -> b_data ;
401
390
}
402
391
return p_pbr ;
403
392
}
@@ -408,21 +397,20 @@ static int __exfat_fill_super(struct super_block *sb)
408
397
int ret ;
409
398
struct pbr * p_pbr ;
410
399
struct pbr64 * p_bpb ;
411
- struct buffer_head * bh ;
412
400
struct exfat_sb_info * sbi = EXFAT_SB (sb );
413
401
414
402
/* set block size to read super block */
415
403
sb_min_blocksize (sb , 512 );
416
404
417
405
/* read boot sector */
418
- bh = sb_bread (sb , 0 );
419
- if (!bh ) {
406
+ sbi -> pbr_bh = sb_bread (sb , 0 );
407
+ if (!sbi -> pbr_bh ) {
420
408
exfat_msg (sb , KERN_ERR , "unable to read boot sector" );
421
409
return - EIO ;
422
410
}
423
411
424
412
/* PRB is read */
425
- p_pbr = (struct pbr * )bh -> b_data ;
413
+ p_pbr = (struct pbr * )sbi -> pbr_bh -> b_data ;
426
414
427
415
/* check the validity of PBR */
428
416
if (le16_to_cpu ((p_pbr -> signature )) != PBR_SIGNATURE ) {
@@ -433,7 +421,7 @@ static int __exfat_fill_super(struct super_block *sb)
433
421
434
422
435
423
/* check logical sector size */
436
- p_pbr = exfat_read_pbr_with_logical_sector (sb , & bh );
424
+ p_pbr = exfat_read_pbr_with_logical_sector (sb );
437
425
if (!p_pbr ) {
438
426
ret = - EIO ;
439
427
goto free_bh ;
@@ -514,7 +502,7 @@ static int __exfat_fill_super(struct super_block *sb)
514
502
free_upcase_table :
515
503
exfat_free_upcase_table (sbi );
516
504
free_bh :
517
- brelse (bh );
505
+ brelse (sbi -> pbr_bh );
518
506
return ret ;
519
507
}
520
508
@@ -531,17 +519,18 @@ static int exfat_fill_super(struct super_block *sb, struct fs_context *fc)
531
519
if (opts -> discard ) {
532
520
struct request_queue * q = bdev_get_queue (sb -> s_bdev );
533
521
534
- if (!blk_queue_discard (q ))
522
+ if (!blk_queue_discard (q )) {
535
523
exfat_msg (sb , KERN_WARNING ,
536
524
"mounting with \"discard\" option, but the device does not support discard" );
537
- opts -> discard = 0 ;
525
+ opts -> discard = 0 ;
526
+ }
538
527
}
539
528
540
529
sb -> s_flags |= SB_NODIRATIME ;
541
530
sb -> s_magic = EXFAT_SUPER_MAGIC ;
542
531
sb -> s_op = & exfat_sops ;
543
532
544
- sb -> s_time_gran = 1 ;
533
+ sb -> s_time_gran = 10 * NSEC_PER_MSEC ;
545
534
sb -> s_time_min = EXFAT_MIN_TIMESTAMP_SECS ;
546
535
sb -> s_time_max = EXFAT_MAX_TIMESTAMP_SECS ;
547
536
@@ -605,6 +594,7 @@ static int exfat_fill_super(struct super_block *sb, struct fs_context *fc)
605
594
free_table :
606
595
exfat_free_upcase_table (sbi );
607
596
exfat_free_bitmap (sbi );
597
+ brelse (sbi -> pbr_bh );
608
598
609
599
check_nls_io :
610
600
unload_nls (sbi -> nls_io );
@@ -717,6 +707,7 @@ static void __exit exit_exfat_fs(void)
717
707
module_init (init_exfat_fs );
718
708
module_exit (exit_exfat_fs );
719
709
710
+ MODULE_ALIAS_FS ("exfat" );
720
711
MODULE_LICENSE ("GPL" );
721
712
MODULE_DESCRIPTION ("exFAT filesystem support" );
722
713
MODULE_AUTHOR ("Samsung Electronics Co., Ltd." );
0 commit comments