Skip to contentSkip to conversation

ceph: Don't use ceph-sync-mode for synchronous-fs.

PATCH In review majianpeng 1 participant 2 messages Jun 27, 2013 – Jul 24, 2013 3 messages not in the archive Ceph client

lore
Share & tools
lore

majianpeng

author
#0 lore raw

PATCH 1/1 ceph: Don't use ceph-sync-mode for synchronous-fs.

At now for synchronous-fs, all write-operations use ceph_sync_mode. But for the file which opened with O_SYNC, it don't use sync_mode. The behaviour of them should be the same.
For fs which mounted using '-o sync', it want all I/O to the filesystem should be done synchronously.But the ceph-sync-mode don't be suitful for.For example,using ceph-sync-mode the content of file don't have in memory.This will cause the following read only from osd rather than memory.

---
 fs/ceph/file.c | 2 --
 1 file changed, 2 deletions(-)
fs/ceph/file.c +0 -2
index 656e169..44670ad 100644
@@ -659,7 +659,6 @@ again:
 
 	if ((got & (CEPH_CAP_FILE_CACHE|CEPH_CAP_FILE_LAZYIO)) == 0 ||
 	    (iocb->ki_filp->f_flags & O_DIRECT) ||
-	    (inode->i_sb->s_flags & MS_SYNCHRONOUS) ||
 	    (fi->flags & CEPH_F_SYNC))
 		/* hmm, this isn't really async... */
 		ret = ceph_sync_read(filp, base, len, ppos, &checkeof);
@@ -764,7 +763,6 @@ retry_snap:
 
 	if ((got & (CEPH_CAP_FILE_BUFFER|CEPH_CAP_FILE_LAZYIO)) == 0 ||
 	    (iocb->ki_filp->f_flags & O_DIRECT) ||
-	    (inode->i_sb->s_flags & MS_SYNCHRONOUS) ||
 	    (fi->flags & CEPH_F_SYNC)) {
 		mutex_unlock(&inode->i_mutex);
 		written = ceph_sync_write(file, iov->iov_base, count,
Signature · 1 line
1.8.1.2

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#4 lore raw
Quoted 7 lines

Hi,

Sorry for the slow review. The patch looks good, but I have a hard time understanding your changelog... is it okay if I change it to something like:

Quoted 6 lines

Sending reads and writes through the sync read/write paths bypasses the page cache, which is not expected or generally a good idea. Removing the write check is safe as there is a conditional vfs_fsync_range() later in ceph_aio_write that already checks for the same flag (via IS_SYNC(inode)).

Very good.
It's my fault. I will notice the message later.

Thanks !
Jianpeng Ma

Quoted 49 lines

?

Thanks!
sage

Quoted 41 lines · majianpeng

Ping

Quoted 40 lines

Hi sage,
How about this patch?Can you give some advisement?
Thanks!
Jianpeng Ma

Quoted 36 lines

At now for synchronous-fs, all write-operations use ceph_sync_mode. But for the file which opened with O_SYNC, it don't use sync_mode. The behaviour of them should be the same.
For fs which mounted using '-o sync', it want all I/O to the filesystem should be done synchronously.But the ceph-sync-mode don't be suitful for.For example,using ceph-sync-mode the content of file don't have in memory.This will cause the following read only from osd rather than memory.

---
fs/ceph/file.c | 2 --

1 file changed, 2 deletions(-)
fs/ceph/file.c +0 -2
index 656e169..44670ad 100644
@@ -659,7 +659,6 @@ again:
 
 	if ((got & (CEPH_CAP_FILE_CACHE|CEPH_CAP_FILE_LAZYIO)) == 0 ||
 	    (iocb->ki_filp->f_flags & O_DIRECT) ||
-	    (inode->i_sb->s_flags & MS_SYNCHRONOUS) ||
 	    (fi->flags & CEPH_F_SYNC))
 		/* hmm, this isn't really async... */
 		ret = ceph_sync_read(filp, base, len, ppos, &checkeof);
@@ -764,7 +763,6 @@ retry_snap:
 
 	if ((got & (CEPH_CAP_FILE_BUFFER|CEPH_CAP_FILE_LAZYIO)) == 0 ||
 	    (iocb->ki_filp->f_flags & O_DIRECT) ||
-	    (inode->i_sb->s_flags & MS_SYNCHRONOUS) ||
 	    (fi->flags & CEPH_F_SYNC)) {
 		mutex_unlock(&inode->i_mutex);
 		written = ceph_sync_write(file, iov->iov_base, count,
Signature · 1 line
1.8.1.2