~ubuntu-branches/ubuntu/saucy/linux-ti-omap4/saucy-proposed

« back to all changes in this revision

Viewing changes to fs/fat/inode.c

  • Committer: Package Import Robot
  • Author(s): Paolo Pisati, Paolo Pisati, Stefan Bader, Upstream Kernel Changes
  • Date: 2012-08-15 17:17:43 UTC
  • Revision ID: package-import@ubuntu.com-20120815171743-h5wnuf51xe7pvdid
Tags: 3.5.0-207.13
[ Paolo Pisati ]

* Start new release

[ Stefan Bader ]

* (config) Enable getabis to use local package copies

[ Upstream Kernel Changes ]

* fixup: gargabe collect iva_seq[0|1] init
* [Config] enable all SND_OMAP_SOC_*s
* fixup: cm2xxx_3xxx.o is needed for omap2_cm_read|write_reg
* fixup: add some snd_soc_dai* helper functions
* fixup: s/snd_soc_dpcm_params/snd_soc_dpcm/g
* fixup: typo, no_host_mode and useless SDP4430 init
* fixup: enable again aess hwmod

Show diffs side-by-side

added added

removed removed

Lines of Context:
454
454
                fat_truncate_blocks(inode, 0);
455
455
        }
456
456
        invalidate_inode_buffers(inode);
457
 
        end_writeback(inode);
 
457
        clear_inode(inode);
458
458
        fat_cache_inval_inode(inode);
459
459
        fat_detach(inode);
460
460
}
461
461
 
462
 
static void fat_write_super(struct super_block *sb)
463
 
{
464
 
        lock_super(sb);
465
 
        sb->s_dirt = 0;
466
 
 
467
 
        if (!(sb->s_flags & MS_RDONLY))
468
 
                fat_clusters_flush(sb);
469
 
        unlock_super(sb);
470
 
}
471
 
 
472
 
static int fat_sync_fs(struct super_block *sb, int wait)
473
 
{
474
 
        int err = 0;
475
 
 
476
 
        if (sb->s_dirt) {
477
 
                lock_super(sb);
478
 
                sb->s_dirt = 0;
479
 
                err = fat_clusters_flush(sb);
480
 
                unlock_super(sb);
481
 
        }
482
 
 
483
 
        return err;
484
 
}
485
 
 
486
462
static void fat_put_super(struct super_block *sb)
487
463
{
488
464
        struct msdos_sb_info *sbi = MSDOS_SB(sb);
489
465
 
490
 
        if (sb->s_dirt)
491
 
                fat_write_super(sb);
492
 
 
 
466
        iput(sbi->fsinfo_inode);
493
467
        iput(sbi->fat_inode);
494
468
 
495
469
        unload_nls(sbi->nls_disk);
661
635
 
662
636
static int fat_write_inode(struct inode *inode, struct writeback_control *wbc)
663
637
{
664
 
        return __fat_write_inode(inode, wbc->sync_mode == WB_SYNC_ALL);
 
638
        int err;
 
639
 
 
640
        if (inode->i_ino == MSDOS_FSINFO_INO) {
 
641
                struct super_block *sb = inode->i_sb;
 
642
 
 
643
                lock_super(sb);
 
644
                err = fat_clusters_flush(sb);
 
645
                unlock_super(sb);
 
646
        } else
 
647
                err = __fat_write_inode(inode, wbc->sync_mode == WB_SYNC_ALL);
 
648
 
 
649
        return err;
665
650
}
666
651
 
667
652
int fat_sync_inode(struct inode *inode)
678
663
        .write_inode    = fat_write_inode,
679
664
        .evict_inode    = fat_evict_inode,
680
665
        .put_super      = fat_put_super,
681
 
        .write_super    = fat_write_super,
682
 
        .sync_fs        = fat_sync_fs,
683
666
        .statfs         = fat_statfs,
684
667
        .remount_fs     = fat_remount,
685
668
 
752
735
}
753
736
 
754
737
static int
755
 
fat_encode_fh(struct dentry *de, __u32 *fh, int *lenp, int connectable)
 
738
fat_encode_fh(struct inode *inode, __u32 *fh, int *lenp, struct inode *parent)
756
739
{
757
740
        int len = *lenp;
758
 
        struct inode *inode =  de->d_inode;
759
 
        u32 ipos_h, ipos_m, ipos_l;
 
741
        struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb);
 
742
        loff_t i_pos;
760
743
 
761
744
        if (len < 5) {
762
745
                *lenp = 5;
763
746
                return 255; /* no room */
764
747
        }
765
748
 
766
 
        ipos_h = MSDOS_I(inode)->i_pos >> 8;
767
 
        ipos_m = (MSDOS_I(inode)->i_pos & 0xf0) << 24;
768
 
        ipos_l = (MSDOS_I(inode)->i_pos & 0x0f) << 28;
 
749
        i_pos = fat_i_pos_read(sbi, inode);
769
750
        *lenp = 5;
770
751
        fh[0] = inode->i_ino;
771
752
        fh[1] = inode->i_generation;
772
 
        fh[2] = ipos_h;
773
 
        fh[3] = ipos_m | MSDOS_I(inode)->i_logstart;
774
 
        spin_lock(&de->d_lock);
775
 
        fh[4] = ipos_l | MSDOS_I(de->d_parent->d_inode)->i_logstart;
776
 
        spin_unlock(&de->d_lock);
 
753
        fh[2] = i_pos >> 8;
 
754
        fh[3] = ((i_pos & 0xf0) << 24) | MSDOS_I(inode)->i_logstart;
 
755
        fh[4] = (i_pos & 0x0f) << 28;
 
756
        if (parent)
 
757
                fh[4] |= MSDOS_I(parent)->i_logstart;
777
758
        return 3;
778
759
}
779
760
 
1244
1225
                   void (*setup)(struct super_block *))
1245
1226
{
1246
1227
        struct inode *root_inode = NULL, *fat_inode = NULL;
 
1228
        struct inode *fsinfo_inode = NULL;
1247
1229
        struct buffer_head *bh;
1248
1230
        struct fat_boot_sector *b;
1249
1231
        struct fat_boot_bsx *bsx;
1499
1481
                goto out_fail;
1500
1482
        MSDOS_I(fat_inode)->i_pos = 0;
1501
1483
        sbi->fat_inode = fat_inode;
 
1484
 
 
1485
        fsinfo_inode = new_inode(sb);
 
1486
        if (!fsinfo_inode)
 
1487
                goto out_fail;
 
1488
        fsinfo_inode->i_ino = MSDOS_FSINFO_INO;
 
1489
        sbi->fsinfo_inode = fsinfo_inode;
 
1490
        insert_inode_hash(fsinfo_inode);
 
1491
 
1502
1492
        root_inode = new_inode(sb);
1503
1493
        if (!root_inode)
1504
1494
                goto out_fail;
1525
1515
                fat_msg(sb, KERN_INFO, "Can't find a valid FAT filesystem");
1526
1516
 
1527
1517
out_fail:
 
1518
        if (fsinfo_inode)
 
1519
                iput(fsinfo_inode);
1528
1520
        if (fat_inode)
1529
1521
                iput(fat_inode);
1530
1522
        unload_nls(sbi->nls_io);