]> Git Repo - linux.git/log
linux.git
12 months agobcachefs: time_stats: split stats-with-quantiles into a separate structure
Darrick J. Wong [Thu, 1 Feb 2024 20:41:42 +0000 (12:41 -0800)]
bcachefs: time_stats: split stats-with-quantiles into a separate structure

Currently, struct time_stats has the optional ability to quantize the
information that it collects.  This is /probably/ useful for callers who
want to see quantized information, but it more than doubles the size of
the structure from 224 bytes to 464.  For users who don't care about
that (e.g. upcoming xfs patches) and want to avoid wasting 240 bytes per
counter, split the two into separate pieces.

Signed-off-by: Darrick J. Wong <[email protected]>
Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: mean_and_variance: put struct mean_and_variance_weighted on a diet
Darrick J. Wong [Thu, 8 Feb 2024 23:33:35 +0000 (18:33 -0500)]
bcachefs: mean_and_variance: put struct mean_and_variance_weighted on a diet

The only caller of this code (time_stats) always knows the weights and
whether or not any information has been collected.  Pass this
information into the mean and variance code so that it doesn't have to
store that information.  This reduces the structure size from 24 to 16
bytes, which shrinks each time_stats counter to 192 bytes from 208.

Signed-off-by: Darrick J. Wong <[email protected]>
Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: time_stats: add larger units
Darrick J. Wong [Mon, 5 Feb 2024 18:50:15 +0000 (10:50 -0800)]
bcachefs: time_stats: add larger units

Filesystems can stay mounted for a very long time, so add some larger
units.

Signed-off-by: Darrick J. Wong <[email protected]>
Signed-off-by: Kent Overstreet <[email protected]>
12 months agoMerge tag 'drm-next-2024-03-13' of https://gitlab.freedesktop.org/drm/kernel
Linus Torvalds [Thu, 14 Mar 2024 01:34:05 +0000 (18:34 -0700)]
Merge tag 'drm-next-2024-03-13' of https://gitlab.freedesktop.org/drm/kernel

Pull drm updates from Dave Airlie:
 "Highlights are usual, more AMD IP blocks for future hw, i915/xe
  changes, Displayport tunnelling support for i915, msm YUV over DP
  changes, new tests for ttm, but its mostly a lot of stuff all over the
  place from lots of people.

  core:
   - EDID cleanups
   - scheduler error handling fixes
   - managed: add drmm_release_action() with tests
   - add ratelimited drm debug print
   - DPCD PSR early transport macro
   - DP tunneling and bandwidth allocation helpers
   - remove built-in edids
   - dp: Avoid AUX transfers on powered-down displays
   - dp: Add VSC SDP helpers

  cross drivers:
   - use new drm print helpers
   - switch to ->read_edid callback
   - gem: add stats for shared buffers plus updates to amdgpu, i915, xe

  syncobj:
   - fixes to waiting and sleeping

  ttm:
   - add tests
   - fix errno codes
   - simply busy-placement handling
   - fix page decryption

  media:
   - tc358743: fix v4l device registration

  video:
   - move all kernel parameters for video behind CONFIG_VIDEO

  sound:
   - remove <drm/drm_edid.h> include from header

  ci:
   - add tests for msm
   - fix apq8016 runner

  efifb:
   - use copy of global screen_info state

  vesafb:
   - use copy of global screen_info state

  simplefb:
   - fix logging

  bridge:
   - ite-6505: fix DP link-training bug
   - samsung-dsim: fix error checking in probe
   - samsung-dsim: add bsh-smm-s2/pro boards
   - tc358767: fix regmap usage
   - imx: add i.MX8MP HDMI PVI plus DT bindings
   - imx: add i.MX8MP HDMI TX plus DT bindings
   - sii902x: fix probing and unregistration
   - tc358767: limit pixel PLL input range
   - switch to new drm_bridge_read_edid() interface

  panel:
   - ltk050h3146w: error-handling fixes
   - panel-edp: support delay between power-on and enable; use put_sync
     in unprepare; support Mediatek MT8173 Chromebooks, BOE NV116WHM-N49
     V8.0, BOE NV122WUM-N41, CSO MNC207QS1-1 plus DT bindings
   - panel-lvds: support EDT ETML0700Z9NDHA plus DT bindings
   - panel-novatek: FRIDA FRD400B25025-A-CTK plus DT bindings
   - add BOE TH101MB31IG002-28A plus DT bindings
   - add EDT ETML1010G3DRA plus DT bindings
   - add Novatek NT36672E LCD DSI plus DT bindings
   - nt36523: support 120Hz timings, fix includes
   - simple: fix display timings on RK32FN48H
   - visionox-vtdr6130: fix initialization
   - add Powkiddy RGB10MAX3 plus DT bindings
   - st7703: support panel rotation plus DT bindings
   - add Himax HX83112A plus DT bindings
   - ltk500hd1829: add support for ltk101b4029w and admatec 9904370
   - simple: add BOE BP082WX1-100 8.2" panel plus DT bindungs

  panel-orientation-quirks:
   - GPD Win Mini

  amdgpu:
   - Validate DMABuf imports in compute VMs
   - Add RAS ACA framework
   - PSP 13 fixes
   - Misc code cleanups
   - Replay fixes
   - Atom interpretor PS, WS bounds checking
   - DML2 fixes
   - Audio fixes
   - DCN 3.5 Z state fixes
   - Remove deprecated ida_simple usage
   - UBSAN fixes
   - RAS fixes
   - Enable seq64 infrastructure
   - DC color block enablement
   - Documentation updates
   - DC documentation updates
   - DMCUB updates
   - ATHUB 4.1 support
   - LSDMA 7.0 support
   - JPEG DPG support
   - IH 7.0 support
   - HDP 7.0 support
   - VCN 5.0 support
   - SMU 13.0.6 updates
   - NBIO 7.11 updates
   - SDMA 6.1 updates
   - MMHUB 3.3 updates
   - DCN 3.5.1 support
   - NBIF 6.3.1 support
   - VPE 6.1.1 support

  amdkfd:
   - Validate DMABuf imports in compute VMs
   - SVM fixes
   - Trap handler updates and enhancements
   - Fix cache size reporting
   - Relocate the trap handler

  radeon:
   - Atom interpretor PS, WS bounds checking
   - Misc code cleanups

  xe:
   - new query for GuC submission version
   - Remove unused persistent exec_queues
   - Add vram frequency sysfs attributes
   - Add the flag XE_VM_BIND_FLAG_DUMPABLE
   - Drop pre-production workarounds
   - Drop kunit tests for unsupported platforms
   - Start pumbling SR-IOV support with memory based interrupts for VF
   - Allow to map BO in GGTT with PAT index corresponding to XE_CACHE_UC
     to work with memory based interrupts
   - Add GuC Doorbells Manager as prep work SR-IOV
   - Implement additional workarounds for xe2 and MTL
   - Program a few registers according to perfomance guide spec for Xe2
   - Fix remaining 32b build issues and enable it back
   - Fix build with CONFIG_DEBUG_FS=n
   - Fix warnings from GuC ABI headers
   - Introduce Relay Communication for SR-IOV for VF <-> GuC <-> PF
   - Release mmap mappings on rpm suspend
   - Disable mid-thread preemption when not properly supported by
     hardware
   - Fix xe_exec by reserving extra fence slot for CPU bind
   - Fix xe_exec with full long running exec queue
   - Canonicalize addresses where needed for Xe2 and add to devcoredum
   - Toggle USM support for Xe2
   - Only allow 1 ufence per exec / bind IOCTL
   - Add GuC firmware loading for Lunar Lake
   - Add XE_VMA_PTE_64K VMA flag

  i915:
   - Add more ADL-N PCI IDs
   - Enable fastboot also on older platforms
   - Early transport for panel replay and PSR
   - New ARL PCI IDs
   - DP TPS4 PHY test pattern support
   - Unify and improve VSC SDP for PSR and non-PSR cases
   - Refactor memory regions and improve debug logging
   - Rework global state serialization
   - Remove unused CDCLK divider fields
   - Unify HDCP connector logging format
   - Use display instead of graphics version in display code
   - Move VBT and opregion debugfs next to the implementation
   - Abstract opregion interface, use opaque type
   - MTL fixes
   - HPD handling fixes
   - Add GuC submission interface version query
   - Atomically invalidate userptr on mmu-notifier
   - Update handling of MMIO triggered reports
   - Don't make assumptions about intel_wakeref_t type
   - Extend driver code of Xe_LPG to Xe_LPG+
   - Add flex arrays to struct i915_syncmap
   - Allow for very slow HuC loading
   - DP tunneling and bandwidth allocation support

  msm:
   - Correct bindings for MSM8976 and SM8650 platforms
   - Start migration of MDP5 platforms to DPU driver
   - X1E80100 MDSS support
   - DPU:
      - Improve DSC allocation, fixing several important corner cases
      - Add support for SDM630/SDM660 platforms
      - Simplify dpu_encoder_phys_ops
      - Apply fixes targeting DSC support with a single DSC encoder
      - Apply fixes for HCTL_EN timing configuration
      - X1E80100 support
      - Add support for YUV420 over DP
   - GPU:
      - fix sc7180 UBWC config
      - fix a7xx LLC config
      - new gpu support: a305B, a750, a702
      - machine support: SM7150 (different power levels than other a618)
      - a7xx devcoredump support

  habanalabs:
   - configure IRQ affinity according to NUMA node
   - move HBM MMU page tables inside the HBM
   - improve device reset
   - check extended PCIe errors

  ivpu:
   - updates to firmware API
   - refactor BO allocation

  imx:
   - use devm_ functions during init

  hisilicon:
   - fix EDID includes

  mgag200:
   - improve ioremap usage
   - convert to struct drm_edid
   - Work around PCI write bursts

  nouveau:
   - disp: use kmemdup()
   - fix EDID includes
   - documentation fixes

  qaic:
   - fixes to BO handling
   - make use of DRM managed release
   - fix order of remove operations

  rockchip:
   - analogix_dp: get encoder port from DT
   - inno_hdmi: support HDMI for RK3128
   - lvds: error-handling fixes

  ssd130x:
   - support SSD133x plus DT bindings

  tegra:
   - fix error handling

  tilcdc:
   - make use of DRM managed release

  v3d:
   - show memory stats in debugfs
   - Support display MMU page size

  vc4:
   - fix error handling in plane prepare_fb
   - fix framebuffer test in plane helpers

  virtio:
   - add venus capset defines

  vkms:
   - fix OOB access when programming the LUT
   - Kconfig improvements

  vmwgfx:
   - unmap surface before changing plane state
   - fix memory leak in error handling
   - documentation fixes
   - list command SVGA_3D_CMD_DEFINE_GB_SURFACE_V4 as invalid
   - fix null-pointer deref in execbuf
   - refactor display-mode probing
   - fix fencing for creating cursor MOBs
   - fix cursor-memory lifetime

  xlnx:
   - fix live video input for ZynqMP DPSUB

  lima:
   - fix memory leak

  loongson:
   - fail if no VRAM present

  meson:
   - switch to new drm_bridge_read_edid() interface

  renesas:
   - add RZ/G2L DU support plus DT bindings

  mxsfb:
   - Use managed mode config

  sun4i:
   - HDMI: updates to atomic mode setting

  mediatek:
   - Add display driver for MT8188 VDOSYS1
   - DSI driver cleanups
   - Filter modes according to hardware capability
   - Fix a null pointer crash in mtk_drm_crtc_finish_page_flip

  etnaviv:
   - enhancements for NPU and MRT support"

