diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/fat/fatent.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/fat/fatent.c b/fs/fat/fatent.c index e49d27463b6..81815487e04 100644 --- a/fs/fat/fatent.c +++ b/fs/fat/fatent.c | |||
@@ -503,7 +503,6 @@ int fat_alloc_clusters(struct inode *inode, int *cluster, int nr_cluster) | |||
503 | sbi->prev_free = entry; | 503 | sbi->prev_free = entry; |
504 | if (sbi->free_clusters != -1) | 504 | if (sbi->free_clusters != -1) |
505 | sbi->free_clusters--; | 505 | sbi->free_clusters--; |
506 | mark_fsinfo_dirty(sb); | ||
507 | 506 | ||
508 | cluster[idx_clus] = entry; | 507 | cluster[idx_clus] = entry; |
509 | idx_clus++; | 508 | idx_clus++; |
@@ -525,11 +524,11 @@ int fat_alloc_clusters(struct inode *inode, int *cluster, int nr_cluster) | |||
525 | /* Couldn't allocate the free entries */ | 524 | /* Couldn't allocate the free entries */ |
526 | sbi->free_clusters = 0; | 525 | sbi->free_clusters = 0; |
527 | sbi->free_clus_valid = 1; | 526 | sbi->free_clus_valid = 1; |
528 | mark_fsinfo_dirty(sb); | ||
529 | err = -ENOSPC; | 527 | err = -ENOSPC; |
530 | 528 | ||
531 | out: | 529 | out: |
532 | unlock_fat(sbi); | 530 | unlock_fat(sbi); |
531 | mark_fsinfo_dirty(sb); | ||
533 | fatent_brelse(&fatent); | 532 | fatent_brelse(&fatent); |
534 | if (!err) { | 533 | if (!err) { |
535 | if (inode_needs_sync(inode)) | 534 | if (inode_needs_sync(inode)) |
@@ -554,7 +553,7 @@ int fat_free_clusters(struct inode *inode, int cluster) | |||
554 | struct fat_entry fatent; | 553 | struct fat_entry fatent; |
555 | struct buffer_head *bhs[MAX_BUF_PER_PAGE]; | 554 | struct buffer_head *bhs[MAX_BUF_PER_PAGE]; |
556 | int i, err, nr_bhs; | 555 | int i, err, nr_bhs; |
557 | int first_cl = cluster; | 556 | int first_cl = cluster, dirty_fsinfo = 0; |
558 | 557 | ||
559 | nr_bhs = 0; | 558 | nr_bhs = 0; |
560 | fatent_init(&fatent); | 559 | fatent_init(&fatent); |
@@ -592,7 +591,7 @@ int fat_free_clusters(struct inode *inode, int cluster) | |||
592 | ops->ent_put(&fatent, FAT_ENT_FREE); | 591 | ops->ent_put(&fatent, FAT_ENT_FREE); |
593 | if (sbi->free_clusters != -1) { | 592 | if (sbi->free_clusters != -1) { |
594 | sbi->free_clusters++; | 593 | sbi->free_clusters++; |
595 | mark_fsinfo_dirty(sb); | 594 | dirty_fsinfo = 1; |
596 | } | 595 | } |
597 | 596 | ||
598 | if (nr_bhs + fatent.nr_bhs > MAX_BUF_PER_PAGE) { | 597 | if (nr_bhs + fatent.nr_bhs > MAX_BUF_PER_PAGE) { |
@@ -622,6 +621,8 @@ error: | |||
622 | for (i = 0; i < nr_bhs; i++) | 621 | for (i = 0; i < nr_bhs; i++) |
623 | brelse(bhs[i]); | 622 | brelse(bhs[i]); |
624 | unlock_fat(sbi); | 623 | unlock_fat(sbi); |
624 | if (dirty_fsinfo) | ||
625 | mark_fsinfo_dirty(sb); | ||
625 | 626 | ||
626 | return err; | 627 | return err; |
627 | } | 628 | } |