mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: liubaolin <liubaolin12138@163.com>
To: Hyunchul Lee <hyc.lee@gmail.com>
Cc: linkinjeon@kernel.org, ntfs@lists.linux.dev,
	linux-kernel@vger.kernel.org, Baolin Liu <liubaolin@kylinos.cn>
Subject: Re: [PATCH 1/2] ntfs: implement fileattr_get and fileattr_set
Date: Wed, 2 Sep 2026 15:25:10 +0800	[thread overview]
Message-ID: <2736dac8-8939-46db-99fb-08723fe1cf1a@163.com> (raw)
In-Reply-To: <CANFS6bbVu2mrQXtKJfokDA=6ajReH9Xmm9OA1zVDzQhafHy0mA@mail.gmail.com>



在 2026/9/2 10:00, Hyunchul Lee 写道:
> Hi Baolin,
> 
>> +/*
>> + * ntfs_fileattr_get - inode_operations::fileattr_get
>> + * @dentry:    dentry to report the flags of
>> + * @fa:                filled in with the flags of @dentry
>> + */
>> +int ntfs_fileattr_get(struct dentry *dentry, struct file_kattr *fa)
>> +{
>> +       struct inode *vi = d_inode(dentry);
>> +       struct ntfs_inode *ni = NTFS_I(vi);
>> +       u32 flags = 0;
>> +
>> +       if (NInoCompressed(ni) || NInoWofCompressed(ni))
>> +               flags |= FS_COMPR_FL;
>> +       if (NInoEncrypted(ni))
>> +               flags |= FS_ENCRYPT_FL;
>> +       if (vi->i_flags & S_IMMUTABLE)
>> +               flags |= FS_IMMUTABLE_FL;
>> +       if (vi->i_flags & S_APPEND)
>> +               flags |= FS_APPEND_FL;
> 
> It would be better to set FS_CASEFOLD_FL as well.
> 
>> +int ntfs_fileattr_set(struct mnt_idmap *idmap, struct dentry *dentry,
>> +                     struct file_kattr *fa)
>> +{
>> +       struct inode *vi = d_inode(dentry);
>> +       unsigned int new_fl = 0;
>> +
>> +       if (fileattr_has_fsx(fa))
>> +               return -EOPNOTSUPP;
>> +       if (fa->flags & ~(FS_IMMUTABLE_FL | FS_APPEND_FL))
>> +               return -EOPNOTSUPP;
> 
>> +
>> +       if (fa->flags & FS_IMMUTABLE_FL)
>> +               new_fl |= S_IMMUTABLE;
>> +       if (fa->flags & FS_APPEND_FL)
>> +               new_fl |= S_APPEND;
>> +
>> +       inode_set_flags(vi, new_fl, S_IMMUTABLE | S_APPEND);
>> +
>> +       inode_set_ctime_current(vi);
>> +       mark_inode_dirty(vi);
>> +       return 0;
>> +}
> 
> Currently, these flags are not written to disk.
> I think that we should store them to disk or
> reject them.
> 

Hi Hyunchul,

   I will add FS_CASEFOLD_FL.

   You are right about persistence. Namjae also pointed out that inode
   reclaim can drop these flags before an unmount. I will look into storing
   them on disk.

   Thanks for the review.

Thanks,
Baolin


  reply	other threads:[~2026-09-02  7:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-01  9:15 [PATCH 0/2] ntfs: wire up the fileattr API Baolin Liu
2026-09-01  9:15 ` [PATCH 1/2] ntfs: implement fileattr_get and fileattr_set Baolin Liu
2026-09-02  1:22   ` Namjae Jeon
2026-09-02  6:44     ` liubaolin
2026-09-02  2:00   ` Hyunchul Lee
2026-09-02  7:25     ` liubaolin [this message]
2026-09-01  9:15 ` [PATCH 2/2] ntfs: support the nodump flag Baolin Liu
2026-09-02  1:44 ` [PATCH 0/2] ntfs: wire up the fileattr API Namjae Jeon
2026-09-02  7:26   ` liubaolin
2026-09-08  8:31   ` liubaolin
2026-09-09  4:48     ` Namjae Jeon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2736dac8-8939-46db-99fb-08723fe1cf1a@163.com \
    --to=liubaolin12138@163.com \
    --cc=hyc.lee@gmail.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liubaolin@kylinos.cn \
    --cc=ntfs@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®