* tag 'drm-next-2024-03-13' of https://gitlab.freedesktop.org/drm/kernel: (1420 commits)
  drm/amd/display: Removed redundant @ symbol to fix kernel-doc warnings in -next repo
  drm/amd/pm: wait for completion of the EnableGfxImu message
  drm/amdgpu/soc21: add mode2 asic reset for SMU IP v14.0.1
  drm/amdgpu: add smu 14.0.1 support
  drm/amdgpu: add VPE 6.1.1 discovery support
  drm/amdgpu/vpe: add VPE 6.1.1 support
  drm/amdgpu/vpe: don't emit cond exec command under collaborate mode
  drm/amdgpu/vpe: add collaborate mode support for VPE
  drm/amdgpu/vpe: add PRED_EXE and COLLAB_SYNC OPCODE
  drm/amdgpu/vpe: add multi instance VPE support
  drm/amdgpu/discovery: add nbif v6_3_1 ip block
  drm/amdgpu: Add nbif v6_3_1 ip block support
  drm/amdgpu: Add pcie v6_1_0 ip headers (v5)
  drm/amdgpu: Add nbif v6_3_1 ip headers (v5)
  arch/powerpc: Remove <linux/fb.h> from backlight code
  macintosh/via-pmu-backlight: Include <linux/backlight.h>
  fbdev/chipsfb: Include <linux/backlight.h>
  drm/etnaviv: Restore some id values
  drm/amdkfd: make kfd_class constant
  drm/amdgpu: add ring timeout information in devcoredump
  ...

12 months agobcachefs: pull out time_stats.[ch]
Kent Overstreet [Thu, 14 Mar 2024 00:16:40 +0000 (20:16 -0400)]
bcachefs: pull out time_stats.[ch]

prep work for lifting out of fs/bcachefs/

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: reconstruct_alloc cleanup
Kent Overstreet [Tue, 12 Mar 2024 01:15:26 +0000 (21:15 -0400)]
bcachefs: reconstruct_alloc cleanup

Now that we've got the errors_silent mechanism, we don't have to check
if the reconstruct_alloc option is set all over the place.

Also - users no longer have to explicitly select fsck and fix_errors.

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: fix bch_folio_sector padding
Kent Overstreet [Mon, 11 Mar 2024 03:34:19 +0000 (23:34 -0400)]
bcachefs: fix bch_folio_sector padding

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: Fix btree key cache coherency during replay
Kent Overstreet [Mon, 11 Mar 2024 00:53:17 +0000 (20:53 -0400)]
bcachefs: Fix btree key cache coherency during replay

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: Always flush write buffer in delete_dead_inodes()
Kent Overstreet [Mon, 11 Mar 2024 03:00:23 +0000 (23:00 -0400)]
bcachefs: Always flush write buffer in delete_dead_inodes()

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: Fix order of gc_done passes
Kent Overstreet [Sun, 10 Mar 2024 20:29:06 +0000 (16:29 -0400)]
bcachefs: Fix order of gc_done passes

