Re: [PATCH v3 bpf-next 02/10] lib/buildid: add single page-based file reader abstraction

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

 



On Wed, Aug 07, 2024 at 06:46:00PM GMT, Matthew Wilcox wrote:
> On Wed, Aug 07, 2024 at 10:19:11AM -0700, Shakeel Butt wrote:
> > On Wed, Aug 07, 2024 at 04:28:53PM GMT, Matthew Wilcox wrote:
> > > On Tue, Jul 30, 2024 at 01:39:06PM -0700, Andrii Nakryiko wrote:
> > > > +	union {
> > > > +		struct {
> > > > +			struct address_space *mapping;
> > > > +			struct page *page;
> > > 
> > > NAK.  All the page-based interfaces are deprecated.  Only we can't mark
> > > them as deprecated because our tooling is a pile of crap.
> > > 
> > > > +			void *page_addr;
> > > > +			u64 file_off;
> > > 
> > > loff_t pos.
> > > 
> > > > +	r->page = find_get_page(r->mapping, pg_off);
> > > 
> > > r->folio = read_mapping_folio(r->mapping, r->pos / PAGE_SIZE, ...)
> > > 
> > > OK, for network filesystems, you're going to need to retain the struct
> > > file that's used to access them.  So maybe this becomes
> > > 	read_mapping_folio(r->file->f_mapping, r->pos, r->file)
> > 
> > This code path can be called from non-sleepable context. What would be
> > the appropriate way to get the folio in that case?
> 
> There isn't.  If there's no folio, or the folio isn't uptodate, we need
> to sleep to wait for I/O.  We can't busy-wait for I/O.
> 

Failure is fine if there is no folio or the folio is not uptodate. I
assume we can do:

	folio = __filemap_get_folio(r->mapping, pg_off, 0, 0);
	if (!folio || !folio_test_uptodate(folio))
		return -EFAULT;

Is this appropriate here?




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux