]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
kclient: sync writeout when not pdflush
authorYehuda Sadeh <yehuda@hq.newdream.net>
Thu, 19 Feb 2009 17:43:28 +0000 (09:43 -0800)
committerYehuda Sadeh <yehuda@hq.newdream.net>
Thu, 19 Feb 2009 19:52:10 +0000 (11:52 -0800)
src/kernel/addr.c
src/kernel/file.c
src/kernel/inode.c
src/kernel/super.h

index ad2e46d8363e872fb21d31e95698a1e6111ae2c2..baa99a00e506f4cc9ee3dd1c5386505926f67617 100644 (file)
@@ -548,7 +548,7 @@ static int ceph_writepages_start(struct address_space *mapping,
        int rc = 0;
        unsigned wsize = 1 << inode->i_blkbits;
        struct ceph_osd_request *req = NULL;
-       int do_sync = atomic_read(&ci->i_want_sync_writeout);
+       int do_sync = !current_is_pdflush();
 
        if (ceph_caps_revoking(ci) & CEPH_CAP_FILE_WRBUFFER)
                do_sync = 1;
@@ -712,6 +712,7 @@ get_more_pages:
                                                    snapc, do_sync,
                                                    ci->i_truncate_seq,
                                                    ci->i_truncate_size);
+       dout(1, "do_sync(2)=%d\n", do_sync);
                                max_pages = req->r_num_pages;
                                pages = req->r_pages;
                                req->r_callback = writepages_finish;
index 41bfff5ddb407e6c9a5aa44439943648fd9bd5be..16aa67cbf2d15bbdfb1afeed98653701542e32d5 100644 (file)
@@ -372,7 +372,6 @@ static ssize_t ceph_aio_write(struct kiocb *iocb, const struct iovec *iov,
        loff_t endoff = pos + iov->iov_len;
        int got = 0;
        int ret;
-       int do_sync = (file->f_flags & O_SYNC) || IS_SYNC(inode);
 
        if (ceph_snap(inode) != CEPH_NOSNAP)
                return -EROFS;
@@ -399,16 +398,12 @@ retry_snap:
                ret = ceph_sync_write(file, iov->iov_base, iov->iov_len,
                        &iocb->ki_pos);
        } else {
-               if (do_sync)
-                       atomic_inc(&ci->i_want_sync_writeout);
                ret = generic_file_aio_write(iocb, iov, nr_segs, pos);
 
                if (ret >= 0 &&
                    ceph_osdmap_flag(osdc->osdmap, CEPH_OSDMAP_NEARFULL)) {
                        ret = sync_page_range(inode, mapping, pos, ret);
                }
-               if (do_sync)
-                       atomic_dec(&ci->i_want_sync_writeout);
        }
        if (ret >= 0)
                ci->i_dirty_caps |= CEPH_CAP_FILE_WR;
@@ -430,13 +425,10 @@ out:
 static int ceph_fsync(struct file *file, struct dentry *dentry, int datasync)
 {
        struct inode *inode = dentry->d_inode;
-       struct ceph_inode_info *ci = ceph_inode(inode);
        int ret;
 
        dout(10, "fsync on inode %p\n", inode);
-       atomic_inc(&ci->i_want_sync_writeout);
-       ret = write_inode_now(inode, 1);
-       atomic_dec(&ci->i_want_sync_writeout);
+       ret = filemap_write_and_wait(inode->i_mapping);
        if (ret < 0)
                return ret;
        /*
index f0ac9d87e51a2f5520233e0a3ec2cfb4eb67ec92..dc1a9949c3cd9511918f3909dce5271ac9a1dcee 100644 (file)
@@ -287,7 +287,6 @@ struct inode *ceph_alloc_inode(struct super_block *sb)
        ci->i_wrbuffer_ref_head = 0;
        ci->i_rdcache_gen = 0;
        ci->i_rdcache_revoking = 0;
-       atomic_set(&ci->i_want_sync_writeout, 0);
 
        ci->i_snap_realm = NULL;
        INIT_LIST_HEAD(&ci->i_snap_realm_item);
index a7c9cf3b524247be85cf7c8b59d6340263b182e7..8251811dd7f30c796df7d9abddb8763bc919e917 100644 (file)
@@ -279,8 +279,6 @@ struct ceph_inode_info {
                                   pages. */
        u32 i_rdcache_revoking; /* RDCACHE gen to async invalidate, if any */
 
-       atomic_t i_want_sync_writeout; /* non-zero if writepages should sync */
-
        struct ceph_snap_realm *i_snap_realm; /* snap realm (if caps) */
        struct list_head i_snap_realm_item;
        struct list_head i_snap_flush_item;