mirror of
				https://github.com/torvalds/linux.git
				synced 2025-10-31 00:28:52 +02:00 
			
		
		
		
	 e1b1d03cee
			
		
	
	
		e1b1d03cee
		
	
	
	
	
		
			
			-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCAAuFiEEwPw5LcreJtl1+l5K99NY+ylx4KYFAmjbLCgQHGF4Ym9lQGtl
 cm5lbC5kawAKCRD301j7KXHgpoY0D/9J+11BC88pBxCrLKv/V2TwCNokRMi0dU3L
 r3EUdA46k0oXmvb6ueZqIcfY2e+IX7rdQkaRbh1zRdsNejqHo4548C3ePWGdBAcM
 OdNEGfpehO0aD0td1+mK/NxoJMLhbs5QraPanz+SOkGZOKeF+vGCga5PUDivsr5J
 16T9yb7i+isENLdAc2RJbZVyAphqHQlo5GHi5ZIKOVi5cNt8GU/q2sQl7NYmGvHd
 aq37svvZHFOhLRajP959Fw9WOxEYITewzQ4UYf1FZjUodJUxO+vCnP0ooBQRlyu8
 1B4PYWwSE+Vn3GkQE0Om+mzo9AVPOiLmoAWGxdgJBMyEkZndocr46XEslXOufQ1Z
 T3Gu19G6jCxcyByNVhjVnaajYKmvSQAy1w75m4XlfqTRm4f9Om+LAJavUk3RuaOL
 7lXKQ7Ql1/Tby9Jmf8afjYYXXotNDNku6rz2P3qtOwAA26mNJfgVt0rO+8XGRDe9
 ioLbCkTjslYMc/Oh4jSsbrspsVALbaQMq/Dmah8k0EWb4QAHVgCJyGBoff3hOboI
 jD6B1enaKOQVgcjWcjm/FjOk3jv2h3v4X26YWQZTvEc/1PnSnST78Zi/ePhzDdmt
 sBALUAS37TfTgNMzrhbHl5Zs13k0C0XyANuayuKuo5hlNnC1wbdap+5FZJOmpuOB
 YT+VkYnaOA==
 =kOmc
 -----END PGP SIGNATURE-----
Merge tag 'for-6.18/block-20250929' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux
Pull block updates from Jens Axboe:
 - NVMe pull request via Keith:
     - FC target fixes (Daniel)
     - Authentication fixes and updates (Martin, Chris)
     - Admin controller handling (Kamaljit)
     - Target lockdep assertions (Max)
     - Keep-alive updates for discovery (Alastair)
     - Suspend quirk (Georg)
 - MD pull request via Yu:
     - Add support for a lockless bitmap.
       A key feature for the new bitmap are that the IO fastpath is
       lockless. If a user issues lots of write IO to the same bitmap
       bit in a short time, only the first write has additional overhead
       to update bitmap bit, no additional overhead for the following
       writes.
       By supporting only resync or recover written data, means in the
       case creating new array or replacing with a new disk, there is no
       need to do a full disk resync/recovery.
 - Switch ->getgeo() and ->bios_param() to using struct gendisk rather
   than struct block_device.
 - Rust block changes via Andreas. This series adds configuration via
   configfs and remote completion to the rnull driver. The series also
   includes a set of changes to the rust block device driver API: a few
   cleanup patches, and a few features supporting the rnull changes.
   The series removes the raw buffer formatting logic from
   `kernel::block` and improves the logic available in `kernel::string`
   to support the same use as the removed logic.
 - floppy arch cleanups
 - Reduce the number of dereferencing needed for ublk commands
 - Restrict supported sockets for nbd. Mostly done to eliminate a class
   of issues perpetually reported by syzbot, by using nonsensical socket
   setups.
 - A few s390 dasd block fixes
 - Fix a few issues around atomic writes
 - Improve DMA interation for integrity requests
 - Improve how iovecs are treated with regards to O_DIRECT aligment
   constraints.
   We used to require each segment to adhere to the constraints, now
   only the request as a whole needs to.
 - Clean up and improve p2p support, enabling use of p2p for metadata
   payloads
 - Improve locking of request lookup, using SRCU where appropriate
 - Use page references properly for brd, avoiding very long RCU sections
 - Fix ordering of recursively submitted IOs
 - Clean up and improve updating nr_requests for a live device
 - Various fixes and cleanups
