From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45D8BC021B2 for ; Sun, 23 Feb 2025 06:50:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6E1CE6B007B; Sun, 23 Feb 2025 01:50:37 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 692786B0082; Sun, 23 Feb 2025 01:50:37 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 559506B0083; Sun, 23 Feb 2025 01:50:37 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 394826B007B for ; Sun, 23 Feb 2025 01:50:37 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 9DFC552A6B for ; Sun, 23 Feb 2025 06:50:36 +0000 (UTC) X-FDA: 83150286072.28.4A473D4 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by imf06.hostedemail.com (Postfix) with ESMTP id A384A180006 for ; Sun, 23 Feb 2025 06:50:34 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=Ro1LaVN1; spf=pass (imf06.hostedemail.com: domain of kaleshsingh@google.com designates 209.85.214.171 as permitted sender) smtp.mailfrom=kaleshsingh@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1740293434; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=pAjQhgFCAvazkcxHXaqcPpr/zXx43UFV7tJcDXX1GrU=; b=fMLeRddyUb911G9j11UNlQxsHB9UvsbiaFkJF1499F4Worf/RrTnzf74cvP3f1dRHjnWvL RTUDWWPEE0MzXAG5Kc+jg+NkZDTTIcGdoa+2vsE2S/7vOVJ7H1ggnaveXbMIX0Ksiq353E /MWYGUeV4D5DUVJbfGFi9JO7vOMCQC0= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=Ro1LaVN1; spf=pass (imf06.hostedemail.com: domain of kaleshsingh@google.com designates 209.85.214.171 as permitted sender) smtp.mailfrom=kaleshsingh@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1740293434; a=rsa-sha256; cv=none; b=e6jUlhugWCh9TGJjSl4f9R+x/SE4Lrw6Crz4H6Z6Vo5uX/4iaJ3LH8umMEphy0fgVgQy/C Zo6jW/khxtDWR7rNNDWA4uTH9bcNZu3c/kIid7JXQOalZhVeFg4ISxAoYcITl2hVeEMbrq jWTB0hOPHVrj478KU4sm4W4f/H00/XM= Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-2212222d4cdso132395ad.0 for ; Sat, 22 Feb 2025 22:50:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1740293433; x=1740898233; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=pAjQhgFCAvazkcxHXaqcPpr/zXx43UFV7tJcDXX1GrU=; b=Ro1LaVN1rb6/D29cUe5uJCJCKnSwYBBW4mzaYMgryhEc+kODEo2WCleoYhv9tyZWaP +B5uRBSI4ZB9LXFdhoYIcGDT42fC9Psu2hyD2OgcmunQZpKlX96PyuKg10Wj7gBNCh9/ 2LWwchoZJlIUFuk4vZGKrX/p4AWMJzaxwLM24c6ACaMv9/hqZZwUittG2rICQAkjQ18R lCYQW/5B5r8uOh59aMY61oYVjBaG1T2GGNiy1ujEp356ZQgHjhyVkh9aUeQjlNoLXO41 4h/1gfkJ2NDYsPeRXwNytEoLZmzsytJdmhnjoMzdzDihO/qwNM9VOg5co8Pds2BKJ2DT ZMng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740293433; x=1740898233; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pAjQhgFCAvazkcxHXaqcPpr/zXx43UFV7tJcDXX1GrU=; b=Zy7UTjeuALoqjjVAP05HPFj1G96Ij5caKEkR0P6COcHRgMc36CvdCM+6YW3pmEAG6F yHWnmUQCAFW4fbezE6Fn726oCMmGa7Ehnh8PJdYeGWnrfaXgX1Mrc+4WdyNGkjBydC69 SRQQMCgfzRC8IUTmoqs368QilaMT87LXhUTIZjW33ran/MBTSryFqj2fFHoit/Z9cF5Q GrTWIpKMWC604QGE6nwKJJKFEoEx/In3QaAy0p82fD+FVNR1XKT34ePhNUCiNdNIumN0 OTQRUqCKW2ZQpkimQjQ/0VgTptcRY8Qg500zHil7xuJKo0wpwqyWGkE2UbjoQYcjDdr6 0IhQ== X-Forwarded-Encrypted: i=1; AJvYcCVc63PU1ey3ha8O9/bgUfSREBgC5F0Cu2SqQZNEsBhFEpqrmgkYWCuePDuODTWONRZI9JysEUwH5g==@kvack.org X-Gm-Message-State: AOJu0Yycu19qqvc+jzpiSVyNKIAcEXHUf/b60NSri5YBHcL7Xi31by1T pX4A21t7mw5MRUjvEB39JHUuVsVAjGzlW6Kuf+JYpMS3wWnz82fM0y6gREEag8MycUHI113nsBd rTRLBBqyttJuXwFNuqBml+Lw9xvKhl/o3Yd8z X-Gm-Gg: ASbGncvAH7yBUO58z6ClfhrX78fBgSvaxGvxrWVfRGS4uF6bQms2IaRiRyigCvUsjzZ /nBnbaYQQdU2q/uwHCOEkPJy807JONM2FaHYhPaxw9TQSbRbFh4gsIb5YE2koVy20jLC8mDs44Q hY8491divKYxIYg8CFmJgKyYkW6hQ+zGQ79UgXkSsb X-Google-Smtp-Source: AGHT+IHVYi8iaU7BeYmSMQQrxxaWS0KVqzhEfbSePn/tIQFWGf2DalaykOIaz7u6p/clAgVIxzuN51GHDSKrxR8SxNA= X-Received: by 2002:a17:903:2f92:b0:21f:9f4:4a03 with SMTP id d9443c01a7336-2226cc1f362mr1571585ad.21.1740293433159; Sat, 22 Feb 2025 22:50:33 -0800 (PST) MIME-Version: 1.0 References: <87wmdhgr5x.fsf@gmail.com> In-Reply-To: <87wmdhgr5x.fsf@gmail.com> From: Kalesh Singh Date: Sat, 22 Feb 2025 22:50:21 -0800 X-Gm-Features: AWEUYZmd4NF7Ki1t7ZQard-ShzflDbSERfMEEeXjd54_75CVs6CUuIv_qUVWVMQ Message-ID: Subject: Re: [LSF/MM/BPF TOPIC] Optimizing Page Cache Readahead Behavior To: Ritesh Harjani Cc: lsf-pc@lists.linux-foundation.org, "open list:MEMORY MANAGEMENT" , linux-fsdevel , Suren Baghdasaryan , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Juan Yescas , android-mm , Matthew Wilcox , Vlastimil Babka , Michal Hocko Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspam-User: X-Rspamd-Queue-Id: A384A180006 X-Stat-Signature: 1j36d6gfo443efewoatdf3a4qapofs9i X-Rspamd-Server: rspam03 X-HE-Tag: 1740293434-856509 X-HE-Meta: U2FsdGVkX184yRPWJ57gWFf+f4K8yZV1NT6On/89bQx4xO9XAwnZy3NWbC6OBnl2w8HYow2TTDYmanFhhkcopM4Dote9Yp7y+Y45Z3o8ANBrSynurJqRwPMG66Ajcvw7kjabu9+3S5wuJddaKvbgpLaHrNgRxNDYAFVfVyd+5P67iaVsFGruCx53KrCHHnNwdFj0oVW9m7piis8JAsvrbqr8X37giPpqYoXLqsvyA8T3MzWSXXYhalHMz/Yps4d4k1bgFKeGESLqKImSlIJ2SFIsqCaJWqW8Fc6c0919FfpQVxTImdLzcHAMrFTkaHzQtEQcC4U7DiRDdnOwBeM4a00Rp/0urkDrDPmb9d5bfOUZMKgRfmBfEE0qEylqpfQ/DzNZR8xZ+5Oo2E52so1aI/Iweo9czdNgrw1am1zvjqfrokoxEbBX6pccaVSocgrIZr2CEIjhHrrp3qwaRX9tdMHb631VhrbJa93rGs07v9s5AXymdiZiu3HZGasTo16fmaxn50+rQ0ryVF5C5o/Q3h5z8OWDlYwedgofDROOKNMJlPDGAT/jBDsc/WR5JiAuLIm1sg9EGYyjHG3vgMsSnZywgswmOao9jzhXjOHRuDjPgl858GMtDicWt/8S4X2aIv4jB10jkQBfHC7u002dbqdhdj2U7UI49Z5NBs3Plce68gAAIYwd6l6EJdFuubiJPm2iWpOIQJGNXRDDmaOXvNe103r5Xdup4PRfxjMisJhMTwb6VOhrxwoXxaZgH/SI6H18dj33PlVZo5cPLqynoIDc73WYMcCvZ9KE+i8pcPA71Z/NKgya4m9GSl3vRQLNgnVxIWYK6bgiNzkwrZUDHiAf5HcMTC+mVvR9a5EJfEuRdc0HFx+rv6WnpRkP1ADJEVSOnJc3VyFBI6P9GCJRW4q2wq9xZ2ECPe+gkSBNJ71F8g2JXOiDC8MHtU5MVjWBLH7LPY1CSmVIdP03DnG ckk9xfT1 d///7kJxrLa+ntckfoy+8QqBorVZP3//DfpwNSt59ug9Cnh8bMhbMZpT65unUwj8001moy0Hfx+BvvC9JosObG3i7S4PfBDwE+pUHZpXeba3hDrxco0UlFbHme0G+nnusZBCFcuNd0XEGK8SXM38aDE91boXxmQ6NesFdyjQihAWvAkvFQukTycjXrN/0diydpc7CNJDUsWGAStjijw0CiHJGgjaTG+BXnrvbjxFeiveZ2L5E3/Il8KMEYiwli4uKVSBPVQt49c+CsKhg5BfqYJvxkJ8VN/DsGUb1oDvpzHWDnTqG6gwDyD10eQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Sat, Feb 22, 2025 at 9:58=E2=80=AFPM Ritesh Harjani wrote: > > Kalesh Singh writes: > > > Hi organizers of LSF/MM, > > > > I realize this is a late submission, but I was hoping there might > > still be a chance to have this topic considered for discussion. > > > > Problem Statement > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > > > Readahead can result in unnecessary page cache pollution for mapped > > regions that are never accessed. Current mechanisms to disable > > readahead lack granularity and rather operate at the file or VMA > > From what I understand the readahead setting is done at the per-bdi > level (default set to 128K). That means we don't get to control the > amount of readahead pages needed on a per file basis. If say we can > control the amount of readahead pages on a per open fd, will that solve > the problem you are facing? That also means we don't need to change the > setting for the entire system, but we can control this knob on a per fd > basis? > > I just quickly hacked fcntl to allow setting no. of ra_pages in > inode->i_ra_pages. Readahead algorithm then takes this setting whenever > it initializes the readahead control in "file_ra_state_init()" > So after one opens the file, we can set the fcntl F_SET_FILE_READAHEAD > to the preferred value on the open fd. > > > Note: I am not saying the implementation could be 100% correct. But it's > just a quick working PoC to discuss whether this is the right approach > to the given problem. Hi Ritesh, Thank you for sharing the patch. I think the per=E2=80=91file approach is = in the right direction. However, for this case, we=E2=80=99d like to stop the read ahead once we hit a certain boundary(s) -- somewhat like Kent described. Rather than changing the readahead size for the entire file, imagine that there are certain sections of the file where we don't want the readahead to "bleed" into; for instance, ELF segment alignment padding regions; or across different resource boundaries in a zipped apk. --Kaelsh > > -ritesh > > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > fcntl: Add control to set per inode readahead pages > > As of now readahead setting is done in units of pages at the bdi level. > (default 128K). > But sometimes the user wants to have more granular control over this > knob on a per file basis. This adds support to control readahead pages > on an open fd. > > Signed-off-by: Ritesh Harjani (IBM) > --- > fs/btrfs/defrag.c | 2 +- > fs/btrfs/free-space-cache.c | 2 +- > fs/btrfs/relocation.c | 2 +- > fs/btrfs/send.c | 2 +- > fs/cramfs/inode.c | 2 +- > fs/fcntl.c | 44 +++++++++++++++++++++++++++++++++++++ > fs/nfs/nfs4file.c | 2 +- > fs/open.c | 2 +- > include/linux/fs.h | 4 +++- > include/uapi/linux/fcntl.h | 2 ++ > mm/readahead.c | 7 ++++-- > 11 files changed, 61 insertions(+), 10 deletions(-) > > diff --git a/fs/btrfs/defrag.c b/fs/btrfs/defrag.c > index 968dae953948..c6616d69a9af 100644 > --- a/fs/btrfs/defrag.c > +++ b/fs/btrfs/defrag.c > @@ -261,7 +261,7 @@ static int btrfs_run_defrag_inode(struct btrfs_fs_inf= o *fs_info, > range.len =3D (u64)-1; > range.start =3D cur; > range.extent_thresh =3D defrag->extent_thresh; > - file_ra_state_init(ra, inode->i_mapping); > + file_ra_state_init(ra, inode); > > sb_start_write(fs_info->sb); > ret =3D btrfs_defrag_file(inode, ra, &range, defrag->transid, > diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c > index cfa52ef40b06..ac240b148747 100644 > --- a/fs/btrfs/free-space-cache.c > +++ b/fs/btrfs/free-space-cache.c > @@ -373,7 +373,7 @@ static void readahead_cache(struct inode *inode) > struct file_ra_state ra; > unsigned long last_index; > > - file_ra_state_init(&ra, inode->i_mapping); > + file_ra_state_init(&ra, inode); > last_index =3D (i_size_read(inode) - 1) >> PAGE_SHIFT; > > page_cache_sync_readahead(inode->i_mapping, &ra, NULL, 0, last_in= dex); > diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c > index bf267bdfa8f8..7688b79ae7e7 100644 > --- a/fs/btrfs/relocation.c > +++ b/fs/btrfs/relocation.c > @@ -3057,7 +3057,7 @@ static int relocate_file_extent_cluster(struct relo= c_control *rc) > if (ret) > goto out; > > - file_ra_state_init(ra, inode->i_mapping); > + file_ra_state_init(ra, inode); > > ret =3D setup_relocation_extent_mapping(rc); > if (ret) > diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c > index 7254279c3cc9..b22fc2a426e4 100644 > --- a/fs/btrfs/send.c > +++ b/fs/btrfs/send.c > @@ -5745,7 +5745,7 @@ static int send_extent_data(struct send_ctx *sctx, = struct btrfs_path *path, > return err; > } > memset(&sctx->ra, 0, sizeof(struct file_ra_state)); > - file_ra_state_init(&sctx->ra, sctx->cur_inode->i_mapping)= ; > + file_ra_state_init(&sctx->ra, sctx->cur_inode); > > /* > * It's very likely there are no pages from this inode in= the page > diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c > index b84d1747a020..917f09040f6e 100644 > --- a/fs/cramfs/inode.c > +++ b/fs/cramfs/inode.c > @@ -214,7 +214,7 @@ static void *cramfs_blkdev_read(struct super_block *s= b, unsigned int offset, > devsize =3D bdev_nr_bytes(sb->s_bdev) >> PAGE_SHIFT; > > /* Ok, read in BLKS_PER_BUF pages completely first. */ > - file_ra_state_init(&ra, mapping); > + file_ra_state_init(&ra, mapping->host); > page_cache_sync_readahead(mapping, &ra, NULL, blocknr, BLKS_PER_B= UF); > > for (i =3D 0; i < BLKS_PER_BUF; i++) { > diff --git a/fs/fcntl.c b/fs/fcntl.c > index 49884fa3c81d..277afe78536f 100644 > --- a/fs/fcntl.c > +++ b/fs/fcntl.c > @@ -394,6 +394,44 @@ static long fcntl_set_rw_hint(struct file *file, uns= igned int cmd, > return 0; > } > > +static long fcntl_get_file_readahead(struct file *file, unsigned int cmd= , > + unsigned long arg) > +{ > + struct inode *inode =3D file_inode(file); > + u64 __user *argp =3D (u64 __user *)arg; > + u64 ra_pages =3D READ_ONCE(inode->i_ra_pages); > + > + if (copy_to_user(argp, &ra_pages, sizeof(*argp))) > + return -EFAULT; > + return 0; > +} > + > + > +static long fcntl_set_file_readahead(struct file *file, unsigned int cmd= , > + unsigned long arg) > +{ > + struct inode *inode =3D file_inode(file); > + u64 __user *argp =3D (u64 __user *)arg; > + u64 ra_pages; > + > + if (!inode_owner_or_capable(file_mnt_idmap(file), inode)) > + return -EPERM; > + > + if (copy_from_user(&ra_pages, argp, sizeof(ra_pages))) > + return -EFAULT; > + > + WRITE_ONCE(inode->i_ra_pages, ra_pages); > + > + /* > + * file->f_mapping->host may differ from inode. As an example, > + * blkdev_open() modifies file->f_mapping. > + */ > + if (file->f_mapping->host !=3D inode) > + WRITE_ONCE(file->f_mapping->host->i_ra_pages, ra_pages); > + > + return 0; > +} > + > /* Is the file descriptor a dup of the file? */ > static long f_dupfd_query(int fd, struct file *filp) > { > @@ -552,6 +590,12 @@ static long do_fcntl(int fd, unsigned int cmd, unsig= ned long arg, > case F_SET_RW_HINT: > err =3D fcntl_set_rw_hint(filp, cmd, arg); > break; > + case F_GET_FILE_READAHEAD: > + err =3D fcntl_get_file_readahead(filp, cmd, arg); > + break; > + case F_SET_FILE_READAHEAD: > + err =3D fcntl_set_file_readahead(filp, cmd, arg); > + break; > default: > break; > } > diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c > index 1cd9652f3c28..cee84aa8aa0f 100644 > --- a/fs/nfs/nfs4file.c > +++ b/fs/nfs/nfs4file.c > @@ -388,7 +388,7 @@ static struct file *__nfs42_ssc_open(struct vfsmount = *ss_mnt, > nfs_file_set_open_context(filep, ctx); > put_nfs_open_context(ctx); > > - file_ra_state_init(&filep->f_ra, filep->f_mapping->host->i_mappin= g); > + file_ra_state_init(&filep->f_ra, filep->f_mapping->host); > res =3D filep; > out_free_name: > kfree(read_name); > diff --git a/fs/open.c b/fs/open.c > index 0f75e220b700..466c3affe161 100644 > --- a/fs/open.c > +++ b/fs/open.c > @@ -961,7 +961,7 @@ static int do_dentry_open(struct file *f, > f->f_flags &=3D ~(O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC); > f->f_iocb_flags =3D iocb_flags(f); > > - file_ra_state_init(&f->f_ra, f->f_mapping->host->i_mapping); > + file_ra_state_init(&f->f_ra, f->f_mapping->host); > > if ((f->f_flags & O_DIRECT) && !(f->f_mode & FMODE_CAN_ODIRECT)) > return -EINVAL; > diff --git a/include/linux/fs.h b/include/linux/fs.h > index 12fe11b6e3dd..77ee23e30245 100644 > --- a/include/linux/fs.h > +++ b/include/linux/fs.h > @@ -678,6 +678,8 @@ struct inode { > unsigned short i_bytes; > u8 i_blkbits; > enum rw_hint i_write_hint; > + /* Per inode setting for max readahead in page_size units */ > + unsigned long i_ra_pages; > blkcnt_t i_blocks; > > #ifdef __NEED_I_SIZE_ORDERED > @@ -3271,7 +3273,7 @@ extern ssize_t iter_file_splice_write(struct pipe_i= node_info *, > > > extern void > -file_ra_state_init(struct file_ra_state *ra, struct address_space *mappi= ng); > +file_ra_state_init(struct file_ra_state *ra, struct inode *inode); > extern loff_t noop_llseek(struct file *file, loff_t offset, int whence); > extern loff_t vfs_setpos(struct file *file, loff_t offset, loff_t maxsiz= e); > extern loff_t generic_file_llseek(struct file *file, loff_t offset, int = whence); > diff --git a/include/uapi/linux/fcntl.h b/include/uapi/linux/fcntl.h > index 6e6907e63bfc..b6e5413ca660 100644 > --- a/include/uapi/linux/fcntl.h > +++ b/include/uapi/linux/fcntl.h > @@ -60,6 +60,8 @@ > #define F_SET_RW_HINT (F_LINUX_SPECIFIC_BASE + 12) > #define F_GET_FILE_RW_HINT (F_LINUX_SPECIFIC_BASE + 13) > #define F_SET_FILE_RW_HINT (F_LINUX_SPECIFIC_BASE + 14) > +#define F_GET_FILE_READAHEAD (F_LINUX_SPECIFIC_BASE + 15) > +#define F_SET_FILE_READAHEAD (F_LINUX_SPECIFIC_BASE + 16) > > /* > * Valid hint values for F_{GET,SET}_RW_HINT. 0 is "not set", or can be > diff --git a/mm/readahead.c b/mm/readahead.c > index 2bc3abf07828..71079ae1753d 100644 > --- a/mm/readahead.c > +++ b/mm/readahead.c > @@ -136,9 +136,12 @@ > * memset *ra to zero. > */ > void > -file_ra_state_init(struct file_ra_state *ra, struct address_space *mappi= ng) > +file_ra_state_init(struct file_ra_state *ra, struct inode *inode) > { > - ra->ra_pages =3D inode_to_bdi(mapping->host)->ra_pages; > + unsigned int ra_pages =3D inode->i_ra_pages ? inode->i_ra_pages : > + inode_to_bdi(inode)->ra_pages; > + > + ra->ra_pages =3D ra_pages; > ra->prev_pos =3D -1; > } > EXPORT_SYMBOL_GPL(file_ra_state_init); > > 2.39.5