[virtio-9p] Ignore O_DIRECT hint from client.
The O_DIRECT flag imposes alignment restrictions on the length and address of userspace buffers and the file offset of I/Os. While VirtFS/9P has plans to implement O_DIRECT behavior on the server, for now we will stick to a behavior like NFS by bypassing the page cache only on the client. Server may still cache the I/O. Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
This commit is contained in:
		
							parent
							
								
									df0973a465
								
							
						
					
					
						commit
						0f8151cb75
					
				@ -1704,6 +1704,8 @@ static void v9fs_open_post_lstat(V9fsState *s, V9fsOpenState *vs, int err)
 | 
				
			|||||||
        if (s->proto_version == V9FS_PROTO_2000L) {
 | 
					        if (s->proto_version == V9FS_PROTO_2000L) {
 | 
				
			||||||
            flags = vs->mode;
 | 
					            flags = vs->mode;
 | 
				
			||||||
            flags &= ~(O_NOCTTY | O_ASYNC | O_CREAT);
 | 
					            flags &= ~(O_NOCTTY | O_ASYNC | O_CREAT);
 | 
				
			||||||
 | 
					            /* Ignore direct disk access hint until the server supports it. */
 | 
				
			||||||
 | 
					            flags &= ~O_DIRECT;
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            flags = omode_to_uflags(vs->mode);
 | 
					            flags = omode_to_uflags(vs->mode);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@ -1826,6 +1828,9 @@ static void v9fs_lcreate(V9fsState *s, V9fsPDU *pdu)
 | 
				
			|||||||
    v9fs_string_sprintf(&vs->fullname, "%s/%s", vs->fidp->path.data,
 | 
					    v9fs_string_sprintf(&vs->fullname, "%s/%s", vs->fidp->path.data,
 | 
				
			||||||
             vs->name.data);
 | 
					             vs->name.data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /* Ignore direct disk access hint until the server supports it. */
 | 
				
			||||||
 | 
					    flags &= ~O_DIRECT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    vs->fidp->fs.fd = v9fs_do_open2(s, vs->fullname.data, vs->fidp->uid,
 | 
					    vs->fidp->fs.fd = v9fs_do_open2(s, vs->fullname.data, vs->fidp->uid,
 | 
				
			||||||
            gid, flags, mode);
 | 
					            gid, flags, mode);
 | 
				
			||||||
    v9fs_lcreate_post_do_open2(s, vs, err);
 | 
					    v9fs_lcreate_post_do_open2(s, vs, err);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user