* tag 'for-6.18/block-20250929' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux: (164 commits)
  s390/dasd: enforce dma_alignment to ensure proper buffer validation
  s390/dasd: Return BLK_STS_INVAL for EINVAL from do_dasd_request
  ublk: remove redundant zone op check in ublk_setup_iod()
  nvme: Use non zero KATO for persistent discovery connections
  nvmet: add safety check for subsys lock
  nvme-core: use nvme_is_io_ctrl() for I/O controller check
  nvme-core: do ioccsz/iorcsz validation only for I/O controllers
  nvme-core: add method to check for an I/O controller
  blk-cgroup: fix possible deadlock while configuring policy
  blk-mq: fix null-ptr-deref in blk_mq_free_tags() from error path
  blk-mq: Fix more tag iteration function documentation
  selftests: ublk: fix behavior when fio is not installed
  ublk: don't access ublk_queue in ublk_unmap_io()
  ublk: pass ublk_io to __ublk_complete_rq()
  ublk: don't access ublk_queue in ublk_need_complete_req()
  ublk: don't access ublk_queue in ublk_check_commit_and_fetch()
  ublk: don't pass ublk_queue to ublk_fetch()
  ublk: don't access ublk_queue in ublk_config_io_buf()
  ublk: don't access ublk_queue in ublk_check_fetch_buf()
  ublk: pass q_id and tag to __ublk_check_and_get_req()
  ...
		
	
			
		
			
				
	
	
		
			192 lines
		
	
	
	
		
			5.2 KiB
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			192 lines
		
	
	
	
		
			5.2 KiB
		
	
	
	
		
			Rust
		
	
	
	
	
	
| // SPDX-License-Identifier: GPL-2.0
 | |
| 
 | |
| //! Rust configfs sample.
 | |
| 
 | |
| use kernel::alloc::flags;
 | |
| use kernel::c_str;
 | |
| use kernel::configfs;
 | |
| use kernel::configfs::configfs_attrs;
 | |
| use kernel::new_mutex;
 | |
| use kernel::page::PAGE_SIZE;
 | |
| use kernel::prelude::*;
 | |
| use kernel::sync::Mutex;
 | |
| 
 | |
| module! {
 | |
|     type: RustConfigfs,
 | |
|     name: "rust_configfs",
 | |
|     authors: ["Rust for Linux Contributors"],
 | |
|     description: "Rust configfs sample",
 | |
|     license: "GPL",
 | |
| }
 | |
| 
 | |
| #[pin_data]
 | |
| struct RustConfigfs {
 | |
|     #[pin]
 | |
|     config: configfs::Subsystem<Configuration>,
 | |
| }
 | |
| 
 | |
| #[pin_data]
 | |
| struct Configuration {
 | |
|     message: &'static CStr,
 | |
|     #[pin]
 | |
|     bar: Mutex<(KBox<[u8; PAGE_SIZE]>, usize)>,
 | |
| }
 | |
| 
 | |
| impl Configuration {
 | |
|     fn new() -> impl PinInit<Self, Error> {
 | |
|         try_pin_init!(Self {
 | |
|             message: c_str!("Hello World\n"),
 | |
|             bar <- new_mutex!((KBox::new([0; PAGE_SIZE], flags::GFP_KERNEL)?, 0)),
 | |
|         })
 | |
|     }
 | |
| }
 | |
| 
 | |
| impl kernel::InPlaceModule for RustConfigfs {
 | |
|     fn init(_module: &'static ThisModule) -> impl PinInit<Self, Error> {
 | |
|         pr_info!("Rust configfs sample (init)\n");
 | |
| 
 | |
|         // Define a subsystem with the data type `Configuration`, two
 | |
|         // attributes, `message` and `bar` and child group type `Child`. `mkdir`
 | |
|         // in the directory representing this subsystem will create directories
 | |
|         // backed by the `Child` type.
 | |
|         let item_type = configfs_attrs! {
 | |
|             container: configfs::Subsystem<Configuration>,
 | |
|             data: Configuration,
 | |
|             child: Child,
 | |
|             attributes: [
 | |
|                 message: 0,
 | |
|                 bar: 1,
 | |
|             ],
 | |
|         };
 | |
| 
 | |
|         try_pin_init!(Self {
 | |
|             config <- configfs::Subsystem::new(
 | |
|                 c_str!("rust_configfs"), item_type, Configuration::new()
 | |
|             ),
 | |
|         })
 | |
|     }
 | |
| }
 | |
| 
 | |
| #[vtable]
 | |
| impl configfs::GroupOperations for Configuration {
 | |
|     type Child = Child;
 | |
| 
 | |
|     fn make_group(&self, name: &CStr) -> Result<impl PinInit<configfs::Group<Child>, Error>> {
 | |
|         // Define a group with data type `Child`, one attribute `baz` and child
 | |
|         // group type `GrandChild`. `mkdir` in the directory representing this
 | |
|         // group will create directories backed by the `GrandChild` type.
 | |
|         let tpe = configfs_attrs! {
 | |
|             container: configfs::Group<Child>,
 | |
|             data: Child,
 | |
|             child: GrandChild,
 | |
|             attributes: [
 | |
|                 baz: 0,
 | |
|             ],
 | |
|         };
 | |
| 
 | |
|         Ok(configfs::Group::new(name.try_into()?, tpe, Child::new()))
 | |
|     }
 | |
| }
 | |
