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;
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;
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;
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;
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;
/*
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);
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;