Actually here it does account an entire folio. The j is just array index. > It seems like you can just call io_buffer_account_pin() > instead. > > On that note, you shouldn't duplicate code in either case, > just treat the normal discontig pages case as folios of > shift=PAGE_SHIFT. > > Either just plain reuse or adjust io_buffer_account_pin() > instead of io_coalesced_buffer_account_pin(). > io_coalesced_imu_alloc() should also go away. > > io_sqe_buffer_register() { > struct io_imu_folio_data data; > > if (!io_sqe_buffer_try_coalesce(pages, folio_data)) { > folio_data.shift = PAGE_SHIFT; > ... > } > > io_buffer_account_pin(pages, &data); > imu->data = uaddr; > ... > } Will remove them. Thanks, Chenliang Li