lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALpufv1JOLN_6iS66thD6KhkY9TAeQd6E5nRoC4uH1kSBWGftA@mail.gmail.com>
Date: Thu, 31 Oct 2024 17:02:08 +0800
From: yi sun <sunyibuaa@...il.com>
To: Chao Yu <chao@...nel.org>
Cc: Yi Sun <yi.sun@...soc.com>, jaegeuk@...nel.org, 
	linux-f2fs-devel@...ts.sourceforge.net, linux-kernel@...r.kernel.org, 
	niuzhiguo84@...il.com, hao_hao.wang@...soc.com, ke.wang@...soc.com
Subject: Re: [PATCH v2 2/5] f2fs: expand f2fs_invalidate_compress_page() to f2fs_invalidate_compress_pages_range()

On Thu, Oct 31, 2024 at 3:26 PM Chao Yu <chao@...nel.org> wrote:
>
> On 2024/10/30 18:31, Yi Sun wrote:
> > New function f2fs_invalidate_compress_pages_range() adds the @len
> > parameter. So it can process some consecutive blocks at a time.
> >
> > Signed-off-by: Yi Sun <yi.sun@...soc.com>
> > ---
> >   fs/f2fs/compress.c | 7 ++++---
> >   fs/f2fs/f2fs.h     | 9 +++++----
> >   2 files changed, 9 insertions(+), 7 deletions(-)
> >
> > diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c
> > index 7f26440e8595..e607a7885b57 100644
> > --- a/fs/f2fs/compress.c
> > +++ b/fs/f2fs/compress.c
> > @@ -1903,11 +1903,12 @@ struct address_space *COMPRESS_MAPPING(struct f2fs_sb_info *sbi)
> >       return sbi->compress_inode->i_mapping;
> >   }
> >
> > -void f2fs_invalidate_compress_page(struct f2fs_sb_info *sbi, block_t blkaddr)
> > +void f2fs_invalidate_compress_pages_range(struct f2fs_sb_info *sbi,
> > +                             block_t blkaddr, unsigned int len)
> >   {
> > -     if (!sbi->compress_inode)
> > +     if (!sbi->compress_inode || len == 0)
>
> We can remove len == 0 check condition? Or any caller can pass 0 here?
>
> Thanks,
>

Yes, len==0 can be removed.

> >               return;
> > -     invalidate_mapping_pages(COMPRESS_MAPPING(sbi), blkaddr, blkaddr);
> > +     invalidate_mapping_pages(COMPRESS_MAPPING(sbi), blkaddr, blkaddr + len - 1);
> >   }
> >
> >   void f2fs_cache_compressed_page(struct f2fs_sb_info *sbi, struct page *page,
> > diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> > index 3c6f3cce5779..d3fe66a93a56 100644
> > --- a/fs/f2fs/f2fs.h
> > +++ b/fs/f2fs/f2fs.h
> > @@ -4384,7 +4384,8 @@ void f2fs_destroy_page_array_cache(struct f2fs_sb_info *sbi);
> >   int __init f2fs_init_compress_cache(void);
> >   void f2fs_destroy_compress_cache(void);
> >   struct address_space *COMPRESS_MAPPING(struct f2fs_sb_info *sbi);
> > -void f2fs_invalidate_compress_page(struct f2fs_sb_info *sbi, block_t blkaddr);
> > +void f2fs_invalidate_compress_pages_range(struct f2fs_sb_info *sbi,
> > +                                     block_t blkaddr, unsigned int len);
> >   void f2fs_cache_compressed_page(struct f2fs_sb_info *sbi, struct page *page,
> >                                               nid_t ino, block_t blkaddr);
> >   bool f2fs_load_compressed_page(struct f2fs_sb_info *sbi, struct page *page,
> > @@ -4439,8 +4440,8 @@ static inline int f2fs_init_page_array_cache(struct f2fs_sb_info *sbi) { return
> >   static inline void f2fs_destroy_page_array_cache(struct f2fs_sb_info *sbi) { }
> >   static inline int __init f2fs_init_compress_cache(void) { return 0; }
> >   static inline void f2fs_destroy_compress_cache(void) { }
> > -static inline void f2fs_invalidate_compress_page(struct f2fs_sb_info *sbi,
> > -                             block_t blkaddr) { }
> > +static inline void f2fs_invalidate_compress_pages_range(struct f2fs_sb_info *sbi,
> > +                             block_t blkaddr, unsigned int len) { }
> >   static inline void f2fs_cache_compressed_page(struct f2fs_sb_info *sbi,
> >                               struct page *page, nid_t ino, block_t blkaddr) { }
> >   static inline bool f2fs_load_compressed_page(struct f2fs_sb_info *sbi,
> > @@ -4759,7 +4760,7 @@ static inline void f2fs_invalidate_internal_cache(struct f2fs_sb_info *sbi,
> >                                                               block_t blkaddr)
> >   {
> >       f2fs_truncate_meta_inode_pages(sbi, blkaddr, 1);
> > -     f2fs_invalidate_compress_page(sbi, blkaddr);
> > +     f2fs_invalidate_compress_pages_range(sbi, blkaddr, 1);
> >   }
> >
> >   #define EFSBADCRC   EBADMSG         /* Bad CRC detected */
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