| 
 | |
| #[vtable]
 | |
| impl configfs::AttributeOperations<0> for Configuration {
 | |
|     type Data = Configuration;
 | |
| 
 | |
|     fn show(container: &Configuration, page: &mut [u8; PAGE_SIZE]) -> Result<usize> {
 | |
|         pr_info!("Show message\n");
 | |
|         let data = container.message.to_bytes();
 | |
|         page[0..data.len()].copy_from_slice(data);
 | |
|         Ok(data.len())
 | |
|     }
 | |
| }
 | |
| 
 | |
| #[vtable]
 | |
| impl configfs::AttributeOperations<1> for Configuration {
 | |
|     type Data = Configuration;
 | |
| 
 | |
|     fn show(container: &Configuration, page: &mut [u8; PAGE_SIZE]) -> Result<usize> {
 | |
|         pr_info!("Show bar\n");
 | |
|         let guard = container.bar.lock();
 | |
|         let data = guard.0.as_slice();
 | |
|         let len = guard.1;
 | |
|         page[0..len].copy_from_slice(&data[0..len]);
 | |
|         Ok(len)
 | |
|     }
 | |
| 
 | |
|     fn store(container: &Configuration, page: &[u8]) -> Result {
 | |
|         pr_info!("Store bar\n");
 | |
|         let mut guard = container.bar.lock();
 | |
|         guard.0[0..page.len()].copy_from_slice(page);
 | |
|         guard.1 = page.len();
 | |
|         Ok(())
 | |
|     }
 | |
| }
 | |
| 
 | |
| // `pin_data` cannot handle structs without braces.
 | |
| #[pin_data]
 | |
| struct Child {}
 | |
| 
 | |
| impl Child {
 | |
|     fn new() -> impl PinInit<Self, Error> {
 | |
|         try_pin_init!(Self {})
 | |
|     }
 | |
| }
 | |
| 
 | |
| #[vtable]
 | |
| impl configfs::GroupOperations for Child {
 | |
|     type Child = GrandChild;
 | |
| 
 | |
|     fn make_group(&self, name: &CStr) -> Result<impl PinInit<configfs::Group<GrandChild>, Error>> {
 | |
|         // Define a group with data type `GrandChild`, one attribute `gc`. As no
 | |
|         // child type is specified, it will not be possible to create subgroups
 | |
|         // in this group, and `mkdir`in the directory representing this group
 | |
|         // will return an error.
 | |
|         let tpe = configfs_attrs! {
 | |
|             container: configfs::Group<GrandChild>,
 | |
|             data: GrandChild,
 | |
|             attributes: [
 | |
|                 gc: 0,
 | |
|             ],
 | |
|         };
 | |
| 
 | |
|         Ok(configfs::Group::new(
 | |
|             name.try_into()?,
 | |
|             tpe,
 | |
|             GrandChild::new(),
 | |
|         ))
 | |
|     }
 | |
| }
 | |
| 
 | |
| #[vtable]
 | |
| impl configfs::AttributeOperations<0> for Child {
 | |
|     type Data = Child;
 | |
| 
 | |
|     fn show(_container: &Child, page: &mut [u8; PAGE_SIZE]) -> Result<usize> {
 | |
|         pr_info!("Show baz\n");
 | |
|         let data = c"Hello Baz\n".to_bytes();
 | |
|         page[0..data.len()].copy_from_slice(data);
 | |
|         Ok(data.len())
 | |
|     }
 | |
| }
 | |
| 
 | |
| // `pin_data` cannot handle structs without braces.
 | |
| #[pin_data]
 | |
| struct GrandChild {}
 | |
| 
 | |
| impl GrandChild {
 | |
|     fn new() -> impl PinInit<Self, Error> {
 | |
|         try_pin_init!(Self {})
 | |
|     }
 | |
| }
 | |
| 
 | |
| #[vtable]
 | |
| impl configfs::AttributeOperations<0> for GrandChild {
 | |
|     type Data = GrandChild;
 | |
| 
 | |
|     fn show(_container: &GrandChild, page: &mut [u8; PAGE_SIZE]) -> Result<usize> {
 | |
|         pr_info!("Show grand child\n");
 | |
|         let data = c"Hello GC\n".to_bytes();
 | |
|         page[0..data.len()].copy_from_slice(data);
 | |
|         Ok(data.len())
 | |
|     }
 | |
| }
 |