On 2023/6/29 0:46, Matthew Wilcox wrote:
On Wed, Jun 28, 2023 at 05:34:54PM +0800, Yangtao Li wrote:
Introduce queue_logical_block_mask() and bdev_logical_block_mask()
to simplify code, which replace (queue_logical_block_size(q) - 1)
and (bdev_logical_block_size(bdev) - 1).
The thing is that
Use bdev_logical_block_mask() to simplify code.
Signed-off-by: Yangtao Li
---
block/bio.c | 2 +-
block/fops.c | 4 ++--
block/ioctl.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/block/bio.c b/block/bio.c
index 8672179213b9..42ccf5a21696 100644
--- a/block/bio.c
Use bdev_logical_block_mask() to simplify code.
Signed-off-by: Yangtao Li
---
fs/erofs/data.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/erofs/data.c b/fs/erofs/data.c
index db5e4b7636ec..13bd185ef3b3 100644
--- a/fs/erofs/data.c
+++ b/fs/erofs/data.c
@@ -387,7
Use bdev_logical_block_mask() to simplify code.
Signed-off-by: Yangtao Li
---
fs/xfs/xfs_buf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index 15d1e5a7c2d3..f784daa21219 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -1968,7
Use bdev_logical_block_mask() to simplify code.
Signed-off-by: Yangtao Li
---
fs/iomap/direct-io.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c
index ea3b868c8355..8d4a06bc14b3 100644
--- a/fs/iomap/direct-io.c
+++ b/fs/iomap
Use bdev_logical_block_mask() to simplify code.
Signed-off-by: Yangtao Li
---
fs/buffer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/buffer.c b/fs/buffer.c
index bd091329026c..fd2705465a5e 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -1128,7 +1128,7 @@ __getblk_slow
Introduce queue_logical_block_mask() and bdev_logical_block_mask()
to simplify code, which replace (queue_logical_block_size(q) - 1)
and (bdev_logical_block_size(bdev) - 1).
Signed-off-by: Yangtao Li
---
include/linux/blkdev.h | 10 ++
1 file changed, 10 insertions(+)
diff --git a
Use queue_logical_block_mask() to simplify code.
Signed-off-by: Yangtao Li
---
drivers/md/md.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 2e38ef421d69..fd646e5ed082 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1649,7
It's redundant, let's remove it.
Signed-off-by: Yangtao Li
---
fs/erofs/super.c | 7 ++-
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/fs/erofs/super.c b/fs/erofs/super.c
index 811ab66d805e..f48ce692094d 100644
--- a/fs/erofs/super.c
+++ b/fs/erofs/super.c
@
It is better not to directly access the internal members of the
kobject object, especially kobject_init_and_add() may failure.
BTW remove unnecessary kobject_del(), kobject_put() actually covers
kobject removal automatically, which is single stage removal.
Signed-off-by: Yangtao Li
---
fs/erofs
Hi all,
> Later, I thought I could send some demo code that strips the kobject in sbi
> into a pointer.
I made the following modifications, not sure if I'm going the right way.
diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h
index 1db018f8c2e8..8e1799f690c0 100644
--- a/fs/erofs/internal
Hi Greg,
> just let it hang off as a separate structure (i.e. a pointer to something
> else.)
I have made some attempts. According to my understanding, the reason why the
filesystem needs to embed the kobj structure (not a pointer) is that the
kobj_to_sbi
method is required in the attr_store/at
Hi Greg,
> That isn't going to work, and as proof of that, the release callback
> should be a simple call to kfree(), NOT as a completion notification
> which then something else will go off and free the memory here. That
> implies that there are multiple reference counting structures happening
>
> > Meta-comment, we need to come up with a "filesystem kobject type" to get
> > rid of lots of the boilerplate filesystem kobject logic as it's
> > duplicated in every filesystem in tiny different ways and lots of times
> > (like here), it's wrong.
>
> Can we add the following structure?
>
> str
> Meta-comment, we need to come up with a "filesystem kobject type" to get
> rid of lots of the boilerplate filesystem kobject logic as it's
> duplicated in every filesystem in tiny different ways and lots of times
> (like here), it's wrong.
Can we add the following structure?
struct filesystem_k
HI Gao Xiang,
> Would you mind taking a look at
> commit a942da24abc5 ("fs: erofs: add sanity check for kobject in
> erofs_unregister_sysfs")
>
> , which could be "git-blame"ed (I'd suggest looking into these
> blame first), and the related discussion was:
>
> https://lore.kernel.org/r/CAD-N9QXNx
Use kobject_is_added() instead of local `s_sysfs_registered` variables.
BTW kill kobject_del() directly, because kobject_put() actually covers
kobject removal automatically.
Signed-off-by: Yangtao Li
---
fs/zonefs/sysfs.c | 11 +--
fs/zonefs/zonefs.h | 1 -
2 files changed, 5
Use kobject_is_added() instead of directly accessing the internal
variables of kobject. BTW kill kobject_del() directly, because
kobject_put() actually covers kobject removal automatically.
Signed-off-by: Yangtao Li
---
fs/erofs/sysfs.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions
Add kobject_is_added() to avoid consumers from directly accessing
the internal variables of kobject.
Signed-off-by: Yangtao Li
---
include/linux/kobject.h | 5 +
1 file changed, 5 insertions(+)
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index bdab370a24f4..b5cdb0c58729
kobject_put() actually covers kobject removal automatically, which is
single stage removal. So it is safe to kill kobject_del() directly.
Signed-off-by: Yangtao Li
---
fs/erofs/sysfs.c | 7 ++-
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/fs/erofs/sysfs.c b/fs/erofs/sysfs.c
> kobject_put() actually covers kobject removal automatically, which is
> single stage removal. So if you see the two called together, it is
> safe to kill kobject_del() directly.
If the reference count is not abnormal, kobject_put() does contain
what kobject_del() does.
Thx,
Yangtao
Use kobject_del_and_put() to simplify code.
Cc: Greg Kroah-Hartman
Cc: "Rafael J. Wysocki"
Cc: Damien Le Moal
Signed-off-by: Yangtao Li
---
fs/erofs/sysfs.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/erofs/sysfs.c b/fs/erofs/sysfs.c
index 43
There are plenty of using kobject_del() and kobject_put() together
in the kernel tree. This patch wraps these two calls in a single helper.
Signed-off-by: Yangtao Li
---
v3:
-convert to inline helper
v2:
-add kobject_del_and_put() users
include/linux/kobject.h | 13 +
lib/kobject.c
Use kobject_del_and_put() to simplify code.
Cc: Greg Kroah-Hartman
Cc: "Rafael J. Wysocki"
Cc: Damien Le Moal
Signed-off-by: Yangtao Li
---
fs/erofs/sysfs.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/erofs/sysfs.c b/fs/erofs/sysfs.c
index 43
There are plenty of using kobject_del() and kobject_put() together
in the kernel tree. This patch wraps these two calls in a single helper.
Signed-off-by: Yangtao Li
---
v2:
-add kobject_del_and_put() users
resend patchset to gregkh, Rafael and Damien
include/linux/kobject.h | 1 +
lib
Hi filesystem maintainers,
> Hard to comment on patches with this. It is only 10 patches. So send
> everything please.
If you are interested in the entire patchset besides Damien,
please let me know. I'll resend the email later to cc more people.
Thx,
Yangtao
Hi all,
Out of consideration for minimizing disruption, I did not send the
patchset to everyone. However, it seems that my consideration was
unnecessary, so I CC'd everyone on the first patch. If you would
like to see the entire patchset, you can access it at this address.
https://lore.kernel.org
Use kobject_del_and_put() to simplify code.
Cc: Greg Kroah-Hartman
Cc: "Rafael J. Wysocki"
Signed-off-by: Yangtao Li
---
fs/erofs/sysfs.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/erofs/sysfs.c b/fs/erofs/sysfs.c
index 435e515c0792..9ed7d6552155 10064
Use kobject_del_and_put() to simplify code.
Signed-off-by: Yangtao Li
---
fs/erofs/sysfs.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/erofs/sysfs.c b/fs/erofs/sysfs.c
index 435e515c0792..9ed7d6552155 100644
--- a/fs/erofs/sysfs.c
+++ b/fs/erofs/sysfs.c
@@ -241,8
> I can pick the stuff in the areas that don't have active development.
Could you please consider helping to pick this
patch("ecryptfs: make splice write available again")?
ecryptfs seems to be unmaintained.
https://lore.kernel.org/lkml/20220831033505.23178-1-frank...@vivo.com/
Thx,
Yangtao
> Please don't do this. This makes the code compile down to a division, which
> is
> far less efficient. I've verified this by checking the assembly generated.
How much is the performance impact? So should the following be modified as
shift operations as well?
fs/erofs/namei.c:92:int head
Hi Gao Xiang,
> Please help drop this one since we'd like to use it until i_blockmask() lands
> to upstream.
I'm OK. Not sure if I need to resend v5?
Thx,
Yangtao
Use i_blockmask() to simplify code.
Signed-off-by: Yangtao Li
---
fs/remap_range.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/remap_range.c b/fs/remap_range.c
index 1331a890f2f2..7a524b620e7d 100644
--- a/fs/remap_range.c
+++ b/fs/remap_range.c
@@ -127,7 +127,7
Use i_blockmask() to simplify code. BTW convert ocfs2_is_io_unaligned
to return bool type and the fact that the value will be the same
(i.e. that ->i_blkbits is never changed by ocfs2).
Signed-off-by: Yangtao Li
---
fs/ocfs2/file.c | 9 ++---
1 file changed, 2 insertions(+), 7 deleti
Use i_blockmask() to simplify code.
Signed-off-by: Yangtao Li
---
fs/gfs2/bmap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index eedf6926c652..1c6874b3851a 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -960,7 +960,7 @@ static
Use i_blockmask() to simplify code.
Signed-off-by: Yangtao Li
---
fs/erofs/data.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/erofs/data.c b/fs/erofs/data.c
index e16545849ea7..d394102ef9de 100644
--- a/fs/erofs/data.c
+++ b/fs/erofs/data.c
@@ -376,7 +376,7 @@ static
Introduce i_blockmask() to simplify code, which replace
(i_blocksize(node) - 1). Like done in commit
93407472a21b("fs: add i_blocksize()").
Signed-off-by: Yangtao Li
---
v4:
-drop ext4 patch
-erofs patch based on mainline
-a bit change in ocfs2 patch
include/linux/fs.h | 5 +
1 fi
Hi AI,
> Umm... What's the branchpoint for that series?
> Not the mainline - there we have i_blocksize() open-coded...
Sorry, I'm based on the latest branch of the erofs repository.
https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git/log/?h=dev-test
I think I can resend based on ma
Use i_blockmask() to simplify code.
Signed-off-by: Yangtao Li
---
fs/remap_range.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/remap_range.c b/fs/remap_range.c
index 1331a890f2f2..7a524b620e7d 100644
--- a/fs/remap_range.c
+++ b/fs/remap_range.c
@@ -127,7 +127,7
Use i_blockmask() to simplify code. BTW convert ocfs2_is_io_unaligned
to return bool type.
Signed-off-by: Yangtao Li
---
v3:
-none
fs/ocfs2/file.c | 8
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index efb09de4343d..baefab3b12c9
Use i_blockmask() to simplify code.
Signed-off-by: Yangtao Li
---
v3:
-none
v2:
-convert to i_blockmask()
fs/ext4/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index d251d705c276..eec36520e5e9 100644
--- a/fs/ext4/inode.c
+++ b/fs
Use i_blockmask() to simplify code.
Signed-off-by: Yangtao Li
---
v3:
-none
v2:
-convert to i_blockmask()
fs/gfs2/bmap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index eedf6926c652..1c6874b3851a 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2
Use i_blockmask() to simplify code.
Signed-off-by: Yangtao Li
---
v3:
-none
v2:
-convert to i_blockmask()
fs/erofs/data.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/erofs/data.c b/fs/erofs/data.c
index 7e8baf56faa5..e9d1869cd4b3 100644
--- a/fs/erofs/data.c
+++ b/fs
Introduce i_blockmask() to simplify code, which replace
(i_blocksize(node) - 1). Like done in commit
93407472a21b("fs: add i_blocksize()").
Signed-off-by: Yangtao Li
---
v3:
-none
v2:
-convert to i_blockmask()
include/linux/fs.h | 5 +
1 file changed, 5 insertions(+)
diff --git
Use i_blockmask() to simplify code. BTW convert ocfs2_is_io_unaligned
to return bool type.
Signed-off-by: Yangtao Li
---
fs/ocfs2/file.c | 8
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index efb09de4343d..baefab3b12c9 100644
--- a/fs
Use i_blockmask() to simplify code.
Signed-off-by: Yangtao Li
---
v2:
-convert to i_blockmask()
fs/ext4/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index d251d705c276..eec36520e5e9 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4
Use i_blockmask() to simplify code.
Signed-off-by: Yangtao Li
---
v2:
-convert to i_blockmask()
fs/gfs2/bmap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index eedf6926c652..1c6874b3851a 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
Use i_blockmask() to simplify code.
Signed-off-by: Yangtao Li
---
v2:
-convert to i_blockmask()
fs/erofs/data.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/erofs/data.c b/fs/erofs/data.c
index 7e8baf56faa5..e9d1869cd4b3 100644
--- a/fs/erofs/data.c
+++ b/fs/erofs
Introduce i_blockmask() to simplify code, which replace
(i_blocksize(node) - 1). Like done in commit
93407472a21b("fs: add i_blocksize()").
Signed-off-by: Yangtao Li
---
v2:
-convert to i_blockmask()
include/linux/fs.h | 5 +
1 file changed, 5 insertions(+)
diff --git a/include/
Use i_blocksize_mask() to simplify code.
Signed-off-by: Yangtao Li
---
fs/ext4/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index d251d705c276..c33f91f3b749 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -2218,7 +2218,7
Use i_blocksize_mask() to simplify code.
Signed-off-by: Yangtao Li
---
fs/gfs2/bmap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index eedf6926c652..d59f9b3f0b85 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -960,7 +960,7 @@ static
Use i_blocksize_mask() to simplify code.
Signed-off-by: Yangtao Li
---
fs/erofs/data.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/erofs/data.c b/fs/erofs/data.c
index 7e8baf56faa5..234ca4dd5053 100644
--- a/fs/erofs/data.c
+++ b/fs/erofs/data.c
@@ -380,7 +380,7
Introduce i_blocksize_mask() to simplify code, which replace
(i_blocksize(node) - 1). Like done in commit
93407472a21b("fs: add i_blocksize()").
Signed-off-by: Yangtao Li
---
include/linux/fs.h | 5 +
1 file changed, 5 insertions(+)
diff --git a/include/linux/fs.h b/include/
> FYI it seems that GENMASK macro is widely used in driver and arch code base,
> while it's rarely used in fs, except for f2fs.
I think the following usage can be changed to bitmap api, just like in f2fs?
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=c4ca1f7164734
> @@ -380,7 +380,7 @@ static ssize_t erofs_file_read_iter(struct kiocb *iocb,
> struct iov_iter *to)
> if (bdev)
> blksize_mask = bdev_logical_block_size(bdev) - 1;
> else
> - blksize_mask = (1 << inode->i_blkbits) - 1;
> +
They are used during the erofs module init phase. Let's mark it as
__init like any other function.
Signed-off-by: Yangtao Li
---
v2:
-change in internal.h
fs/erofs/decompressor_lzma.c | 2 +-
fs/erofs/internal.h | 4 ++--
fs/erofs/pcpubuf.c | 2 +-
3 files chang
They are used during the erofs module init phase. Let's mark it as
__init like any other function.
Signed-off-by: Yangtao Li
---
fs/erofs/decompressor_lzma.c | 2 +-
fs/erofs/pcpubuf.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/erofs/decompressor_l
Add this doc to the erofs maintainers entry.
Signed-off-by: Yangtao Li
---
MAINTAINERS | 1 +
1 file changed, 1 insertion(+)
diff --git a/MAINTAINERS b/MAINTAINERS
index d0485b58b9d9..7d50e5df4508 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7745,6 +7745,7 @@ R:Jeffle Xu
L
58 matches
Mail list logo