gc_stripes_done() and gc_reflink_done() may do alloc btree updates (i.e.
when deleting an indirect extent) - we need bucket gens to be fixed by
then.

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: fix deletion of indirect extents in btree_gc
Kent Overstreet [Sun, 10 Mar 2024 20:24:16 +0000 (16:24 -0400)]
bcachefs: fix deletion of indirect extents in btree_gc

we need to run the normal extent update path on deletion -
bch2_bkey_make_mut() is incorrect when key type is changing.

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: Prefer struct_size over open coded arithmetic
Erick Archer [Sun, 10 Mar 2024 11:02:26 +0000 (12:02 +0100)]
bcachefs: Prefer struct_size over open coded arithmetic

This is an effort to get rid of all multiplications from allocation
functions in order to prevent integer overflows [1][2].

As the "op" variable is a pointer to "struct promote_op" and this
structure ends in a flexible array:

struct promote_op {
[...]
struct bio_vec bi_inline_vecs[];
};

and the "t" variable is a pointer to "struct journal_seq_blacklist_table"
and this structure also ends in a flexible array:

struct journal_seq_blacklist_table {
[...]
struct journal_seq_blacklist_table_entry {
u64 start;
u64 end;
bool dirty;
} entries[];
};

the preferred way in the kernel is to use the struct_size() helper to
do the arithmetic instead of the argument "size + size * count" in the
kzalloc() functions.

This way, the code is more readable and safer.

Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
Link: https://github.com/KSPP/linux/issues/160
Signed-off-by: Erick Archer <[email protected]>
Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: Kill unused flags argument to btree_split()
Kent Overstreet [Sat, 9 Mar 2024 00:00:25 +0000 (19:00 -0500)]
bcachefs: Kill unused flags argument to btree_split()

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: Check for writing superblocks with nonsense member seq fields
Kent Overstreet [Fri, 8 Mar 2024 21:10:08 +0000 (16:10 -0500)]
bcachefs: Check for writing superblocks with nonsense member seq fields

We're seeing some unmountable filesystems due to split brain detection
going awry; it seems we somehow wrote out superblocks where we updated
the superblock seq without updating any member seq fields.

A given device's superblock should always have the main seq equal to
it's member seq field, so this is easy to check for.

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: fix bch2_journal_buf_to_text()
Kent Overstreet [Fri, 8 Mar 2024 18:51:38 +0000 (13:51 -0500)]
bcachefs: fix bch2_journal_buf_to_text()

Signed-off-by: Kent Overstreet <[email protected]>
12 months agolib/generic-radix-tree.c: Make nodes more reasonably sized
Kent Overstreet [Fri, 8 Mar 2024 03:32:06 +0000 (22:32 -0500)]
lib/generic-radix-tree.c: Make nodes more reasonably sized

this code originally used the page allocator directly, but most code
shouldn't do that - PAGE_SIZE varies with architecture, and slab is
faster.

4k is also on the large side for typical usage, 512 bytes is a better
choice for typical usage that might be somewhat sparse.

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: copy_(to|from)_user_errcode()
Kent Overstreet [Sat, 2 Mar 2024 20:30:33 +0000 (15:30 -0500)]
bcachefs: copy_(to|from)_user_errcode()

we've got some helpers that return errors sanely, move them to a more
common location for use in fs-ioctl.c

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: Split out bkey_types.h
Kent Overstreet [Fri, 1 Mar 2024 23:49:09 +0000 (18:49 -0500)]
bcachefs: Split out bkey_types.h

We're going to need bkey_types.h in bcachefs_ioctl.h in a future patch.

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: fix lost journal buf wakeup due to improved pipelining
Brian Foster [Fri, 1 Mar 2024 17:49:24 +0000 (12:49 -0500)]
bcachefs: fix lost journal buf wakeup due to improved pipelining

The journal_write_done() handler was reworked into a loop in commit
746a33c96b7a ("bcachefs: better journal pipelining"). As part of this,
the journal buffer wake was factored into a post-loop branch that
executes if at least one journal buffer has completed.

The journal buffer processing loop iterates on the journal buffer
pointer, however. This means that w refers to the last buffer processed
by the loop, which may or may not be done. This also means that if
multiple buffers are processed by the loop, only the last is awoken.
This lost wakeup behavior has lead to stalling problems in various CI
and fstests, such as generic/703.

Lift the wake into the loop so each done buffer sees a wake call as
it is processed.

Signed-off-by: Brian Foster <[email protected]>
Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: intercept mountoption value for bool type
Hongbo Li [Fri, 1 Mar 2024 06:38:33 +0000 (14:38 +0800)]
bcachefs: intercept mountoption value for bool type

For mount option with bool type, the value must be 0 or 1 (See
bch2_opt_parse). But this seems does not well intercepted cause
for other value(like 2...), it returns the unexpect return code
with error message printed.

Signed-off-by: Hongbo Li <[email protected]>
Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: avoid returning private error code in bch2_xattr_bcachefs_set
Hongbo Li [Fri, 1 Mar 2024 03:17:45 +0000 (11:17 +0800)]
bcachefs: avoid returning private error code in bch2_xattr_bcachefs_set

Avoid the private error code return to caller. The error code
should be transformed into genernal error code.

Signed-off-by: Hongbo Li <[email protected]>
Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: Buffered write path now can avoid the inode lock
Kent Overstreet [Wed, 28 Feb 2024 23:30:22 +0000 (18:30 -0500)]
bcachefs: Buffered write path now can avoid the inode lock

Non append, non extending buffered writes can now avoid taking the inode
lock.

To ensure atomicity of writes w.r.t. other writes, we lock every folio
that we'll be writing to, and if this fails we fall back to taking the
inode lock.

Extensive comments are provided as to corner cases.

Link: https://lore.kernel.org/linux-fsdevel/[email protected]/
Signed-off-by: Kent Overstreet <[email protected]>
12 months agofs: file_remove_privs_flags()
Kent Overstreet [Wed, 28 Feb 2024 23:28:48 +0000 (18:28 -0500)]
fs: file_remove_privs_flags()

Rename and export __file_remove_privs(); for a buffered write path that
doesn't take the inode lock we need to be able to check if the operation
needs to do work first.

Signed-off-by: Kent Overstreet <[email protected]>
Cc: Alexander Viro <[email protected]>
Cc: Christian Brauner <[email protected]>
12 months agobcachefs: Fix bch2_journal_noflush_seq()
Kent Overstreet [Thu, 29 Feb 2024 02:56:57 +0000 (21:56 -0500)]
bcachefs: Fix bch2_journal_noflush_seq()

Improved journal pipelining broke journal_noflush_seq(); it implicitly
assumed only the oldest outstanding journal buf could be in flight, but
that's no longer true.

