diff --git a/fs/nilfs2/cpfile.c b/fs/nilfs2/cpfile.c index d192b48df9fb9a80d7e67bc971bd0822a27c8fc6..16f884bd857c2d2cc203220658e85f8356cabf3e 100644 --- a/fs/nilfs2/cpfile.c +++ b/fs/nilfs2/cpfile.c @@ -37,6 +37,7 @@ static unsigned long nilfs_cpfile_get_blkoff(const struct inode *cpfile, __u64 cno) { __u64 tcno = cno + NILFS_MDT(cpfile)->mi_first_entry_offset - 1; + do_div(tcno, nilfs_cpfile_checkpoints_per_block(cpfile)); return (unsigned long)tcno; } @@ -46,6 +47,7 @@ static unsigned long nilfs_cpfile_get_offset(const struct inode *cpfile, __u64 cno) { __u64 tcno = cno + NILFS_MDT(cpfile)->mi_first_entry_offset - 1; + return do_div(tcno, nilfs_cpfile_checkpoints_per_block(cpfile)); } diff --git a/fs/nilfs2/dir.c b/fs/nilfs2/dir.c index 5756dda3083fc8d89f74400f7b582b57c237b9bf..9ca3174f8196f992d2b1c5ad4b16f7f346163dfc 100644 --- a/fs/nilfs2/dir.c +++ b/fs/nilfs2/dir.c @@ -74,6 +74,7 @@ static unsigned nilfs_last_byte(struct inode *inode, unsigned long page_nr) static int nilfs_prepare_chunk(struct page *page, unsigned from, unsigned to) { loff_t pos = page_offset(page) + from; + return __block_write_begin(page, pos, to - from, nilfs_get_block); } @@ -336,6 +337,7 @@ nilfs_find_entry(struct inode *dir, const struct qstr *qstr, n = start; do { char *kaddr; + page = nilfs_get_page(dir, n); if (!IS_ERR(page)) { kaddr = page_address(page); diff --git a/fs/nilfs2/ifile.h b/fs/nilfs2/ifile.h index 1b7d7afcb35e388bf87934bbb6285ed7151667f1..23ad2f091e768c91b52caa69e672d2b9501223c0 100644 --- a/fs/nilfs2/ifile.h +++ b/fs/nilfs2/ifile.h @@ -32,6 +32,7 @@ static inline struct nilfs_inode * nilfs_ifile_map_inode(struct inode *ifile, ino_t ino, struct buffer_head *ibh) { void *kaddr = kmap(ibh->b_page); + return nilfs_palloc_block_get_entry(ifile, ino, ibh, kaddr); } diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c index bbebd5ece02660190fd975c1eb59718c6c429269..aaa129398eab869305ba708482ba8f804b5e6439 100644 --- a/fs/nilfs2/inode.c +++ b/fs/nilfs2/inode.c @@ -851,6 +851,7 @@ int nilfs_setattr(struct dentry *dentry, struct iattr *iattr) int nilfs_permission(struct inode *inode, int mask) { struct nilfs_root *root = NILFS_I(inode)->i_root; + if ((mask & MAY_WRITE) && root && root->cno != NILFS_CPTREE_CURRENT_CNO) return -EROFS; /* snapshot is not writable */ diff --git a/fs/nilfs2/namei.c b/fs/nilfs2/namei.c index 8234af99d7d748480e3cc07d794686b4b6a9b6a7..47bd989d88edef58910adc043868431906e4ec6a 100644 --- a/fs/nilfs2/namei.c +++ b/fs/nilfs2/namei.c @@ -44,6 +44,7 @@ static inline int nilfs_add_nondir(struct dentry *dentry, struct inode *inode) { int err = nilfs_add_link(dentry, inode); + if (!err) { d_instantiate(dentry, inode); unlock_new_inode(inode); diff --git a/fs/nilfs2/recovery.c b/fs/nilfs2/recovery.c index 402a45c2550dca703be705c044a05cfd5e582b19..685fa73cecd08d95db5f4b29060096fe8bcb197d 100644 --- a/fs/nilfs2/recovery.c +++ b/fs/nilfs2/recovery.c @@ -522,6 +522,7 @@ static int nilfs_recover_dsync_blocks(struct the_nilfs *nilfs, 0, &page, nilfs_get_block); if (unlikely(err)) { loff_t isize = inode->i_size; + if (pos + blocksize > isize) nilfs_write_failed(inode->i_mapping, pos + blocksize); diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c index ddbfb09527cd25d1cf35dac7bb7343e85a2be9c4..69e9ea8d53c75b51dd15db9e8ecf74e8ff3830a5 100644 --- a/fs/nilfs2/segment.c +++ b/fs/nilfs2/segment.c @@ -2391,6 +2391,7 @@ static int nilfs_segctor_construct(struct nilfs_sc_info *sci, int mode) static void nilfs_construction_timeout(unsigned long data) { struct task_struct *p = (struct task_struct *)data; + wake_up_process(p); } diff --git a/fs/nilfs2/sufile.c b/fs/nilfs2/sufile.c index df439da883bca897c887ac9c9fdc67fbf2994f7e..1963595a1580193a791b8fa1a3621df957ff7efd 100644 --- a/fs/nilfs2/sufile.c +++ b/fs/nilfs2/sufile.c @@ -57,6 +57,7 @@ static unsigned long nilfs_sufile_get_blkoff(const struct inode *sufile, __u64 segnum) { __u64 t = segnum + NILFS_MDT(sufile)->mi_first_entry_offset; + do_div(t, nilfs_sufile_segment_usages_per_block(sufile)); return (unsigned long)t; } @@ -65,6 +66,7 @@ static unsigned long nilfs_sufile_get_offset(const struct inode *sufile, __u64 segnum) { __u64 t = segnum + NILFS_MDT(sufile)->mi_first_entry_offset; + return do_div(t, nilfs_sufile_segment_usages_per_block(sufile)); } diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c index 2cb78b857df6f684e4d62c399b3eb8f0f53b9396..92acb005b78f398e3709f001d5e86167084f1df8 100644 --- a/fs/nilfs2/super.c +++ b/fs/nilfs2/super.c @@ -743,6 +743,7 @@ static int parse_options(char *options, struct super_block *sb, int is_remount) while ((p = strsep(&options, ",")) != NULL) { int token; + if (!*p) continue; diff --git a/fs/nilfs2/the_nilfs.h b/fs/nilfs2/the_nilfs.h index 6a262933fed9955f1ffc4f0c1a97347e620d2ac9..62bd7b10fe436c3c03afb7634eda6bf50eec85ab 100644 --- a/fs/nilfs2/the_nilfs.h +++ b/fs/nilfs2/the_nilfs.h @@ -269,6 +269,7 @@ struct nilfs_root { static inline int nilfs_sb_need_update(struct the_nilfs *nilfs) { u64 t = get_seconds(); + return t < nilfs->ns_sbwtime || t > nilfs->ns_sbwtime + nilfs->ns_sb_update_freq; } @@ -276,6 +277,7 @@ static inline int nilfs_sb_need_update(struct the_nilfs *nilfs) static inline int nilfs_sb_will_flip(struct the_nilfs *nilfs) { int flip_bits = nilfs->ns_sbwcount & 0x0FL; + return (flip_bits != 0x08 && flip_bits != 0x0F); }