aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/fat/inode.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index 51b1d15d9d5c..e2effe2dc9b2 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -300,9 +300,9 @@ static int fat_fill_inode(struct inode *inode, struct msdos_dir_entry *de)
300 inode->i_blksize = sbi->cluster_size; 300 inode->i_blksize = sbi->cluster_size;
301 inode->i_blocks = ((inode->i_size + (sbi->cluster_size - 1)) 301 inode->i_blocks = ((inode->i_size + (sbi->cluster_size - 1))
302 & ~((loff_t)sbi->cluster_size - 1)) >> 9; 302 & ~((loff_t)sbi->cluster_size - 1)) >> 9;
303 inode->i_mtime.tv_sec = inode->i_atime.tv_sec = 303 inode->i_mtime.tv_sec =
304 date_dos2unix(le16_to_cpu(de->time), le16_to_cpu(de->date)); 304 date_dos2unix(le16_to_cpu(de->time), le16_to_cpu(de->date));
305 inode->i_mtime.tv_nsec = inode->i_atime.tv_nsec = 0; 305 inode->i_mtime.tv_nsec = 0;
306 if (sbi->options.isvfat) { 306 if (sbi->options.isvfat) {
307 int secs = de->ctime_cs / 100; 307 int secs = de->ctime_cs / 100;
308 int csecs = de->ctime_cs % 100; 308 int csecs = de->ctime_cs % 100;
@@ -310,8 +310,11 @@ static int fat_fill_inode(struct inode *inode, struct msdos_dir_entry *de)
310 date_dos2unix(le16_to_cpu(de->ctime), 310 date_dos2unix(le16_to_cpu(de->ctime),
311 le16_to_cpu(de->cdate)) + secs; 311 le16_to_cpu(de->cdate)) + secs;
312 inode->i_ctime.tv_nsec = csecs * 10000000; 312 inode->i_ctime.tv_nsec = csecs * 10000000;
313 inode->i_atime.tv_sec =
314 date_dos2unix(le16_to_cpu(0), le16_to_cpu(de->adate));
315 inode->i_atime.tv_nsec = 0;
313 } else 316 } else
314 inode->i_ctime = inode->i_mtime; 317 inode->i_ctime = inode->i_atime = inode->i_mtime;
315 318
316 return 0; 319 return 0;
317} 320}
@@ -513,7 +516,9 @@ retry:
513 raw_entry->starthi = cpu_to_le16(MSDOS_I(inode)->i_logstart >> 16); 516 raw_entry->starthi = cpu_to_le16(MSDOS_I(inode)->i_logstart >> 16);
514 fat_date_unix2dos(inode->i_mtime.tv_sec, &raw_entry->time, &raw_entry->date); 517 fat_date_unix2dos(inode->i_mtime.tv_sec, &raw_entry->time, &raw_entry->date);
515 if (sbi->options.isvfat) { 518 if (sbi->options.isvfat) {
519 __le16 atime;
516 fat_date_unix2dos(inode->i_ctime.tv_sec,&raw_entry->ctime,&raw_entry->cdate); 520 fat_date_unix2dos(inode->i_ctime.tv_sec,&raw_entry->ctime,&raw_entry->cdate);
521 fat_date_unix2dos(inode->i_atime.tv_sec,&atime,&raw_entry->adate);
517 raw_entry->ctime_cs = (inode->i_ctime.tv_sec & 1) * 100 + 522 raw_entry->ctime_cs = (inode->i_ctime.tv_sec & 1) * 100 +
518 inode->i_ctime.tv_nsec / 10000000; 523 inode->i_ctime.tv_nsec / 10000000;
519 } 524 }