Make this more straightforward by just setting buf->must_flush whenever
we know a journal buf is going to be flush.

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: fix the error code when mounting with incorrect options.
Hongbo Li [Mon, 19 Feb 2024 12:24:32 +0000 (20:24 +0800)]
bcachefs: fix the error code when mounting with incorrect options.

When mount with incorrect options such as:
"mount -t bcachefs -o errors=back /dev/loop1 /mnt/bcachefs/".
It rebacks the error "mount: /mnt/bcachefs: permission denied."
 cause bch2_parse_mount_opts returns -1 and bch2_mount throws
it up. This is unreasonable.

The real error message should be like this:
"mount: /mnt/bcachefs: wrong fs type, bad option, bad
superblock on /dev/loop1, missing codepage or helper program,
or other error."

Adding three private error codes for mounting error. Here are:
  - BCH_ERR_mount_option as the parent class for option error.
  - BCH_ERR_option_name represents the invalid option name.
  - BCH_ERR_option_value represents the invalid option value.

Signed-off-by: Hongbo Li <[email protected]>
Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: split out ignore_blacklisted, ignore_not_dirty
Kent Overstreet [Sun, 25 Feb 2024 23:48:21 +0000 (18:48 -0500)]
bcachefs: split out ignore_blacklisted, ignore_not_dirty

prep work for replaying the journal backwards

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: improve move_gap()
Kent Overstreet [Sat, 24 Feb 2024 03:43:24 +0000 (22:43 -0500)]
bcachefs: improve move_gap()

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: journal_keys now uses darray helpers
Kent Overstreet [Sat, 24 Feb 2024 05:19:09 +0000 (00:19 -0500)]
bcachefs: journal_keys now uses darray helpers

nice bit of code cleanup

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: Rename journal_keys.d -> journal_keys.data
Kent Overstreet [Sat, 24 Feb 2024 05:15:56 +0000 (00:15 -0500)]
bcachefs: Rename journal_keys.d -> journal_keys.data

This will let us use some darray helpers in the next patch.

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: jset_entry for loops declare loop iter
Kent Overstreet [Sat, 24 Feb 2024 03:46:35 +0000 (22:46 -0500)]
bcachefs: jset_entry for loops declare loop iter

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: Errcode tracepoint, documentation
Kent Overstreet [Thu, 22 Feb 2024 03:10:09 +0000 (22:10 -0500)]
bcachefs: Errcode tracepoint, documentation

Add a tracepoint for downcasting private errors to standard errors, so
they can be recovered even when not logged; also, add some
documentation.

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: remove redundant assignment to variable ret
Colin Ian King [Wed, 21 Feb 2024 11:52:03 +0000 (11:52 +0000)]
bcachefs: remove redundant assignment to variable ret

Variable ret is being assigned a value that is never read, it is
being re-assigned a couple of statements later on. The assignment
is redundant and can be removed.

Cleans up clang scan build warning:
fs/bcachefs/super-io.c:806:2: warning: Value stored to 'ret' is
never read [deadcode.DeadStores]

Signed-off-by: Colin Ian King <[email protected]>
Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: Silence gcc warnings about arm arch ABI drift
Calvin Owens [Mon, 19 Feb 2024 07:36:08 +0000 (23:36 -0800)]
bcachefs: Silence gcc warnings about arm arch ABI drift

32-bit arm builds emit a lot of spam like this:

    fs/bcachefs/backpointers.c: In function â€˜extent_matches_bp’:
    fs/bcachefs/backpointers.c:15:13: note: parameter passing for argument of type â€˜struct bch_backpointer’ changed in GCC 9.1

