Re: [PATCH v8 06/19] block, fs: Propagate write hints to the block device inode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/18/24 10:51, Kanchan Joshi wrote:
Are you considering to change this so that hint is set only on one inode
(and not on two)?
IOW, should not this fragment be like below:

--- a/fs/fcntl.c
+++ b/fs/fcntl.c
@@ -306,7 +306,6 @@ static long fcntl_get_rw_hint(struct file *file,
unsigned int cmd,
   static long fcntl_set_rw_hint(struct file *file, unsigned int cmd,
                                unsigned long arg)
   {
-       void (*apply_whint)(struct file *, enum rw_hint);
          struct inode *inode = file_inode(file);
          u64 __user *argp = (u64 __user *)arg;
          u64 hint;
@@ -316,11 +315,15 @@ static long fcntl_set_rw_hint(struct file *file,
unsigned int cmd,
          if (!rw_hint_valid(hint))
                  return -EINVAL;

+       /*
+        * file->f_mapping->host may differ from inode. As an example
+        * blkdev_open() modifies file->f_mapping
+        */
+       if (file->f_mapping->host != inode)
+               inode = file->f_mapping->host;
+
          inode_lock(inode);
          inode->i_write_hint = hint;
-       apply_whint = inode->i_fop->apply_whint;
-       if (apply_whint)
-               apply_whint(file, hint);
          inode_unlock(inode);

I think the above proposal would introduce a bug: it would break the
F_GET_RW_HINT implementation.

Thanks,

Bart.




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux