Lines Matching refs:file

171 static long kvm_gmem_fallocate(struct file *file, int mode, loff_t offset,
186 ret = kvm_gmem_punch_hole(file_inode(file), offset, len);
188 ret = kvm_gmem_allocate(file_inode(file), offset, len);
191 file_modified(file);
195 static int kvm_gmem_release(struct inode *inode, struct file *file)
197 struct kvm_gmem *gmem = file->private_data;
204 * reference to the file and thus no new bindings can be created, but
214 rcu_assign_pointer(slot->gmem.file, NULL);
220 * Zap all SPTEs pointed at by this file. Do not free the backing
221 * memory, as its lifetime is associated with the inode, not the file.
240 static inline struct file *kvm_gmem_get_file(struct kvm_memory_slot *slot)
243 * Do not return slot->gmem.file if it has already been closed;
245 * kvm_gmem_release() clears slot->gmem.file, and you do not
248 return get_file_active(&slot->gmem.file);
332 struct file *file;
345 file = anon_inode_create_getfile(anon_name, &kvm_gmem_fops, gmem,
347 if (IS_ERR(file)) {
348 err = PTR_ERR(file);
352 file->f_flags |= O_LARGEFILE;
354 inode = file->f_inode;
355 WARN_ON(file->f_mapping != inode->i_mapping);
372 fd_install(fd, file);
404 struct file *file;
409 file = fget(fd);
410 if (!file)
413 if (file->f_op != &kvm_gmem_fops)
416 gmem = file->private_data;
420 inode = file_inode(file);
439 * be see either a NULL file or this new file, no need for them to go
442 rcu_assign_pointer(slot->gmem.file, file);
449 * Drop the reference to the file, even on success. The file pins KVM,
451 * file is closed before memslots are destroyed.
455 fput(file);
464 struct file *file;
467 * Nothing to do if the underlying file was already closed (or is being
470 file = kvm_gmem_get_file(slot);
471 if (!file)
474 gmem = file->private_data;
476 filemap_invalidate_lock(file->f_mapping);
478 rcu_assign_pointer(slot->gmem.file, NULL);
480 filemap_invalidate_unlock(file->f_mapping);
482 fput(file);
492 struct file *file;
495 file = kvm_gmem_get_file(slot);
496 if (!file)
499 gmem = file->private_data;
506 folio = kvm_gmem_get_folio(file_inode(file), index);
528 fput(file);