Apply the change from commit ebcc5928c5d9 ("arm64: Silence gcc warnings
about arch ABI drift") to fs/bcachefs/ to silence them.

Signed-off-by: Calvin Owens <[email protected]>
Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: Add journal.blocked to journal_debug_to_text()
Kent Overstreet [Sun, 18 Feb 2024 00:56:19 +0000 (19:56 -0500)]
bcachefs: Add journal.blocked to journal_debug_to_text()

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: Fix journal_buf bitfield accesses
Kent Overstreet [Sat, 17 Feb 2024 22:54:39 +0000 (17:54 -0500)]
bcachefs: Fix journal_buf bitfield accesses

All jounal_buf bitfield updates must happen under the journal lock -
perhaps we should just switch these to atomic bit flags.

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: Split out discard fastpath
Kent Overstreet [Fri, 16 Feb 2024 06:08:25 +0000 (01:08 -0500)]
bcachefs: Split out discard fastpath

Buckets usually can't be discarded until the transaction that made them
empty has been committed in the journal.

Tracing has indicated that we're queuing the discard worker excessively,
only for it to skip over many buckets that are still waiting on a
journal commit, discarding only one or two buckets per iteration.

We want to switch to only queuing the discard worker after a journal
flush write, but there's an important optimization we need to preserve:
if a bucket becomes empty and it was never committed in the journal
while it was in use, we want to discard it and reuse it right away -
since overwriting it before the previous writes are flushed from the
device cache eans those writes only cost bus bandwidth.

So, this patch implements a fast path for buckets that can be discarded
right away. We need new locking between the two discard workers; the new
list of buckets being discarded provides that locking.

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: improve bch2_journal_buf_to_text()
Kent Overstreet [Sat, 17 Feb 2024 08:26:19 +0000 (03:26 -0500)]
bcachefs: improve bch2_journal_buf_to_text()

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: Drop redundant btree_path_downgrade()s
Kent Overstreet [Sat, 17 Feb 2024 04:50:05 +0000 (23:50 -0500)]
bcachefs: Drop redundant btree_path_downgrade()s

If a path doesn't have any active references, we shouldn't downgrade it;
it'll either be reused, possibly with intent refs again, or dropped at
bch2_trans_begin() time.

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: rebalance_status now shows correct units
Daniel Hill [Thu, 18 Jan 2024 11:27:44 +0000 (00:27 +1300)]
bcachefs: rebalance_status now shows correct units

Signed-off-by: Daniel Hill <[email protected]>
Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: more informative write path error message
Kent Overstreet [Sat, 17 Feb 2024 01:03:12 +0000 (20:03 -0500)]
bcachefs: more informative write path error message

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: check_path() now only needs to walk up to subvolume root
Kent Overstreet [Fri, 16 Feb 2024 04:59:05 +0000 (23:59 -0500)]
bcachefs: check_path() now only needs to walk up to subvolume root

Now that checking subvolume structure is a separate pass, the main
check_directory_connectivity() pass only needs to walk up to a given
inode's subvolume root.

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: bch2_check_subvolume_structure()
Kent Overstreet [Fri, 16 Feb 2024 03:50:42 +0000 (22:50 -0500)]
bcachefs: bch2_check_subvolume_structure()

Now that we've got bch_subvolume.fs_path_parent, it's easy to write
subvolume

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: omit alignment attribute on big endian struct bkey
Thomas Bertschinger [Fri, 16 Feb 2024 02:44:21 +0000 (19:44 -0700)]
bcachefs: omit alignment attribute on big endian struct bkey

This is needed for building Rust bindings on big endian architectures
like s390x. Currently this is only done in userspace, but it might
happen in-kernel in the future. When creating a Rust binding for struct
bkey, the "packed" attribute is needed to get a type with the correct
member offsets in the big endian case. However, rustc does not allow
types to have both a "packed" and "align" attribute. Thus, in order to
get a Rust type compatible with the C type, we must omit the "aligned"
attribute in C.

This does not affect the struct's size or member offsets, only its
toplevel alignment, which should be an acceptable impact.

The little endian version can have the "align" attribute because the
"packed" attr is redundant, and rust-bindgen will omit the "packed" attr
when an "align" attr is present and it can do so without changing a
type's layout

Signed-off-by: Thomas Bertschinger <[email protected]>
Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: bch2_trigger_alloc() handles state changes better
Kent Overstreet [Fri, 16 Feb 2024 02:42:10 +0000 (21:42 -0500)]
bcachefs: bch2_trigger_alloc() handles state changes better

bch2_trigger_alloc() kicks off certain tasks on bucket state changes;
e.g. triggering the bucket discard worker and the invalidate worker.

We've observed the discard worker running too often - most runs it
doesn't do any work, according to the tracepoint - so clearly, we're
kicking it off too often.

This adds an explicit statechange() macro to make these checks more
precise.

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: bch2_print_opts()
Kent Overstreet [Mon, 12 Feb 2024 22:15:29 +0000 (17:15 -0500)]
bcachefs: bch2_print_opts()

Make sure early error messages get redirected, for
kernel-fsck-from-userland.

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: Improve error messages in device remove path
Kent Overstreet [Mon, 12 Feb 2024 20:19:22 +0000 (15:19 -0500)]
bcachefs: Improve error messages in device remove path

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: Use kvzalloc() when dynamically allocating btree paths
Kent Overstreet [Mon, 12 Feb 2024 20:17:14 +0000 (15:17 -0500)]
bcachefs: Use kvzalloc() when dynamically allocating btree paths

THis silences a mm/page_alloc.c warning about allocating more than a
page with GFP_NOFAIL - and there's no reason for this to not have a
vmalloc fallback anyways.

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: Track iter->ip_allocated at bch2_trans_copy_iter()
Kent Overstreet [Sat, 10 Feb 2024 01:16:41 +0000 (20:16 -0500)]
bcachefs: Track iter->ip_allocated at bch2_trans_copy_iter()

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: Save key_cache_path in peek_slot()
Kent Overstreet [Sat, 10 Feb 2024 01:15:03 +0000 (20:15 -0500)]
bcachefs: Save key_cache_path in peek_slot()

When bch2_btree_iter_peek_slot() clones the iterator to search for the
next key, and then discovers that the key from the cloned iterator is
the key we want to return - we also want to save the
iter->key_cache_path as well, for the update path.

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: Pin btree cache in ram for random access in fsck
Kent Overstreet [Tue, 23 Jan 2024 05:01:07 +0000 (00:01 -0500)]
bcachefs: Pin btree cache in ram for random access in fsck

Various phases of fsck involve checking references from one btree to
another: this means doing a sequential scan of one btree, and then
mostly random access into the second.

This is particularly painful for checking extents <-> backpointers; we
can prefetch btree node access on the sequential scan, but not on the
random access portion, and this is particularly painful on spinning
rust, where we'd like to keep the pipeline fairly full of btree node
reads so that the elevator can reduce seeking.

This patch implements prefetching and pinning of the portion of the
btree that we'll be doing random access to. We already calculate how
much of the random access btree will fit in memory so it's a fairly
straightforward change.

This will put more pressure on system memory usage, so we introduce a
new option, fsck_memory_usage_percent, which is the percentage of total
system ram that fsck is allowed to pin.

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: Check for subvolume children when deleting subvolumes
Kent Overstreet [Sat, 10 Feb 2024 02:01:04 +0000 (21:01 -0500)]
bcachefs: Check for subvolume children when deleting subvolumes

Recursively destroying subvolumes isn't allowed yet.

Fixes: https://github.com/koverstreet/bcachefs/issues/634
Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: BTREE_ID_subvolume_children
Kent Overstreet [Sun, 21 Jan 2024 11:00:07 +0000 (06:00 -0500)]
bcachefs: BTREE_ID_subvolume_children

Add a btree to record a parent -> child subvolume relationships,
according to the filesystem heirarchy.

The subvolume_children btree is a bitset btree: if a bit is set at pos
p, that means p.offset is a child of subvolume p.inode.

This will be used for efficiently listing subvolumes, as well as
recursive deletion.

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: bch_subvolume::fs_path_parent
Kent Overstreet [Thu, 8 Feb 2024 23:39:42 +0000 (18:39 -0500)]
bcachefs: bch_subvolume::fs_path_parent

Record the filesystem path heirarchy for subvolumes in bch_subvolume

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: bch2_btree_bit_mod()
Kent Overstreet [Fri, 9 Feb 2024 00:23:56 +0000 (19:23 -0500)]
bcachefs: bch2_btree_bit_mod()

Provide a non-write buffer version of bch2_btree_bit_mod_buffered(), for
the subvolume children btree.

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: bch2_btree_bit_mod -> bch2_btree_bit_mod_buffered
Kent Overstreet [Fri, 9 Feb 2024 00:10:19 +0000 (19:10 -0500)]
bcachefs: bch2_btree_bit_mod -> bch2_btree_bit_mod_buffered

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: Correctly reattach subvolumes
Kent Overstreet [Fri, 9 Feb 2024 21:04:50 +0000 (16:04 -0500)]
bcachefs: Correctly reattach subvolumes

Subvolumes need special handling to reattach - we always reattach them
in the root subvolume's lost+found, and they need a slightly different
kind of dirent.

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: check_path() now prints full inode when reattaching
Kent Overstreet [Fri, 9 Feb 2024 04:08:21 +0000 (23:08 -0500)]
bcachefs: check_path() now prints full inode when reattaching

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: Pass inode bkey to check_path()
Kent Overstreet [Fri, 9 Feb 2024 03:52:40 +0000 (22:52 -0500)]
bcachefs: Pass inode bkey to check_path()

prep work for improving logging/error messages

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: Fix path where dirent -> subvol missing and we don't fix
Kent Overstreet [Fri, 9 Feb 2024 00:52:37 +0000 (19:52 -0500)]
bcachefs: Fix path where dirent -> subvol missing and we don't fix

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: bch_subvolume::parent -> creation_parent
Kent Overstreet [Mon, 22 Jan 2024 20:12:28 +0000 (15:12 -0500)]
bcachefs: bch_subvolume::parent -> creation_parent

bit of renaming, prep for adding a fs path parent

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: Repair subvol dirents that point to non subvols
Kent Overstreet [Sun, 21 Jan 2024 19:57:58 +0000 (14:57 -0500)]
bcachefs: Repair subvol dirents that point to non subvols

when repair switches d_type to or from DT_SUBVOL, we need to update the
target accordingly

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: check dirent->d_parent_subvol
Kent Overstreet [Wed, 7 Feb 2024 05:45:09 +0000 (00:45 -0500)]
bcachefs: check dirent->d_parent_subvol

Check that d_parent_subvol makes sense - the dirent's snapshot must be
visible in d_parent_subvol (i.e. an ancestor of d_parent_subvol's
snapshot) in order to be visible.

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: check inode->bi_parent_subvol against dirent
Kent Overstreet [Wed, 7 Feb 2024 05:23:25 +0000 (00:23 -0500)]
bcachefs: check inode->bi_parent_subvol against dirent

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: delete duplicated checks in check_dirent_to_subvol()
Kent Overstreet [Wed, 7 Feb 2024 05:06:14 +0000 (00:06 -0500)]
bcachefs: delete duplicated checks in check_dirent_to_subvol()

these were already checked in check_subvol()

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: simplify check_dirent_inode_dirent()
Kent Overstreet [Wed, 7 Feb 2024 04:51:23 +0000 (23:51 -0500)]
bcachefs: simplify check_dirent_inode_dirent()

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: check bi_parent_subvol in check_inode()
Kent Overstreet [Wed, 7 Feb 2024 04:41:46 +0000 (23:41 -0500)]
bcachefs: check bi_parent_subvol in check_inode()

check for inodes with a nonzero bi_parent_subvol field that aren't
actually subvolume roots

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: better log message in lookup_inode_for_snapshot()
Kent Overstreet [Thu, 8 Feb 2024 21:02:08 +0000 (16:02 -0500)]
bcachefs: better log message in lookup_inode_for_snapshot()

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: check_inode_dirent_inode()
Kent Overstreet [Wed, 7 Feb 2024 04:39:08 +0000 (23:39 -0500)]
bcachefs: check_inode_dirent_inode()

check that if an inode has a backpointer, the dirent it points to points
back to it.

We do this in check_dirent_inode_dirent(), but only for inodes that have
dirents that point to them - we also have to do the check starting from
the inode to catch inodes that don't have dirents that point to them.

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: Check subvol <-> inode pointers in check_inode()
Kent Overstreet [Tue, 6 Feb 2024 03:30:51 +0000 (22:30 -0500)]
bcachefs: Check subvol <-> inode pointers in check_inode()

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: Check subvol <-> inode pointers in check_subvol()
Kent Overstreet [Tue, 6 Feb 2024 03:20:12 +0000 (22:20 -0500)]
bcachefs: Check subvol <-> inode pointers in check_subvol()

Subvolumes and subvolume root inodes point to each other: this verifies
the subvolume -> inode -> subvolme path.

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: Kill more -EIO error codes
Kent Overstreet [Tue, 6 Feb 2024 22:24:18 +0000 (17:24 -0500)]
bcachefs: Kill more -EIO error codes

This converts -EIOs related to btree node errors to private error codes,
which will help with some ongoing debugging by giving us better error
messages.

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: thread_with_file: add f_ops.flush
Kent Overstreet [Sun, 18 Feb 2024 01:49:11 +0000 (20:49 -0500)]
bcachefs: thread_with_file: add f_ops.flush

Add a flush op, to return the exit code via close().

Also update bcachefs usage to use this to return fsck exit codes.

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: thread_with_file: Fix missing va_end()
Kent Overstreet [Wed, 14 Feb 2024 01:26:09 +0000 (20:26 -0500)]
bcachefs: thread_with_file: Fix missing va_end()

Fixes: https://lore.kernel.org/linux-bcachefs/202402131603.E953E2CF@keescook/T/#u
Reported-by: coverity scan
Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: thread_with_file: allow ioctls against these files
Darrick J. Wong [Sat, 10 Feb 2024 19:32:20 +0000 (11:32 -0800)]
bcachefs: thread_with_file: allow ioctls against these files

Make it so that a thread_with_stdio user can handle ioctls against the
file descriptor.

Signed-off-by: Darrick J. Wong <[email protected]>
Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: thread_with_file: create ops structure for thread_with_stdio
Darrick J. Wong [Sat, 10 Feb 2024 19:23:01 +0000 (11:23 -0800)]
bcachefs: thread_with_file: create ops structure for thread_with_stdio

Create an ops structure so we can add more file-based functionality in
the next few patches.

Signed-off-by: Darrick J. Wong <[email protected]>
Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: thread_with_file: fix various printf problems
Darrick J. Wong [Wed, 7 Feb 2024 19:39:03 +0000 (11:39 -0800)]
bcachefs: thread_with_file: fix various printf problems

Experimentally fix some problems with stdio_redirect_vprintf by creating
a MOO variant with which we can experiment.  We can't do a GFP_KERNEL
allocation while holding the spinlock, and I don't like how the printf
function can silently truncate the output if memory allocation fails.

Signed-off-by: Darrick J. Wong <[email protected]>
Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: thread_with_file: allow creation of readonly files
Darrick J. Wong [Wed, 7 Feb 2024 19:43:32 +0000 (11:43 -0800)]
bcachefs: thread_with_file: allow creation of readonly files

Create a new run_thread_with_stdout function that opens a file in
O_RDONLY mode so that the kernel can write things to userspace but
userspace cannot write to the kernel.  This will be used to convey xfs
health event information to userspace.

Signed-off-by: Darrick J. Wong <[email protected]>
Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: thread_with_stdio: suppress hung task warning
Kent Overstreet [Fri, 9 Feb 2024 01:41:34 +0000 (20:41 -0500)]
bcachefs: thread_with_stdio: suppress hung task warning

Signed-off-by: Kent Overstreet <[email protected]>
12 months agokernel/hung_task.c: export sysctl_hung_task_timeout_secs
Kent Overstreet [Fri, 9 Feb 2024 06:04:38 +0000 (01:04 -0500)]
kernel/hung_task.c: export sysctl_hung_task_timeout_secs

needed for thread_with_file; also rare but not unheard of to need this
in module code, when blocking on user input.

one workaround used by some code is wait_event_interruptible() - but
that can be buggy if the outer context isn't expecting unwinding.

Signed-off-by: Kent Overstreet <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: fuyuanli <[email protected]>
12 months agobcachefs: thread_with_stdio: Mark completed in ->release()
Kent Overstreet [Fri, 9 Feb 2024 01:27:06 +0000 (20:27 -0500)]
bcachefs: thread_with_stdio: Mark completed in ->release()

This fixes stdio_redirect_read() getting stuck, not noticing that the
pipe has been closed.

Signed-off-by: Kent Overstreet <[email protected]>
12 months agoof: unittest: Use for_each_child_of_node_scoped()
Jonathan Cameron [Sun, 25 Feb 2024 14:27:13 +0000 (14:27 +0000)]
of: unittest: Use for_each_child_of_node_scoped()

A simple example of the utility of this autocleanup approach to
handling of_node_put().

In this particular case some of the nodes needed for the test are
not available and the _available_ version would cause them to be
skipped resulting in a test failure.

Signed-off-by: Jonathan Cameron <[email protected]>
Reviewed-by: Rob Herring <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Rob Herring <[email protected]>
12 months agoof: Introduce for_each_*_child_of_node_scoped() to automate of_node_put() handling
Jonathan Cameron [Sun, 25 Feb 2024 14:27:12 +0000 (14:27 +0000)]
of: Introduce for_each_*_child_of_node_scoped() to automate of_node_put() handling

To avoid issues with out of order cleanup, or ambiguity about when the
auto freed data is first instantiated, do it within the for loop definition.

The disadvantage is that the struct device_node *child variable creation
is not immediately obvious where this is used.
However, in many cases, if there is another definition of
struct device_node *child; the compiler / static analysers will notify us
that it is unused, or uninitialized.

Note that, in the vast majority of cases, the _available_ form should be
used and as code is converted to these scoped handers, we should confirm
that any cases that do not check for available have a good reason not
to.

Signed-off-by: Jonathan Cameron <[email protected]>
Reviewed-by: Rob Herring <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Rob Herring <[email protected]>
12 months agoof: Add cleanup.h based auto release via __free(device_node) markings
Jonathan Cameron [Sun, 25 Feb 2024 14:27:11 +0000 (14:27 +0000)]
of: Add cleanup.h based auto release via __free(device_node) markings

The recent addition of scope based cleanup support to the kernel
provides a convenient tool to reduce the chances of leaking reference
counts where of_node_put() should have been called in an error path.

This enables
struct device_node *child __free(device_node) = NULL;

for_each_child_of_node(np, child) {
if (test)
return test;
}

with no need for a manual call of of_node_put().
A following patch will reduce the scope of the child variable to the
for loop, to avoid an issues with ordering of autocleanup, and make it
obvious when this assigned a non NULL value.

In this simple example the gains are small but there are some very
complex error handling cases buried in these loops that will be
greatly simplified by enabling early returns with out the need
for this manual of_node_put() call.

Note that there are coccinelle checks in
scripts/coccinelle/iterators/for_each_child.cocci to detect a failure
to call of_node_put(). This new approach does not cause false positives.
Longer term we may want to add scripting to check this new approach is
done correctly with no double of_node_put() calls being introduced due
to the auto cleanup. It may also be useful to script finding places
this new approach is useful.

Signed-off-by: Jonathan Cameron <[email protected]>
Reviewed-by: Rob Herring <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Rob Herring <[email protected]>
12 months agobcachefs: Thread with file documentation
Kent Overstreet [Sat, 3 Feb 2024 20:43:16 +0000 (15:43 -0500)]
bcachefs: Thread with file documentation

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: thread_with_stdio: fix bch2_stdio_redirect_readline()
Kent Overstreet [Mon, 5 Feb 2024 03:56:16 +0000 (22:56 -0500)]
bcachefs: thread_with_stdio: fix bch2_stdio_redirect_readline()

This fixes a bug where we'd return data without waiting for a newline,
if data was present but a newline was not.

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: thread_with_stdio: kill thread_with_stdio_done()
Kent Overstreet [Mon, 5 Feb 2024 03:49:34 +0000 (22:49 -0500)]
bcachefs: thread_with_stdio: kill thread_with_stdio_done()

Move the cleanup code to a wrapper function, where we can call it after
the thread_with_stdio fn exits.

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: thread_with_stdio: convert to darray
Kent Overstreet [Mon, 5 Feb 2024 03:20:40 +0000 (22:20 -0500)]
bcachefs: thread_with_stdio: convert to darray

 - eliminate the dependency on printbufs, so that we can lift
   thread_with_file for use in xfs
 - add a nonblocking parameter to stdio_redirect_printf(), and either
   block if the buffer is full or drop it on the floor - don't buffer
   infinitely

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: thread_with_stdio: eliminate double buffering
Kent Overstreet [Mon, 5 Feb 2024 01:19:49 +0000 (20:19 -0500)]
bcachefs: thread_with_stdio: eliminate double buffering

The output buffer lock has to be a spinlock so that we can write to it
from interrupt context, so we can't use a direct copy_to_user; this
switches thread_with_file_read() to use fault_in_writeable() and
copy_to_user_nofault(), similar to how thread_with_file_write() works.

Signed-off-by: Kent Overstreet <[email protected]>
12 months agobcachefs: kill kvpmalloc()
Kent Overstreet [Thu, 1 Feb 2024 11:35:46 +0000 (06:35 -0500)]
bcachefs: kill kvpmalloc()

Signed-off-by: Kent Overstreet <[email protected]>
12 months agomempool: kvmalloc pool
Kent Overstreet [Thu, 1 Feb 2024 11:28:41 +0000 (06:28 -0500)]
mempool: kvmalloc pool

Add mempool_init_kvmalloc_pool() and mempool_create_kvmalloc_pool(),
which wrap kvmalloc() instead of kmalloc() - kmalloc() with a vmalloc()
fallback.

This is part of a bcachefs cleanup - dropping an internal kvpmalloc()
helper (which predates kvmalloc()) along with mempool helpers; this
replaces the bcachefs-private kvpmalloc_pool.

Signed-off-by: Kent Overstreet <[email protected]>
Cc: [email protected]
12 months agomtd: spi-nor: core: correct type of i
Muhammad Usama Anjum [Mon, 4 Mar 2024 09:01:03 +0000 (14:01 +0500)]
mtd: spi-nor: core: correct type of i

The i should be signed to find out the end of the loop. Otherwise,
i >= 0 is always true and loop becomes infinite. Make its type to be
int.

Fixes: 6a9eda34418f ("mtd: spi-nor: core: set mtd->eraseregions for non-uniform erase map")
Signed-off-by: Muhammad Usama Anjum <[email protected]>
Reviewed-by: Tudor Ambarus <[email protected]>
Reviewed-by: Michael Walle <[email protected]>
Reviewed-by: Dan Carpenter <[email protected]>
Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
Signed-off-by: Miquel Raynal <[email protected]>
Link: https://lore.kernel.org/linux-mtd/[email protected]
12 months agoMerge tag 'spi-nor/for-6.9' into mtd/next
Miquel Raynal [Wed, 13 Mar 2024 22:21:48 +0000 (23:21 +0100)]
Merge tag 'spi-nor/for-6.9' into mtd/next

SPI NOR gets the non uniform erase code cleaned. We stopped using
bitmasks for erase types and flags, and instead introduced dedicated
members. We then passed the SPI NOR erase map to MTD. Users can now
determine the erase regions and make informed decisions on partitions
size.

12 months agoRevert "block/mq-deadline: use correct way to throttling write requests"
Bart Van Assche [Wed, 13 Mar 2024 21:42:18 +0000 (14:42 -0700)]
Revert "block/mq-deadline: use correct way to throttling write requests"

The code "max(1U, 3 * (1U << shift)  / 4)" comes from the Kyber I/O
scheduler. The Kyber I/O scheduler maintains one internal queue per hwq
and hence derives its async_depth from the number of hwq tags. Using
this approach for the mq-deadline scheduler is wrong since the
mq-deadline scheduler maintains one internal queue for all hwqs
combined. Hence this revert.

Cc: [email protected]
Cc: Damien Le Moal <[email protected]>
Cc: Harshit Mogalapalli <[email protected]>
Cc: Zhiguo Niu <[email protected]>
Fixes: d47f9717e5cf ("block/mq-deadline: use correct way to throttling write requests")
Signed-off-by: Bart Van Assche <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
12 months agoMerge tag 'fs_for_v6.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack...
Linus Torvalds [Wed, 13 Mar 2024 21:30:58 +0000 (14:30 -0700)]
Merge tag 'fs_for_v6.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs

Pull ext2, isofs, udf, and quota updates from Jan Kara:
 "A lot of material this time:

   - removal of a lot of GFP_NOFS usage from ext2, udf, quota (either it
     was legacy or replaced with scoped memalloc_nofs_*() API)

   - removal of BUG_ONs in quota code

   - conversion of UDF to the new mount API

   - tightening quota on disk format verification

   - fix some potentially unsafe use of RCU pointers in quota code and
     annotate everything properly to make sparse happy

   - a few other small quota, ext2, udf, and isofs fixes"

* tag 'fs_for_v6.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs: (26 commits)
  udf: remove SLAB_MEM_SPREAD flag usage
  quota: remove SLAB_MEM_SPREAD flag usage
  isofs: remove SLAB_MEM_SPREAD flag usage
  ext2: remove SLAB_MEM_SPREAD flag usage
  ext2: mark as deprecated
  udf: convert to new mount API
  udf: convert novrs to an option flag
  MAINTAINERS: add missing git address for ext2 entry
  quota: Detect loops in quota tree
  quota: Properly annotate i_dquot arrays with __rcu
  quota: Fix rcu annotations of inode dquot pointers
  isofs: handle CDs with bad root inode but good Joliet root directory
  udf: Avoid invalid LVID used on mount
  quota: Fix potential NULL pointer dereference
  quota: Drop GFP_NOFS instances under dquot->dq_lock and dqio_sem
  quota: Set nofs allocation context when acquiring dqio_sem
  ext2: Remove GFP_NOFS use in ext2_xattr_cache_insert()
  ext2: Drop GFP_NOFS use in ext2_get_blocks()
  ext2: Drop GFP_NOFS allocation from ext2_init_block_alloc_info()
  udf: Remove GFP_NOFS allocation in udf_expand_file_adinicb()
  ...

12 months agoMerge tag 'fsnotify_for_v6.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Wed, 13 Mar 2024 21:27:24 +0000 (14:27 -0700)]
Merge tag 'fsnotify_for_v6.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs

Pull fsnotify updates from Jan Kara:

 - fsnotify optimizations to reduce cost of fsnotify when nobody is
   watching

 - fix longstanding wart that system could not be suspended when some
   process was waiting for response to fanotify permission event

 - some spelling fixes

* tag 'fsnotify_for_v6.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
  fanotify: allow freeze when waiting response for permission events
  fanotify: Fix misspelling of "writable"
  fsnotify: Fix misspelling of "writable"
  inotify: Fix misspelling of "writable"
  fsnotify: Add fsnotify_sb_has_watchers() helper
  fsnotify: optimize the case of no parent watcher

12 months agoMerge tag 'xfs-6.9-merge-8' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
Linus Torvalds [Wed, 13 Mar 2024 20:52:24 +0000 (13:52 -0700)]
Merge tag 'xfs-6.9-merge-8' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux

Pull xfs updates from Chandan Babu:

 - Online repair updates:
    - More ondisk structures being repaired:
        - Inode's mode field by trying to obtain file type value from
          the a directory entry
        - Quota counters
        - Link counts of inodes
        - FS summary counters
        - Support for in-memory btrees has been added to support repair
          of rmap btrees
    - Misc changes:
        - Report corruption of metadata to the health tracking subsystem
        - Enable indirect health reporting when resources are scarce
        - Reduce memory usage while repairing refcount btree
        - Extend "Bmap update" intent item to support atomic extent
          swapping on the realtime device
        - Extend "Bmap update" intent item to support extended attribute
          fork and unwritten extents
    - Code cleanups:
        - Bmap log intent
        - Btree block pointer checking
        - Btree readahead
        - Buffer target
        - Symbolic link code

 - Remove mrlock wrapper around the rwsem

 - Convert all the GFP_NOFS flag usages to use the scoped
   memalloc_nofs_save() API instead of direct calls with the GFP_NOFS

 - Refactor and simplify xfile abstraction. Lower level APIs in shmem.c
   are required to be exported in order to achieve this

 - Skip checking alignment constraints for inode chunk allocations when
   block size is larger than inode chunk size

 - Do not submit delwri buffers collected during log recovery when an
   error has been encountered

 - Fix SEEK_HOLE/DATA for file regions which have active COW extents

 - Fix lock order inversion when executing error handling path during
   shrinking a filesystem

 - Remove duplicate ifdefs

* tag 'xfs-6.9-merge-8' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux: (183 commits)
  xfs: shrink failure needs to hold AGI buffer
  mm/shmem.c: Use new form of *@param in kernel-doc
  kernel-doc: Add unary operator * to $type_param_ref
  xfs: use kvfree() in xlog_cil_free_logvec()
  xfs: xfs_btree_bload_prep_block() should use __GFP_NOFAIL
  xfs: fix scrub stats file permissions
  xfs: fix log recovery erroring out on refcount recovery failure
  xfs: move symlink target write function to libxfs
  xfs: move remote symlink target read function to libxfs
  xfs: move xfs_symlink_remote.c declarations to xfs_symlink_remote.h
  xfs: xfs_bmap_finish_one should map unwritten extents properly
  xfs: support deferred bmap updates on the attr fork
  xfs: support recovering bmap intent items targetting realtime extents
  xfs: add a realtime flag to the bmap update log redo items
  xfs: add a xattr_entry helper
  xfs: fix xfs_bunmapi to allow unmapping of partial rt extents
  xfs: move xfs_bmap_defer_add to xfs_bmap_item.c
  xfs: reuse xfs_bmap_update_cancel_item
  xfs: add a bi_entry helper
  xfs: remove xfs_trans_set_bmap_flags
  ...

12 months agoMerge branch 'for-6.9/wacom' into for-linus
Jiri Kosina [Wed, 13 Mar 2024 20:24:39 +0000 (21:24 +0100)]
Merge branch 'for-6.9/wacom' into for-linus

- small cleanup of struct->wacom_wac usage (Tatsunosuke Tobita)

12 months agoMerge branch 'for-6.9/unused-struct-removal' into for-linus
Jiri Kosina [Wed, 13 Mar 2024 20:23:58 +0000 (21:23 +0100)]
Merge branch 'for-6.9/unused-struct-removal' into for-linus

- removal of unused data structures all over the place (Jiri Slaby)

12 months agoMerge branch 'for-6.9/samsung' into for-linus
Jiri Kosina [Wed, 13 Mar 2024 20:22:11 +0000 (21:22 +0100)]
Merge branch 'for-6.9/samsung' into for-linus

- support for the following Bluetooth devices (Sandeep C S):

        Samsung wireless Keyboard
        Samsung wireless GamePad
        Samsung Wireless Action Mouse
        Samsung Wireless Book Cover
        Samsung Wireless Universal Keyboard
        Samsung Wireless HOGP Keyboard

Signed-off-by: Jiri Kosina <[email protected]>
12 months agoMerge branch 'for-6.9/nintendo' into for-linus
Jiri Kosina [Wed, 13 Mar 2024 20:21:02 +0000 (21:21 +0100)]
Merge branch 'for-6.9/nintendo' into for-linus

- dead code removal in hid-nintendo (Jiapeng Chong)

This page took 0.117784 seconds and 4 git commands to generate.